Skip to content

Commit 5513100

Browse files
committed
[ValueTracking] Don't infer known bits from select arms
1 parent 51f9734 commit 5513100

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,14 +1574,11 @@ static void computeKnownBitsFromOperator(const Operator *I,
15741574

15751575
// If the Use is a select of this phi, use the knownbit of the other
15761576
// operand to break the recursion.
1577-
Value *IncCond = nullptr;
1578-
bool InvertIncCond = false;
15791577
if (auto *SI = dyn_cast<SelectInst>(IncValue)) {
15801578
if (SI->getTrueValue() == P || SI->getFalseValue() == P) {
1581-
InvertIncCond = SI->getTrueValue() == P;
1582-
IncValue = InvertIncCond ? SI->getFalseValue() : SI->getTrueValue();
1579+
IncValue = SI->getTrueValue() == P ? SI->getFalseValue()
1580+
: SI->getTrueValue();
15831581
IncDepth = Depth + 1;
1584-
IncCond = SI->getCondition();
15851582
}
15861583
}
15871584

@@ -1594,9 +1591,6 @@ static void computeKnownBitsFromOperator(const Operator *I,
15941591

15951592
Known2 = KnownBits(BitWidth);
15961593
computeKnownBits(IncValue, DemandedElts, Known2, IncDepth, RecQ);
1597-
if (IncCond)
1598-
adjustKnownBitsForSelectArm(Known2, IncCond, IncValue, InvertIncCond,
1599-
IncDepth, RecQ);
16001594

16011595
// See if we can further use a conditional branch into the phi
16021596
// to help us determine the range of the value.

0 commit comments

Comments
 (0)