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).
8define void @foo(%struct.Foo* align 4 %a) {
9entry:
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
18define fastcc void @bar(%struct.Foo* align 4 %a) {
19; CHECK-LABEL: @bar
20entry:
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
24if.then.i.i:
25  call void @llvm.assume(i1 undef)
26  unreachable
27
28if.end:
29  ret void
30}
31
32declare void @llvm.assume(i1)
33