-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for registration of hyperobject structure members
- Loading branch information
1 parent
cbf8108
commit 313115c
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// RUN: %clang_cc1 %s -fopencilk -fcxx-exceptions -fexceptions -O1 -verify -S -emit-llvm -disable-llvm-passes -o - | FileCheck %s | ||
// expected-no-diagnostics | ||
extern void id(void *), reduce(void *, void *); | ||
extern int getval(int); | ||
|
||
// A structure with an implicit constructor and explicit destructor. | ||
struct three_hyperobjects { | ||
int one = 1; | ||
int _Hyperobject(id, reduce) two = 2; | ||
int l1 = getval(-1); | ||
int _Hyperobject(id, reduce) three = 3; | ||
int l2 = getval(-2); | ||
int _Hyperobject(id, reduce) four = 4; | ||
// CHECK: define linkonce_odr void @_ZN18three_hyperobjectsC2Ev | ||
// CHECK: entry | ||
// CHECK: %one = getelementptr | ||
// CHECK: store i32 1, ptr %one | ||
// CHECK: %two = getelementptr | ||
// CHECK: store i32 2, ptr %two | ||
// CHECK: call void @llvm.reducer.register.i64(ptr %two | ||
// CHECK: %l1 = getelementptr inbounds | ||
// CHECK: %[[L1INIT:.+]] = invoke noundef i32 @_Z6getvali(i32 noundef -1) | ||
// CHECK-NEXT: to label %[[CONT1:.+]] unwind label %[[UNWIND1:.+]] | ||
// CHECK: [[CONT1]] | ||
// CHECK: store i32 %[[L1INIT]], ptr %l1 | ||
// CHECK: %three = getelementptr | ||
// CHECK: store i32 3, ptr %three | ||
// CHECK: call void @llvm.reducer.register.i64(ptr %three | ||
// CHECK: %[[L2INIT:.+]] = invoke noundef i32 @_Z6getvali(i32 noundef -2) | ||
// CHECK-NEXT: to label %[[CONT2:.+]] unwind label %[[UNWIND2:.+]] | ||
// CHECK: [[CONT2]] | ||
// CHECK: store i32 %[[L2INIT]], ptr %l2 | ||
// CHECK: %four = getelementptr | ||
// CHECK: store i32 4, ptr %four | ||
// CHECK: call void @llvm.reducer.register.i64(ptr %four | ||
// CHECK: ret void | ||
// CHECK: [[UNWIND1]] | ||
// CHECK-NEXT: landingpad | ||
// CHECK-NOT: call void @llvm.reducer.unregister | ||
// CHECK: br label %ehcleanup | ||
// CHECK: [[UNWIND2]] | ||
// CHECK-NEXT: landingpad | ||
// CHECK: call void @llvm.reducer.unregister | ||
// CHECK: br label %ehcleanup | ||
// CHECK: ehcleanup: | ||
// CHECK: call void @llvm.reducer.unregister | ||
// CHECK: resume | ||
|
||
// CHECK: define linkonce_odr void @_ZN18three_hyperobjectsD2Ev | ||
// Unregister in order four, three, two. In llvm 16 the IR variables | ||
// have the same names as the fields they address. | ||
// CHECK: call void @llvm.reducer.unregister(ptr %four) | ||
// CHECK: call void @llvm.reducer.unregister(ptr %three) | ||
// CHECK: call void @llvm.reducer.unregister(ptr %two) | ||
// CHECK: ret void | ||
~three_hyperobjects() { } | ||
}; | ||
|
||
three_hyperobjects s; | ||
|