Skip to content

Commit 7f21c77

Browse files
authored
ValueTracking: modernize isKnownInversion (NFC) (#126234)
1 parent a69975d commit 7f21c77

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Analysis/ValueTracking.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -8599,7 +8599,7 @@ bool llvm::isKnownInversion(const Value *X, const Value *Y) {
85998599
return false;
86008600

86018601
// They must both have samesign flag or not.
8602-
if (cast<ICmpInst>(X)->hasSameSign() != cast<ICmpInst>(Y)->hasSameSign())
8602+
if (Pred1.hasSameSign() != Pred2.hasSameSign())
86038603
return false;
86048604

86058605
if (B == C)
@@ -8611,8 +8611,7 @@ bool llvm::isKnownInversion(const Value *X, const Value *Y) {
86118611
return false;
86128612

86138613
// Sign bits of two RHSCs should match.
8614-
if (cast<ICmpInst>(X)->hasSameSign() &&
8615-
RHSC1->isNonNegative() != RHSC2->isNonNegative())
8614+
if (Pred1.hasSameSign() && RHSC1->isNonNegative() != RHSC2->isNonNegative())
86168615
return false;
86178616

86188617
const auto CR1 = ConstantRange::makeExactICmpRegion(Pred1, *RHSC1);

0 commit comments

Comments
 (0)