[llvm] [Reassociate] Distribute multiply over add to enable factorization (PR #178201)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 03:47:53 PDT 2026


================
@@ -1603,7 +1683,10 @@ Value *ReassociatePass::OptimizeAdd(Instruction *I,
         continue;
 
       unsigned Occ = ++FactorOccurrences[Factor];
-      if (Occ > MaxOcc) {
+      if (Occ > MaxOcc ||
+          (Occ == MaxOcc &&
----------------
dtcxzyw wrote:

I'd like to add a lambda helper for the updating logic and leave a comment describing the motivation.


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


More information about the llvm-commits mailing list