Lee Wei 9bf6365237
[llvm] Remove br i1 undef from some regression tests [NFC] (#118419)
This PR removes tests with `br i1 undef` under
`llvm/tests/Transforms/ObjCARC, Reassociate, SCCP, SLPVectorizer...`.
After this PR, I'll continue to fix tests under `llvm/tests/CodeGen`,
which has more UB tests than `llvm/tests/Transforms`.
2024-12-03 20:54:36 +00:00

58 lines
1.8 KiB
LLVM

; RUN: opt -S -passes=objc-arc < %s | FileCheck %s
; rdar://10210274
%0 = type opaque
declare ptr @llvm.objc.retain(ptr)
declare void @llvm.objc.release(ptr)
declare ptr @llvm.objc.autoreleaseReturnValue(ptr)
; Don't delete the autorelease.
; CHECK-LABEL: define ptr @test0(
; CHECK: @llvm.objc.retain
; CHECK: .lr.ph:
; CHECK-NOT: @llvm.objc.r
; CHECK: @llvm.objc.autoreleaseReturnValue
; CHECK-NOT: @llvm.objc.
; CHECK: }
define ptr @test0(ptr %buffer, i1 %arg) nounwind {
%1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
br i1 %arg, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %.lr.ph, %0
br i1 false, label %.lr.ph, label %._crit_edge
._crit_edge: ; preds = %.lr.ph, %0
%2 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
tail call void @llvm.objc.release(ptr %buffer) nounwind, !clang.imprecise_release !0
%3 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %buffer) nounwind
ret ptr %buffer
}
; Do delete the autorelease, even with the retain in a different block.
; CHECK-LABEL: define ptr @test1(
; CHECK-NOT: @objc
; CHECK: }
define ptr @test1(i1 %arg) nounwind {
%buffer = call ptr @foo()
%1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
br i1 %arg, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %.lr.ph, %0
br i1 false, label %.lr.ph, label %._crit_edge
._crit_edge: ; preds = %.lr.ph, %0
%2 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
tail call void @llvm.objc.release(ptr %buffer) nounwind, !clang.imprecise_release !0
%3 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %buffer) nounwind
ret ptr %buffer
}
declare ptr @foo()
!0 = !{}