Clang Project

clang_source_code/test/CodeGen/sparc-arguments.c
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
11struct s1 {
12  int x;
13} __attribute__((aligned(8)));
14
15struct s1 x1;
16
17
18// Ensure the align 8 is passed through:
19// CHECK-LABEL: define void @f1()
20// CHECK: call void @f1_helper(%struct.s1* byval align 8 @x1)
21// Also ensure the declaration of f1_helper includes it
22// CHECK: declare void @f1_helper(%struct.s1* byval align 8)
23
24void f1_helper(struct s1);
25void f1() {
26  f1_helper(x1);
27}
28