xref: /aosp_15_r20/external/llvm/test/Transforms/SimplifyCFG/lifetime.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -simplifycfg -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Test that a lifetime intrinsic isn't removed because that would change semantics
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; CHECK: foo
6*9880d681SAndroid Build Coastguard Worker; CHECK: entry:
7*9880d681SAndroid Build Coastguard Worker; CHECK: bb0:
8*9880d681SAndroid Build Coastguard Worker; CHECK: bb1:
9*9880d681SAndroid Build Coastguard Worker; CHECK: ret
10*9880d681SAndroid Build Coastguard Workerdefine void @foo(i1 %x) {
11*9880d681SAndroid Build Coastguard Workerentry:
12*9880d681SAndroid Build Coastguard Worker  %a = alloca i8
13*9880d681SAndroid Build Coastguard Worker  call void @llvm.lifetime.start(i64 -1, i8* %a) nounwind
14*9880d681SAndroid Build Coastguard Worker  br i1 %x, label %bb0, label %bb1
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerbb0:
17*9880d681SAndroid Build Coastguard Worker  call void @llvm.lifetime.end(i64 -1, i8* %a) nounwind
18*9880d681SAndroid Build Coastguard Worker  br label %bb1
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerbb1:
21*9880d681SAndroid Build Coastguard Worker  call void @f()
22*9880d681SAndroid Build Coastguard Worker  ret void
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdeclare void @f()
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.start(i64, i8* nocapture) nounwind
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
30