Skip to content

Commit 126b0ac

Browse files
committed
fixup! Move to SimplifyDemandedUseBits.
1 parent 7885f33 commit 126b0ac

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,15 +3844,6 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
38443844
}
38453845
}
38463846

3847-
// Try to infer the disjoint flag.
3848-
if (!cast<PossiblyDisjointInst>(I).isDisjoint()) {
3849-
WithCache<const Value *> LHSCache(Op0), RHSCache(Op1);
3850-
if (haveNoCommonBitsSet(LHSCache, RHSCache, SQ.getWithInstruction(&I))) {
3851-
cast<PossiblyDisjointInst>(I).setIsDisjoint(true);
3852-
return &I;
3853-
}
3854-
}
3855-
38563847
return nullptr;
38573848
}
38583849

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,16 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
264264
if (ShrinkDemandedConstant(I, 1, DemandedMask))
265265
return I;
266266

267+
// Infer disjoint flag if no common bits are set.
268+
if (!cast<PossiblyDisjointInst>(I)->isDisjoint()) {
269+
WithCache<const Value *> LHSCache(I->getOperand(0), LHSKnown),
270+
RHSCache(I->getOperand(1), RHSKnown);
271+
if (haveNoCommonBitsSet(LHSCache, RHSCache, SQ.getWithInstruction(I))) {
272+
cast<PossiblyDisjointInst>(I)->setIsDisjoint(true);
273+
return I;
274+
}
275+
}
276+
267277
break;
268278
}
269279
case Instruction::Xor: {

0 commit comments

Comments
 (0)