|
96 | 96 | load i8, i8* %a1
|
97 | 97 | ret void
|
98 | 98 | }
|
| 99 | + |
| 100 | +; Variation on the previous test case, where only the store to %a0 is dead, |
| 101 | +; but not the one to %a1. This tests for a potential caching bug. |
| 102 | +define void @test4(i1 %c) { |
| 103 | +; CHECK-LABEL: @test4( |
| 104 | +; CHECK-NEXT: [[A:%.*]] = alloca [2 x i8], align 1 |
| 105 | +; CHECK-NEXT: [[A0:%.*]] = getelementptr [2 x i8], [2 x i8]* [[A]], i32 0, i32 0 |
| 106 | +; CHECK-NEXT: [[A1:%.*]] = getelementptr [2 x i8], [2 x i8]* [[A]], i32 0, i32 1 |
| 107 | +; CHECK-NEXT: store i8 1, i8* [[A1]], align 1 |
| 108 | +; CHECK-NEXT: store i8 1, i8* [[A0]], align 1 |
| 109 | +; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]] |
| 110 | +; CHECK: if: |
| 111 | +; CHECK-NEXT: store [2 x i8] zeroinitializer, [2 x i8]* [[A]], align 1 |
| 112 | +; CHECK-NEXT: br label [[ELSE]] |
| 113 | +; CHECK: else: |
| 114 | +; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[A1]], align 1 |
| 115 | +; CHECK-NEXT: ret void |
| 116 | +; |
| 117 | + %a = alloca [2 x i8] |
| 118 | + %a0 = getelementptr [2 x i8], [2 x i8]* %a, i32 0, i32 0 |
| 119 | + %a1 = getelementptr [2 x i8], [2 x i8]* %a, i32 0, i32 1 |
| 120 | + store i8 1, i8* %a1 |
| 121 | + store i8 1, i8* %a0 |
| 122 | + br i1 %c, label %if, label %else |
| 123 | + |
| 124 | +if: |
| 125 | + store [2 x i8] zeroinitializer, [2 x i8]* %a |
| 126 | + br label %else |
| 127 | + |
| 128 | +else: |
| 129 | + load i8, i8* %a1 |
| 130 | + ret void |
| 131 | +} |
0 commit comments