[llvm] [InstCombine] Reassociate xor and disjoint or through zext (PR #214970)

Joyoungjin via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 07:00:43 PDT 2026


================
@@ -455,10 +469,18 @@ static bool simplifyAssocCastAssoc(BinaryOperator *BinOp1,
   if (!FoldedC)
     return false;
 
+  // A non-negative (X | C) implies that X is also non-negative.
+  bool PreserveNonNeg =
+      Cast->hasNonNeg() && BinOp2->getOpcode() == Instruction::Or;
----------------
hunterhhunter wrote:

Added the missing `or/or` proof and combined it with the existing proofs into a single Alive2 link. All four transformations are verified:

https://alive2.llvm.org/ce/z/tk9mOU

I also updated the PR description to use the combined proof.

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


More information about the llvm-commits mailing list