|
1 | 1 | ; RUN: opt < %s -S -speculative-execution | FileCheck %s
|
2 | 2 | ; RUN: opt < %s -S -passes='speculative-execution' | FileCheck %s
|
3 | 3 |
|
| 4 | +%class.B = type { i32 (...)** } |
| 5 | + |
| 6 | +; Testing that two bitcasts are not hoisted to the first BB |
| 7 | +define i8* @foo(%class.B* readonly %b) { |
| 8 | +; CHECK-LABEL: foo |
| 9 | +; CHECK-LABEL: entry |
| 10 | +; CHECK-NEXT: %i = icmp eq %class.B* %b, null |
| 11 | +; CHECK-NEXT: br i1 %i, label %end, label %notnull |
| 12 | +entry: |
| 13 | + %i = icmp eq %class.B* %b, null |
| 14 | + br i1 %i, label %end, label %notnull |
| 15 | + |
| 16 | +; CHECK-LABEL: notnull: |
| 17 | +; CHECK-NEXT: %i1 = bitcast %class.B* %b to i32** |
| 18 | +; CHECK: %i3 = bitcast %class.B* %b to i8* |
| 19 | +notnull: ; preds = %entry |
| 20 | + %i1 = bitcast %class.B* %b to i32** |
| 21 | + %vtable = load i32*, i32** %i1, align 8 |
| 22 | + %i2 = getelementptr inbounds i32, i32* %vtable, i64 -2 |
| 23 | + %offset.to.top = load i32, i32* %i2, align 4 |
| 24 | + %i3 = bitcast %class.B* %b to i8* |
| 25 | + %i4 = sext i32 %offset.to.top to i64 |
| 26 | + %i5 = getelementptr inbounds i8, i8* %i3, i64 %i4 |
| 27 | + br label %end |
| 28 | + |
| 29 | +end: ; preds = %notnull, %entry |
| 30 | + %i6 = phi i8* [ %i5, %notnull ], [ null, %entry ] |
| 31 | + ret i8* %i6 |
| 32 | +} |
| 33 | + |
4 | 34 | define void @f(i32 %i) {
|
5 | 35 | entry:
|
6 | 36 | ; CHECK-LABEL: @f(
|
|
0 commit comments