Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt -inline -S -o - < %s | FileCheck %s |
| 2 | ; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s |
| 3 | |
| 4 | %0 = type opaque |
| 5 | %struct.Foo = type { i32, %0* } |
| 6 | |
| 7 | ; Test that we don't crash when inlining @bar (rdar://22521387). |
| 8 | define void @foo(%struct.Foo* align 4 %a) { |
| 9 | entry: |
| 10 | call fastcc void @bar(%struct.Foo* nonnull align 4 undef) |
| 11 | |
| 12 | ; CHECK: call void @llvm.assume(i1 undef) |
| 13 | ; CHECK: unreachable |
| 14 | |
| 15 | ret void |
| 16 | } |
| 17 | |
| 18 | define fastcc void @bar(%struct.Foo* align 4 %a) { |
| 19 | ; CHECK-LABEL: @bar |
| 20 | entry: |
| 21 | %b = getelementptr inbounds %struct.Foo, %struct.Foo* %a, i32 0, i32 1 |
| 22 | br i1 undef, label %if.end, label %if.then.i.i |
| 23 | |
| 24 | if.then.i.i: |
| 25 | call void @llvm.assume(i1 undef) |
| 26 | unreachable |
| 27 | |
| 28 | if.end: |
| 29 | ret void |
| 30 | } |
| 31 | |
| 32 | declare void @llvm.assume(i1) |