xref: /aosp_15_r20/external/llvm/test/Transforms/Inline/inline-assume.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -inline -S -o - < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker%0 = type opaque
4*9880d681SAndroid Build Coastguard Worker%struct.Foo = type { i32, %0* }
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Test that we don't crash when inlining @bar (rdar://22521387).
7*9880d681SAndroid Build Coastguard Workerdefine void @foo(%struct.Foo* align 4 %a) {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker  call fastcc void @bar(%struct.Foo* nonnull align 4 undef)
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; CHECK: call void @llvm.assume(i1 undef)
12*9880d681SAndroid Build Coastguard Worker; CHECK: unreachable
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker  ret void
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine fastcc void @bar(%struct.Foo* align 4 %a) {
18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @bar
19*9880d681SAndroid Build Coastguard Workerentry:
20*9880d681SAndroid Build Coastguard Worker  %b = getelementptr inbounds %struct.Foo, %struct.Foo* %a, i32 0, i32 1
21*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %if.end, label %if.then.i.i
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerif.then.i.i:
24*9880d681SAndroid Build Coastguard Worker  call void @llvm.assume(i1 undef)
25*9880d681SAndroid Build Coastguard Worker  unreachable
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerif.end:
28*9880d681SAndroid Build Coastguard Worker  ret void
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.assume(i1)
32