[PATCH] D152281: [Transforms][LICM] Add the ability to undo unprofitable reassociation

Paul Osmialowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 15:00:33 PDT 2023


pawosm01 marked 2 inline comments as done.
pawosm01 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2677
 
+static bool hoistFPAssociation(Instruction &I, Loop &L,
+                               ICFLoopSafetyInfo &SafetyInfo,
----------------
qcolombet wrote:
> Could you add a comment on what this function is doing and what it means to return true or false?
> 
> It'll make the review easier.
I'll try.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2754-2755
+        Op->setOperand(i, Factored);
+        if (candidates)
+          candidates--;
+        break;
----------------
huntergr wrote:
> This seems a little odd, like you might be processing more candidates than you originally identified and want to prevent wrapping?
> 
> I think it might be better to see if you can add candidate operations to a SmallVector worklist and process them directly from that instead of walking back through the IR a second time.
Yeah, that simplifies the code indeed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152281/new/

https://reviews.llvm.org/D152281



More information about the llvm-commits mailing list