xref: /aosp_15_r20/external/llvm/test/Transforms/ObjCARC/pr12270.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -disable-output -objc-arc-contract < %s
2*9880d681SAndroid Build Coastguard Worker; test that we don't crash on unreachable code
3*9880d681SAndroid Build Coastguard Worker%2 = type opaque
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine void @_i_Test__foo(%2 *%x) {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker  unreachable
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerreturn:                                           ; No predecessors!
10*9880d681SAndroid Build Coastguard Worker  %bar = bitcast %2* %x to i8*
11*9880d681SAndroid Build Coastguard Worker  %foo = call i8* @objc_autoreleaseReturnValue(i8* %bar) nounwind
12*9880d681SAndroid Build Coastguard Worker  call void @callee()
13*9880d681SAndroid Build Coastguard Worker  call void @use_pointer(i8* %foo)
14*9880d681SAndroid Build Coastguard Worker  call void @objc_release(i8* %foo) nounwind
15*9880d681SAndroid Build Coastguard Worker  ret void
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_autoreleaseReturnValue(i8*)
19*9880d681SAndroid Build Coastguard Workerdeclare void @objc_release(i8*)
20*9880d681SAndroid Build Coastguard Workerdeclare void @callee()
21*9880d681SAndroid Build Coastguard Workerdeclare void @use_pointer(i8*)
22