Skip to content

Commit beee270

Browse files
committed
add nopoison back
1 parent 99f66fa commit beee270

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -1132,17 +1132,14 @@ void State::addInfoFor(BasicBlock &BB) {
11321132
case Intrinsic::umax:
11331133
case Intrinsic::smin:
11341134
case Intrinsic::smax:
1135+
case Intrinsic::usub_sat:
11351136
// TODO: handle llvm.abs as well
11361137
WorkList.push_back(
11371138
FactOrCheck::getCheck(DT.getNode(&BB), cast<CallInst>(&I)));
11381139
// TODO: Check if it is possible to instead only added the min/max facts
11391140
// when simplifying uses of the min/max intrinsics.
1140-
if (isGuaranteedNotToBePoison(&I))
1141-
WorkList.push_back(FactOrCheck::getInstFact(DT.getNode(&BB), &I));
1142-
break;
1143-
case Intrinsic::usub_sat:
1144-
WorkList.push_back(
1145-
FactOrCheck::getCheck(DT.getNode(&BB), cast<CallInst>(&I)));
1141+
if (!isGuaranteedNotToBePoison(&I))
1142+
break;
11461143
[[fallthrough]];
11471144
case Intrinsic::abs:
11481145
case Intrinsic::uadd_sat:

llvm/test/Transforms/ConstraintElimination/uadd-usub-sat.ll

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ define i1 @usub_sat_ule_lhs(i64 %a, i64 %b) {
2222
; CHECK-LABEL: define i1 @usub_sat_ule_lhs(
2323
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) {
2424
; CHECK-NEXT: [[SUB_SAT:%.*]] = call i64 @llvm.usub.sat.i64(i64 [[A]], i64 [[B]])
25-
; CHECK-NEXT: ret i1 true
25+
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i64 [[SUB_SAT]], [[A]]
26+
; CHECK-NEXT: ret i1 [[CMP]]
2627
;
2728
%sub.sat = call i64 @llvm.usub.sat.i64(i64 %a, i64 %b)
2829
%cmp = icmp ule i64 %sub.sat, %a

0 commit comments

Comments
 (0)