[llvm] [LICM] Prevent fold and hoist of binary ops with over 2 uses (PR #102114)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 03:00:18 PDT 2024


================
@@ -2806,7 +2806,8 @@ static bool hoistBOAssociation(Instruction &I, Loop &L,
     return false;
 
   auto *BO0 = dyn_cast<BinaryOperator>(BO->getOperand(0));
-  if (!BO0 || BO0->getOpcode() != Opcode || !BO0->isAssociative())
+  if (!BO0 || BO0->getOpcode() != Opcode || !BO0->isAssociative() ||
+      BO0->getNumUses() > 2)
----------------
rj-jesus wrote:

Thanks, done.

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


More information about the llvm-commits mailing list