[llvm] [LICM] Preserve Disjoint flag on OR when hoisting. (PR #140266)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 02:58:36 PDT 2025


================
@@ -2877,6 +2877,12 @@ static bool hoistBOAssociation(Instruction &I, Loop &L,
     if (auto *I = dyn_cast<Instruction>(Inv))
       I->setFastMathFlags(Intersect);
     NewBO->setFastMathFlags(Intersect);
+  } else if (Opcode == Instruction::Or) {
+    bool Disjoint = cast<PossiblyDisjointInst>(BO)->isDisjoint() &&
+                    cast<PossiblyDisjointInst>(BO0)->isDisjoint();
+    if (auto *I = dyn_cast<PossiblyDisjointInst>(Inv))
----------------
fhahn wrote:

Thanks, added the same comment as we have above for the ADD/MUL case.

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


More information about the llvm-commits mailing list