[llvm] [InstCombine] Explicitly set disjoint flag when converting xor to or. (PR #74229)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 11:05:12 PST 2023


================
@@ -315,6 +315,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
     if (DemandedMask.isSubsetOf(RHSKnown.Zero | LHSKnown.Zero)) {
       Instruction *Or =
           BinaryOperator::CreateOr(I->getOperand(0), I->getOperand(1));
+      cast<PossiblyDisjointInst>(Or)->setIsDisjoint(true);
----------------
topperc wrote:

I've added a check that the demanded mask is all ones.

https://github.com/llvm/llvm-project/pull/74229


More information about the llvm-commits mailing list