| 1 |
// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm -o - %s | FileCheck %s |
| 2 |
|
| 3 |
// Ensure that we pass proper alignment to llvm in the call |
| 4 |
// instruction. The proper alignment for the type is sometimes known |
| 5 |
// only by clang, and is not manifest in the LLVM-type. So, it must be |
| 6 |
// explicitly passed through. (Besides the case of the user specifying |
| 7 |
// alignment, as here, this situation also occurrs for non-POD C++ |
| 8 |
// structs with tail-padding: clang emits these as packed llvm-structs |
| 9 |
// for ABI reasons.) |
| 10 |
|
| 11 |
struct s1 { |
| 12 |
int x; |
| 13 |
} __attribute__((aligned(8))); |
| 14 |
|
| 15 |
struct s1 x1; |
| 16 |
|
| 17 |
|
| 18 |
// Ensure the align 8 is passed through: |
| 19 |
// CHECK-LABEL: define{{.*}} void @f1() |
| 20 |
// CHECK: call void @f1_helper(ptr noundef byval(%struct.s1) align 8 @x1) |
| 21 |
// Also ensure the declaration of f1_helper includes it |
| 22 |
// CHECK: declare void @f1_helper(ptr noundef byval(%struct.s1) align 8) |
| 23 |
|
| 24 |
void f1_helper(struct s1); |
| 25 |
void f1(void) { |
| 26 |
f1_helper(x1); |
| 27 |
} |