[llvm] [LICM] Fold associative binary ops to promote code hoisting (PR #81608)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 02:14:26 PDT 2024


================
@@ -2778,6 +2780,60 @@ static bool hoistMulAddAssociation(Instruction &I, Loop &L,
   return true;
 }
 
+/// Reassociate general associative binary expressions of the form
+///
+/// 1. "(LV op C1) op C2" ==> "LV op (C1 op C2)"
+///
+/// where op is an associative binary op, LV is a loop variant, and C1 and C2
+/// are loop invariants.
----------------
rj-jesus wrote:

Done, thanks!

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


More information about the llvm-commits mailing list