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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 3 00:37:08 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);
----------------
nikic wrote:

I don't think this is quite correct. This is only checking that the demanded bits are disjoint. If there is a conflict in the non-demanded bits, adding the `disjoint` flag is still going to make the result poison.

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


More information about the llvm-commits mailing list