Skip to content

Commit be9f72c

Browse files
committed
Revert "[ConstraintElim] Simplify cmp after uadd.sat/usub.sat (#135603)"
This reverts commit fe54d1a. Causes miscompiles, see #135603.
1 parent 257b727 commit be9f72c

File tree

2 files changed

+1
-59
lines changed

2 files changed

+1
-59
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,6 @@ void State::addInfoFor(BasicBlock &BB) {
11411141
break;
11421142
[[fallthrough]];
11431143
case Intrinsic::abs:
1144-
case Intrinsic::uadd_sat:
1145-
case Intrinsic::usub_sat:
11461144
WorkList.push_back(FactOrCheck::getInstFact(DT.getNode(&BB), &I));
11471145
break;
11481146
}
@@ -1893,26 +1891,13 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI,
18931891
AddFact(CmpInst::ICMP_SGE, CB.Inst, X);
18941892
continue;
18951893
}
1894+
18961895
if (auto *MinMax = dyn_cast<MinMaxIntrinsic>(CB.Inst)) {
18971896
Pred = ICmpInst::getNonStrictPredicate(MinMax->getPredicate());
18981897
AddFact(Pred, MinMax, MinMax->getLHS());
18991898
AddFact(Pred, MinMax, MinMax->getRHS());
19001899
continue;
19011900
}
1902-
if (auto *USatI = dyn_cast<SaturatingInst>(CB.Inst)) {
1903-
switch (USatI->getIntrinsicID()) {
1904-
default:
1905-
llvm_unreachable("Unexpected intrinsic.");
1906-
case Intrinsic::uadd_sat:
1907-
AddFact(ICmpInst::ICMP_UGE, USatI, USatI->getLHS());
1908-
AddFact(ICmpInst::ICMP_UGE, USatI, USatI->getRHS());
1909-
break;
1910-
case Intrinsic::usub_sat:
1911-
AddFact(ICmpInst::ICMP_ULE, USatI, USatI->getLHS());
1912-
break;
1913-
}
1914-
continue;
1915-
}
19161901
}
19171902

19181903
Value *A = nullptr, *B = nullptr;

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

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)