Skip to content

Commit 5451819

Browse files
committed
Correctly fix FoldGEP call, rebase + update tests
1 parent cfd8888 commit 5451819

File tree

54 files changed

+323
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+323
-323
lines changed

clang/test/CodeGen/RISCV/riscv-inline-asm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct Pair { int a, b; } pair;
5050

5151
// CHECK-LABEL: test_s(
5252
// CHECK: call void asm sideeffect "// $0 $1 $2", "s,s,s"(ptr nonnull @var, ptr nonnull getelementptr inbounds (i8, ptr @arr, {{.*}}), ptr nonnull @test_s)
53-
// CHECK: call void asm sideeffect "// $0", "s"(ptr nonnull getelementptr inbounds (i8, ptr @pair, {{.*}}))
53+
// CHECK: call void asm sideeffect "// $0", "s"(ptr nonnull getelementptr inbounds nuw (i8, ptr @pair, {{.*}}))
5454
// CHECK: call void asm sideeffect "// $0 $1 $2", "S,S,S"(ptr nonnull @var, ptr nonnull getelementptr inbounds (i8, ptr @arr, {{.*}}), ptr nonnull @test_s)
5555
void test_s(void) {
5656
asm("// %0 %1 %2" :: "s"(&var), "s"(&arr[1][1]), "s"(test_s));

clang/test/CodeGen/SystemZ/align-systemz-02.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void fun() {
2525
// VECIR: @GlobVsi = global <4 x i32> zeroinitializer, align 8
2626
// VECIR: @GlobS = global %struct.S zeroinitializer, align 8
2727
// VECIR: %0 = load volatile <4 x i32>, ptr @GlobVsi, align 8
28-
// VECIR: store <4 x i32> %0, ptr getelementptr inbounds (%struct.S, ptr @GlobS, i32 0, i32 1), align 8
28+
// VECIR: store <4 x i32> %0, ptr getelementptr inbounds nuw (%struct.S, ptr @GlobS, i32 0, i32 1), align 8
2929

3030
// VECASM: lgrl %r1, GlobVsi@GOT
3131
// VECASM-NEXT: vl %v0, 0(%r1), 3
@@ -45,7 +45,7 @@ void fun() {
4545
// SCALIR: @GlobVsi = global <4 x i32> zeroinitializer, align 16
4646
// SCALIR: @GlobS = global %struct.S zeroinitializer, align 16
4747
// SCALIR: %0 = load volatile <4 x i32>, ptr @GlobVsi, align 16
48-
// SCALIR: store <4 x i32> %0, ptr getelementptr inbounds (%struct.S, ptr @GlobS, i32 0, i32 2), align 16
48+
// SCALIR: store <4 x i32> %0, ptr getelementptr inbounds nuw (%struct.S, ptr @GlobS, i32 0, i32 2), align 16
4949

5050
// SCALASM: lgrl %r1, GlobVsi@GOT
5151
// SCALASM-NEXT: l %r0, 0(%r1)

clang/test/CodeGen/aarch64-varargs.c

Lines changed: 72 additions & 72 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/attr-counted-by.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ int test12_a, test12_b;
10981098
// SANITIZE-WITH-ATTR-NEXT: tail call void @__ubsan_handle_out_of_bounds_abort(ptr nonnull @[[GLOB20:[0-9]+]], i64 0) #[[ATTR10]], !nosanitize [[META2]]
10991099
// SANITIZE-WITH-ATTR-NEXT: unreachable, !nosanitize [[META2]]
11001100
// SANITIZE-WITH-ATTR: handler.type_mismatch6:
1101-
// SANITIZE-WITH-ATTR-NEXT: tail call void @__ubsan_handle_type_mismatch_v1_abort(ptr nonnull @[[GLOB21:[0-9]+]], i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @test12_foo, i64 4) to i64)) #[[ATTR10]], !nosanitize [[META2]]
1101+
// SANITIZE-WITH-ATTR-NEXT: tail call void @__ubsan_handle_type_mismatch_v1_abort(ptr nonnull @[[GLOB21:[0-9]+]], i64 ptrtoint (ptr getelementptr inbounds nuw (i8, ptr @test12_foo, i64 4) to i64)) #[[ATTR10]], !nosanitize [[META2]]
11021102
// SANITIZE-WITH-ATTR-NEXT: unreachable, !nosanitize [[META2]]
11031103
//
11041104
// NO-SANITIZE-WITH-ATTR-LABEL: define dso_local noundef i32 @test12(
@@ -1111,7 +1111,7 @@ int test12_a, test12_b;
11111111
// NO-SANITIZE-WITH-ATTR-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [6 x i32], ptr [[BAZ]], i64 0, i64 [[IDXPROM]]
11121112
// NO-SANITIZE-WITH-ATTR-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA2]]
11131113
// NO-SANITIZE-WITH-ATTR-NEXT: store i32 [[TMP0]], ptr @test12_b, align 4, !tbaa [[TBAA2]]
1114-
// NO-SANITIZE-WITH-ATTR-NEXT: [[TMP1:%.*]] = load i32, ptr getelementptr inbounds (i8, ptr @test12_foo, i64 4), align 4, !tbaa [[TBAA2]]
1114+
// NO-SANITIZE-WITH-ATTR-NEXT: [[TMP1:%.*]] = load i32, ptr getelementptr inbounds nuw (i8, ptr @test12_foo, i64 4), align 4, !tbaa [[TBAA2]]
11151115
// NO-SANITIZE-WITH-ATTR-NEXT: store i32 [[TMP1]], ptr @test12_a, align 4, !tbaa [[TBAA2]]
11161116
// NO-SANITIZE-WITH-ATTR-NEXT: br label [[FOR_COND:%.*]]
11171117
// NO-SANITIZE-WITH-ATTR: for.cond:
@@ -1140,7 +1140,7 @@ int test12_a, test12_b;
11401140
// SANITIZE-WITHOUT-ATTR-NEXT: tail call void @__ubsan_handle_out_of_bounds_abort(ptr nonnull @[[GLOB4:[0-9]+]], i64 0) #[[ATTR8]], !nosanitize [[META9]]
11411141
// SANITIZE-WITHOUT-ATTR-NEXT: unreachable, !nosanitize [[META9]]
11421142
// SANITIZE-WITHOUT-ATTR: handler.type_mismatch6:
1143-
// SANITIZE-WITHOUT-ATTR-NEXT: tail call void @__ubsan_handle_type_mismatch_v1_abort(ptr nonnull @[[GLOB5:[0-9]+]], i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @test12_foo, i64 4) to i64)) #[[ATTR8]], !nosanitize [[META9]]
1143+
// SANITIZE-WITHOUT-ATTR-NEXT: tail call void @__ubsan_handle_type_mismatch_v1_abort(ptr nonnull @[[GLOB5:[0-9]+]], i64 ptrtoint (ptr getelementptr inbounds nuw (i8, ptr @test12_foo, i64 4) to i64)) #[[ATTR8]], !nosanitize [[META9]]
11441144
// SANITIZE-WITHOUT-ATTR-NEXT: unreachable, !nosanitize [[META9]]
11451145
//
11461146
// NO-SANITIZE-WITHOUT-ATTR-LABEL: define dso_local noundef i32 @test12(
@@ -1153,7 +1153,7 @@ int test12_a, test12_b;
11531153
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [6 x i32], ptr [[BAZ]], i64 0, i64 [[IDXPROM]]
11541154
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !tbaa [[TBAA2]]
11551155
// NO-SANITIZE-WITHOUT-ATTR-NEXT: store i32 [[TMP0]], ptr @test12_b, align 4, !tbaa [[TBAA2]]
1156-
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[TMP1:%.*]] = load i32, ptr getelementptr inbounds (i8, ptr @test12_foo, i64 4), align 4, !tbaa [[TBAA2]]
1156+
// NO-SANITIZE-WITHOUT-ATTR-NEXT: [[TMP1:%.*]] = load i32, ptr getelementptr inbounds nuw (i8, ptr @test12_foo, i64 4), align 4, !tbaa [[TBAA2]]
11571157
// NO-SANITIZE-WITHOUT-ATTR-NEXT: store i32 [[TMP1]], ptr @test12_a, align 4, !tbaa [[TBAA2]]
11581158
// NO-SANITIZE-WITHOUT-ATTR-NEXT: br label [[FOR_COND:%.*]]
11591159
// NO-SANITIZE-WITHOUT-ATTR: for.cond:

clang/test/CodeGen/catch-nullptr-and-nonzero-offset-in-offsetof-idiom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct S {
1717

1818
// CHECK-LABEL: @get_offset_of_y_naively(
1919
// CHECK-NEXT: entry:
20-
// CHECK-NEXT: ret i64 ptrtoint (ptr getelementptr inbounds ([[STRUCT_S:%.*]], ptr null, i32 0, i32 1) to i64)
20+
// CHECK-NEXT: ret i64 ptrtoint (ptr getelementptr inbounds nuw ([[STRUCT_S:%.*]], ptr null, i32 0, i32 1) to i64)
2121
//
2222
uintptr_t get_offset_of_y_naively(void) {
2323
return ((uintptr_t)(&(((struct S *)0)->y)));

clang/test/CodeGen/complex-strictfp.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ double D;
1919
// CHECK-NEXT: entry:
2020
// CHECK-NEXT: [[TMP0:%.*]] = load double, ptr @D, align 8
2121
// CHECK-NEXT: [[CF_REAL:%.*]] = load float, ptr @cf, align 4
22-
// CHECK-NEXT: [[CF_IMAG:%.*]] = load float, ptr getelementptr inbounds ({ float, float }, ptr @cf, i32 0, i32 1), align 4
22+
// CHECK-NEXT: [[CF_IMAG:%.*]] = load float, ptr getelementptr inbounds nuw ({ float, float }, ptr @cf, i32 0, i32 1), align 4
2323
// CHECK-NEXT: [[CONV:%.*]] = call double @llvm.experimental.constrained.fpext.f64.f32(float [[CF_REAL]], metadata !"fpexcept.strict") #[[ATTR2:[0-9]+]]
2424
// CHECK-NEXT: [[CONV1:%.*]] = call double @llvm.experimental.constrained.fpext.f64.f32(float [[CF_IMAG]], metadata !"fpexcept.strict") #[[ATTR2]]
2525
// CHECK-NEXT: [[ADD_R:%.*]] = call double @llvm.experimental.constrained.fadd.f64(double [[CONV]], double [[TMP0]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
2626
// CHECK-NEXT: [[CONV2:%.*]] = call float @llvm.experimental.constrained.fptrunc.f32.f64(double [[ADD_R]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
2727
// CHECK-NEXT: [[CONV3:%.*]] = call float @llvm.experimental.constrained.fptrunc.f32.f64(double [[CONV1]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
2828
// CHECK-NEXT: store float [[CONV2]], ptr @cf, align 4
29-
// CHECK-NEXT: store float [[CONV3]], ptr getelementptr inbounds ({ float, float }, ptr @cf, i32 0, i32 1), align 4
29+
// CHECK-NEXT: store float [[CONV3]], ptr getelementptr inbounds nuw ({ float, float }, ptr @cf, i32 0, i32 1), align 4
3030
// CHECK-NEXT: ret void
3131
//
3232
void test3a(void) {
@@ -36,7 +36,7 @@ void test3a(void) {
3636
// CHECK-LABEL: @test3b(
3737
// CHECK-NEXT: entry:
3838
// CHECK-NEXT: [[CF_REAL:%.*]] = load float, ptr @cf, align 4
39-
// CHECK-NEXT: [[CF_IMAG:%.*]] = load float, ptr getelementptr inbounds ({ float, float }, ptr @cf, i32 0, i32 1), align 4
39+
// CHECK-NEXT: [[CF_IMAG:%.*]] = load float, ptr getelementptr inbounds nuw ({ float, float }, ptr @cf, i32 0, i32 1), align 4
4040
// CHECK-NEXT: [[CONV:%.*]] = call double @llvm.experimental.constrained.fpext.f64.f32(float [[CF_REAL]], metadata !"fpexcept.strict") #[[ATTR2]]
4141
// CHECK-NEXT: [[CONV1:%.*]] = call double @llvm.experimental.constrained.fpext.f64.f32(float [[CF_IMAG]], metadata !"fpexcept.strict") #[[ATTR2]]
4242
// CHECK-NEXT: [[TMP0:%.*]] = load double, ptr @D, align 8
@@ -51,9 +51,9 @@ void test3b(void) {
5151
// CHECK-LABEL: @test3c(
5252
// CHECK-NEXT: entry:
5353
// CHECK-NEXT: [[G1_REAL:%.*]] = load double, ptr @g1, align 8
54-
// CHECK-NEXT: [[G1_IMAG:%.*]] = load double, ptr getelementptr inbounds ({ double, double }, ptr @g1, i32 0, i32 1), align 8
54+
// CHECK-NEXT: [[G1_IMAG:%.*]] = load double, ptr getelementptr inbounds nuw ({ double, double }, ptr @g1, i32 0, i32 1), align 8
5555
// CHECK-NEXT: [[CF_REAL:%.*]] = load float, ptr @cf, align 4
56-
// CHECK-NEXT: [[CF_IMAG:%.*]] = load float, ptr getelementptr inbounds ({ float, float }, ptr @cf, i32 0, i32 1), align 4
56+
// CHECK-NEXT: [[CF_IMAG:%.*]] = load float, ptr getelementptr inbounds nuw ({ float, float }, ptr @cf, i32 0, i32 1), align 4
5757
// CHECK-NEXT: [[CONV:%.*]] = call double @llvm.experimental.constrained.fpext.f64.f32(float [[CF_REAL]], metadata !"fpexcept.strict") #[[ATTR2]]
5858
// CHECK-NEXT: [[CONV1:%.*]] = call double @llvm.experimental.constrained.fpext.f64.f32(float [[CF_IMAG]], metadata !"fpexcept.strict") #[[ATTR2]]
5959
// CHECK-NEXT: [[CALL:%.*]] = call { double, double } @__divdc3(double noundef [[CONV]], double noundef [[CONV1]], double noundef [[G1_REAL]], double noundef [[G1_IMAG]]) #[[ATTR3:[0-9]+]]
@@ -62,7 +62,7 @@ void test3b(void) {
6262
// CHECK-NEXT: [[CONV2:%.*]] = call float @llvm.experimental.constrained.fptrunc.f32.f64(double [[TMP0]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
6363
// CHECK-NEXT: [[CONV3:%.*]] = call float @llvm.experimental.constrained.fptrunc.f32.f64(double [[TMP1]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
6464
// CHECK-NEXT: store float [[CONV2]], ptr @cf, align 4
65-
// CHECK-NEXT: store float [[CONV3]], ptr getelementptr inbounds ({ float, float }, ptr @cf, i32 0, i32 1), align 4
65+
// CHECK-NEXT: store float [[CONV3]], ptr getelementptr inbounds nuw ({ float, float }, ptr @cf, i32 0, i32 1), align 4
6666
// CHECK-NEXT: ret void
6767
//
6868
void test3c(void) {
@@ -72,11 +72,11 @@ void test3c(void) {
7272
// CHECK-LABEL: @test3d(
7373
// CHECK-NEXT: entry:
7474
// CHECK-NEXT: [[G1_REAL:%.*]] = load double, ptr @g1, align 8
75-
// CHECK-NEXT: [[G1_IMAG:%.*]] = load double, ptr getelementptr inbounds ({ double, double }, ptr @g1, i32 0, i32 1), align 8
75+
// CHECK-NEXT: [[G1_IMAG:%.*]] = load double, ptr getelementptr inbounds nuw ({ double, double }, ptr @g1, i32 0, i32 1), align 8
7676
// CHECK-NEXT: [[TMP0:%.*]] = load double, ptr @D, align 8
7777
// CHECK-NEXT: [[ADD_R:%.*]] = call double @llvm.experimental.constrained.fadd.f64(double [[G1_REAL]], double [[TMP0]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
7878
// CHECK-NEXT: store double [[ADD_R]], ptr @g1, align 8
79-
// CHECK-NEXT: store double [[G1_IMAG]], ptr getelementptr inbounds ({ double, double }, ptr @g1, i32 0, i32 1), align 8
79+
// CHECK-NEXT: store double [[G1_IMAG]], ptr getelementptr inbounds nuw ({ double, double }, ptr @g1, i32 0, i32 1), align 8
8080
// CHECK-NEXT: ret void
8181
//
8282
void test3d(void) {
@@ -87,10 +87,10 @@ void test3d(void) {
8787
// CHECK-NEXT: entry:
8888
// CHECK-NEXT: [[TMP0:%.*]] = load double, ptr @D, align 8
8989
// CHECK-NEXT: [[G1_REAL:%.*]] = load double, ptr @g1, align 8
90-
// CHECK-NEXT: [[G1_IMAG:%.*]] = load double, ptr getelementptr inbounds ({ double, double }, ptr @g1, i32 0, i32 1), align 8
90+
// CHECK-NEXT: [[G1_IMAG:%.*]] = load double, ptr getelementptr inbounds nuw ({ double, double }, ptr @g1, i32 0, i32 1), align 8
9191
// CHECK-NEXT: [[ADD_R:%.*]] = call double @llvm.experimental.constrained.fadd.f64(double [[TMP0]], double [[G1_REAL]], metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
9292
// CHECK-NEXT: store double [[ADD_R]], ptr @g1, align 8
93-
// CHECK-NEXT: store double [[G1_IMAG]], ptr getelementptr inbounds ({ double, double }, ptr @g1, i32 0, i32 1), align 8
93+
// CHECK-NEXT: store double [[G1_IMAG]], ptr getelementptr inbounds nuw ({ double, double }, ptr @g1, i32 0, i32 1), align 8
9494
// CHECK-NEXT: ret void
9595
//
9696
void test3e(void) {
@@ -110,7 +110,7 @@ void t1(void) {
110110
// CHECK-LABEL: @t2(
111111
// CHECK-NEXT: entry:
112112
// CHECK-NEXT: [[CONV:%.*]] = call float @llvm.experimental.constrained.fptrunc.f32.f64(double 4.000000e+00, metadata !"round.upward", metadata !"fpexcept.strict") #[[ATTR2]]
113-
// CHECK-NEXT: store float [[CONV]], ptr getelementptr inbounds ({ float, float }, ptr @cf, i32 0, i32 1), align 4
113+
// CHECK-NEXT: store float [[CONV]], ptr getelementptr inbounds nuw ({ float, float }, ptr @cf, i32 0, i32 1), align 4
114114
// CHECK-NEXT: ret void
115115
//
116116
void t2(void) {

clang/test/CodeGen/packed-nest-unpacked.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,38 @@ struct X foo(void);
88

99
struct X test1(void) {
1010
// CHECK: @test1
11-
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
11+
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
1212
return g.y;
1313
}
1414
struct X test2(void) {
1515
// CHECK: @test2
16-
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
16+
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
1717
struct X a = g.y;
1818
return a;
1919
}
2020

2121
void test3(struct X a) {
2222
// CHECK: @test3
23-
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds (%struct.Y, ptr @g, i32 0, i32 1), ptr {{.*}}, i64 24, i1 false)
23+
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), ptr {{.*}}, i64 24, i1 false)
2424
g.y = a;
2525
}
2626

2727
void test4(void) {
2828
// CHECK: @test4
29-
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
29+
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
3030
f(g.y);
3131
}
3232

3333
// PR12395
3434
int test5(void) {
3535
// CHECK: @test5
36-
// CHECK: load i32, ptr getelementptr inbounds (%struct.Y, ptr @g, i32 0, i32 1), align 1
36+
// CHECK: load i32, ptr getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), align 1
3737
return g.y.x[0];
3838
}
3939

4040
void test6(void) {
4141
// CHECK: @test6
42-
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds (%struct.Y, ptr @g, i32 0, i32 1), ptr align 4 %{{.*}}, i64 24, i1 false)
42+
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), ptr align 4 %{{.*}}, i64 24, i1 false)
4343
g.y = foo();
4444
}
4545

@@ -57,14 +57,14 @@ struct YBitfield gbitfield;
5757

5858
unsigned test7(void) {
5959
// CHECK: @test7
60-
// CHECK: load i32, ptr getelementptr inbounds (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
60+
// CHECK: load i32, ptr getelementptr inbounds nuw (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
6161
return gbitfield.y.b2;
6262
}
6363

6464
void test8(unsigned x) {
6565
// CHECK: @test8
66-
// CHECK: load i32, ptr getelementptr inbounds (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
67-
// CHECK: store i32 {{.*}}, ptr getelementptr inbounds (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
66+
// CHECK: load i32, ptr getelementptr inbounds nuw (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
67+
// CHECK: store i32 {{.*}}, ptr getelementptr inbounds nuw (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
6868
gbitfield.y.b2 = x;
6969
}
7070

@@ -78,14 +78,14 @@ struct TBitfield tbitfield;
7878

7979
unsigned test9(void) {
8080
// CHECK: @test9
81-
// CHECK: load i16, ptr getelementptr inbounds (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
81+
// CHECK: load i16, ptr getelementptr inbounds nuw (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
8282
return tbitfield.c;
8383
}
8484

8585
void test10(unsigned x) {
8686
// CHECK: @test10
87-
// CHECK: load i16, ptr getelementptr inbounds (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
88-
// CHECK: store i16 {{.*}}, ptr getelementptr inbounds (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
87+
// CHECK: load i16, ptr getelementptr inbounds nuw (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
88+
// CHECK: store i16 {{.*}}, ptr getelementptr inbounds nuw (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
8989
tbitfield.c = x;
9090
}
9191

clang/test/CodeGen/unaligned-expr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ struct S1 {
180180

181181
__unaligned S1 s1;
182182
void test20(void) {
183-
// CHECK: {{%.*}} = load i32, ptr getelementptr inbounds (%struct.S1, ptr @s1, i32 0, i32 1), align 1
184-
// CHECK: store i32 {{%.*}}, ptr getelementptr inbounds (%struct.S1, ptr @s1, i32 0, i32 1), align 1
183+
// CHECK: {{%.*}} = load i32, ptr getelementptr inbounds nuw (%struct.S1, ptr @s1, i32 0, i32 1), align 1
184+
// CHECK: store i32 {{%.*}}, ptr getelementptr inbounds nuw (%struct.S1, ptr @s1, i32 0, i32 1), align 1
185185
s1.x++;
186186
}
187187

@@ -202,8 +202,8 @@ struct __attribute__((packed)) S2 {
202202

203203
__unaligned S2 s2;
204204
void test22(void) {
205-
// CHECK: {{%.*}} = load i32, ptr getelementptr inbounds (%struct.S2, ptr @s2, i32 0, i32 1), align 1
206-
// CHECK: store i32 {{%.*}}, ptr getelementptr inbounds (%struct.S2, ptr @s2, i32 0, i32 1), align 1
205+
// CHECK: {{%.*}} = load i32, ptr getelementptr inbounds nuw (%struct.S2, ptr @s2, i32 0, i32 1), align 1
206+
// CHECK: store i32 {{%.*}}, ptr getelementptr inbounds nuw (%struct.S2, ptr @s2, i32 0, i32 1), align 1
207207
s2.x++;
208208
}
209209

0 commit comments

Comments
 (0)