[llvm] [LICM][WIP] Make an integer version of hoistFPAssociation. (PR #67736)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 12:37:36 PDT 2023


================
@@ -2719,6 +2728,65 @@ static bool hoistFPAssociation(Instruction &I, Loop &L,
   return true;
 }
 
+static bool hoistIntAssociation(Instruction &I, Loop &L,
----------------
preames wrote:

Actually, if I'm right here about there being a distribution step here, isn't the prior FP code unsound?  At least according to wikipedia (https://en.wikipedia.org/wiki/Distributive_property), floating point multiplication does not distribute over addition, and I don't know hasAllowReassoc gives enough freedom.  (Since this isn't re-association).

Note that 2s complement integer math doesn't have this problem.  

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


More information about the llvm-commits mailing list