llvm-project/llvm/test/Transforms/SCCP/ipsccp-branch-unresolved-undef.ll
Nikita Popov 1f88d80408 [SCCP] Don't mark edges feasible when resolving undefs
As branch on undef is immediate undefined behavior, there is no need
to mark one of the edges as feasible. We can leave all the edges
non-feasible. In IPSCCP, we can replace the branch with an unreachable
terminator.

Differential Revision: https://reviews.llvm.org/D126962
2022-06-22 10:28:27 +02:00

24 lines
590 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
; RUN: opt < %s -S -passes=ipsccp | FileCheck %s
define void @main() {
; CHECK-LABEL: define {{[^@]+}}@main() {
; CHECK-NEXT: [[CALL:%.*]] = call i1 @patatino(i1 undef)
; CHECK-NEXT: ret void
;
%call = call i1 @patatino(i1 undef)
ret void
}
define internal i1 @patatino(i1 %a) {
; CHECK-LABEL: define {{[^@]+}}@patatino
; CHECK-SAME: (i1 [[A:%.*]]) {
; CHECK-NEXT: unreachable
;
br i1 %a, label %ontrue, label %onfalse
ontrue:
ret i1 false
onfalse:
ret i1 false
}