[llvm] [LICM] Preserve Disjoint flag on OR when hoisting. (PR #140266)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Fri May 16 14:12:51 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))
----------------
efriedma-quic wrote:
It's not actually wrong with ConstantFolder, I guess, but the interaction is pretty subtle. I've seen similar-looking code cause real issues.
Maybe it's enough to spell out that it's using ConstantFolder, and why it's getting used?
https://github.com/llvm/llvm-project/pull/140266
More information about the llvm-commits
mailing list