@@ -11,10 +11,17 @@ declare i32 @somevalue()
1111
1212define void @f () {
1313; CHECK-LABEL: @f(
14+ ; CHECK-NEXT: [[A:%.*]] = alloca [[T:%.*]], align 8
15+ ; CHECK-NEXT: [[A1_I8_INV:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[A]])
16+ ; CHECK-NEXT: [[A2:%.*]] = getelementptr inbounds [[T]], ptr [[A]], i32 0, i32 1
1417; CHECK-NEXT: [[SV1:%.*]] = call i32 @somevalue()
1518; CHECK-NEXT: [[SV2:%.*]] = call i32 @somevalue()
16- ; CHECK-NEXT: call void @h(i32 [[SV1]])
17- ; CHECK-NEXT: call void @h(i32 [[SV2]])
19+ ; CHECK-NEXT: store i32 [[SV1]], ptr [[A1_I8_INV]], align 4, !invariant.group [[META0:![0-9]+]]
20+ ; CHECK-NEXT: store i32 [[SV2]], ptr [[A2]], align 4
21+ ; CHECK-NEXT: [[V1:%.*]] = load i32, ptr [[A1_I8_INV]], align 4, !invariant.group [[META0]]
22+ ; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[A2]], align 4
23+ ; CHECK-NEXT: call void @h(i32 [[V1]])
24+ ; CHECK-NEXT: call void @h(i32 [[V2]])
1825; CHECK-NEXT: ret void
1926;
2027 %a = alloca %t
@@ -44,7 +51,7 @@ define void @g() {
4451; CHECK-NEXT: [[A2:%.*]] = getelementptr inbounds [[T]], ptr [[A]], i32 0, i32 1
4552; CHECK-NEXT: [[SV1:%.*]] = call i32 @somevalue()
4653; CHECK-NEXT: [[SV2:%.*]] = call i32 @somevalue()
47- ; CHECK-NEXT: store i32 [[SV1]], ptr [[A1_I8_INV]], align 4, !invariant.group [[META0:![0-9]+ ]]
54+ ; CHECK-NEXT: store i32 [[SV1]], ptr [[A1_I8_INV]], align 4, !invariant.group [[META0]]
4855; CHECK-NEXT: store i32 [[SV2]], ptr [[A2]], align 4
4956; CHECK-NEXT: [[V1:%.*]] = load i32, ptr [[A1_I8_INV]], align 4, !invariant.group [[META0]]
5057; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[A2]], align 4
@@ -81,6 +88,9 @@ define void @g() {
8188
8289define void @store_and_launder () {
8390; CHECK-LABEL: @store_and_launder(
91+ ; CHECK-NEXT: [[VALPTR:%.*]] = alloca i32, align 4
92+ ; CHECK-NEXT: store i32 0, ptr [[VALPTR]], align 4
93+ ; CHECK-NEXT: [[BARR:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[VALPTR]])
8494; CHECK-NEXT: ret void
8595;
8696 %valptr = alloca i32 , align 4
@@ -91,7 +101,10 @@ define void @store_and_launder() {
91101
92102define i32 @launder_and_load () {
93103; CHECK-LABEL: @launder_and_load(
94- ; CHECK-NEXT: ret i32 undef
104+ ; CHECK-NEXT: [[VALPTR:%.*]] = alloca i32, align 4
105+ ; CHECK-NEXT: [[BARR:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[VALPTR]])
106+ ; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[VALPTR]], align 4
107+ ; CHECK-NEXT: ret i32 [[V2]]
95108;
96109 %valptr = alloca i32 , align 4
97110 %barr = call ptr @llvm.launder.invariant.group.p0 (ptr %valptr )
@@ -101,6 +114,9 @@ define i32 @launder_and_load() {
101114
102115define void @launder_and_ptr_arith () {
103116; CHECK-LABEL: @launder_and_ptr_arith(
117+ ; CHECK-NEXT: [[VALPTR:%.*]] = alloca i32, align 4
118+ ; CHECK-NEXT: [[BARR:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[VALPTR]])
119+ ; CHECK-NEXT: [[A2:%.*]] = getelementptr inbounds i32, ptr [[VALPTR]], i32 0
104120; CHECK-NEXT: ret void
105121;
106122 %valptr = alloca i32 , align 4
@@ -140,9 +156,13 @@ end:
140156
141157define void @partial_promotion_of_alloca () {
142158; CHECK-LABEL: @partial_promotion_of_alloca(
143- ; CHECK-NEXT: [[STRUCT_PTR_SROA_2:%.*]] = alloca i32, align 4
144- ; CHECK-NEXT: store volatile i32 0, ptr [[STRUCT_PTR_SROA_2]], align 4
145- ; CHECK-NEXT: [[STRUCT_PTR_SROA_2_0_STRUCT_PTR_SROA_2_4_LOAD_VAL:%.*]] = load volatile i32, ptr [[STRUCT_PTR_SROA_2]], align 4
159+ ; CHECK-NEXT: [[STRUCT_PTR:%.*]] = alloca [[T:%.*]], align 4
160+ ; CHECK-NEXT: [[FIELD_PTR:%.*]] = getelementptr inbounds [[T]], ptr [[STRUCT_PTR]], i32 0, i32 0
161+ ; CHECK-NEXT: store i32 0, ptr [[FIELD_PTR]], align 4
162+ ; CHECK-NEXT: [[VOLATILE_FIELD_PTR:%.*]] = getelementptr inbounds [[T]], ptr [[STRUCT_PTR]], i32 0, i32 1
163+ ; CHECK-NEXT: store volatile i32 0, ptr [[VOLATILE_FIELD_PTR]], align 4, !invariant.group [[META0]]
164+ ; CHECK-NEXT: [[BARR:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[STRUCT_PTR]])
165+ ; CHECK-NEXT: [[LOAD_VAL:%.*]] = load volatile i32, ptr [[VOLATILE_FIELD_PTR]], align 4, !invariant.group [[META0]]
146166; CHECK-NEXT: ret void
147167;
148168 %struct_ptr = alloca %t , align 4
0 commit comments