Skip to content

Commit 17c8b66

Browse files
committed
fixup! [InstCombine] Use known bits to simplify mask in foldSelectICmpAnd
1 parent ffd7298 commit 17c8b66

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static Instruction *foldSelectBinOpIdentity(SelectInst &Sel,
121121
/// isn't needed, or the bit widths don't match.
122122
static Value *foldSelectICmpAnd(SelectInst &Sel, ICmpInst *Cmp,
123123
InstCombiner::BuilderTy &Builder,
124-
SimplifyQuery &SQ) {
124+
const SimplifyQuery &SQ) {
125125
const APInt *SelTC, *SelFC;
126126
if (!match(Sel.getTrueValue(), m_APInt(SelTC)) ||
127127
!match(Sel.getFalseValue(), m_APInt(SelFC)))
@@ -151,7 +151,8 @@ static Value *foldSelectICmpAnd(SelectInst &Sel, ICmpInst *Cmp,
151151
assert(ICmpInst::isEquality(Res->Pred) && "Not equality test?");
152152
AndMask = Res->Mask;
153153
V = Res->X;
154-
KnownBits Known = computeKnownBits(V, 0, SQ.getWithInstruction(Cmp));
154+
KnownBits Known =
155+
computeKnownBits(V, /*Depth=*/0, SQ.getWithInstruction(&Sel));
155156
AndMask &= Known.getMaxValue();
156157
if (!AndMask.isPowerOf2())
157158
return nullptr;

0 commit comments

Comments
 (0)