llvm-project/clang/test/CodeGenCXX/cxx23-p2280r4.cpp
David Spickett cac6d431d0
[clang][test] Don't require specific alignment in test case (#130589)
https://github.com/llvm/llvm-project/pull/129952 /
42d49a77241df73a17cb442973702fc460e7fb90 added this test which is
failing on 32-bit ARM because the alignment chosen is 4 not 8. Which
would make sense if this is a 32/64 bit difference

https://lab.llvm.org/buildbot/#/builders/154/builds/13059
```
<stdin>:34:30: note: scanning from here
define dso_local void @_Z1fv(ptr dead_on_unwind noalias writable sret(%struct.B) align 4 %agg.result) #0 {
                             ^
<stdin>:38:2: note: possible intended match here
 %0 = load ptr, ptr @x, align 4
 ^
```
The other test does not check alignment, so I'm assuming that it is not
important here.
2025-03-10 13:45:44 +00:00

29 lines
966 B
C++

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++23 %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++17 %s -emit-llvm -o - | FileCheck %s
extern int& s;
// CHECK-LABEL: @_Z4testv()
// CHECK-NEXT: entry:
// CHECK-NEXT: [[I:%.*]] = alloca ptr, align {{.*}}
// CHECK-NEXT: [[X:%.*]] = load ptr, ptr @s, align {{.*}}
// CHECK-NEXT: store ptr [[X]], ptr [[I]], align {{.*}}
int& test() {
auto &i = s;
return i;
}
// CHECK-LABEL: @_Z1fv(
// CHECK: [[X1:%.*]] = load ptr, ptr @x, align {{.*}}
// CHECK-NEXT: store ptr [[X1]]
// CHECK: [[X2:%.*]] = load ptr, ptr @x, align {{.*}}
// CHECK-NEXT: store ptr [[X2]]
// CHECK: [[X3:%.*]] = load ptr, ptr @x, align {{.*}}
// CHECK-NEXT: store ptr [[X3]]
int &ff();
int &x = ff();
struct A { int& x; };
struct B { A x[20]; };
B f() { return {x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x}; }