[llvm] [llvm][LICM] Add flag to control re-association (PR #149829)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 02:50:46 PDT 2025


================
@@ -2850,7 +2855,7 @@ static bool hoistBOAssociation(Instruction &I, Loop &L,
   bool LVInRHS = L.isLoopInvariant(BO->getOperand(0));
   auto *BO0 = dyn_cast<BinaryOperator>(BO->getOperand(LVInRHS));
   if (!BO0 || BO0->getOpcode() != Opcode || !BO0->isAssociative() ||
-      BO0->hasNUsesOrMore(3))
+      BO0->hasNUsesOrMore(BOAssociationUserLimit + 1))
----------------
fhahn wrote:

Sure, the main issue with a flag like this is that it won't really benefit our users and is just a workaround.

Not objecting, since we already have similar flags for cut-offs, but tackling in a way that doesn't require special flags would be much more beneficial to our users

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


More information about the llvm-commits mailing list