[PATCH] D82709: [MachineLICM] [PowerPC] hoisting rematerializable cheap instructions based on register pressure.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 12:28:56 PDT 2020


efriedma added a comment.

> when machine licm gets a cheap rematerializable instruction, it will also check the user inside the loop. if the user is also a loop invariant, do not hoist it blindly, instead it hoists the instruction after evaluating the register pressure

Wouldn't it be simpler to just change the "When hoisting the last use of a value in the loop, that value no longer needs to be live in the loop" check?  We could check if the value is trivially rematerializable; if it is, we're not really helping register pressure by hoisting.



================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.h:318
+  /// Hoist cheap instructions based on register pressure in Machine LICM.
+  bool shouldHoistCheapInstructions() const override { return true; }
+
----------------
I'm not really happy about adding target-specific heuristics to MachineLICM.  Each target has its own cost model to some extent; we might want to use different rules for specific instructions, or maybe specific register files if they're particularly tiny.  But I'd like to avoid knobs that universally change the way the algorithm works.  If the core algorithm changes depending on the target, that makes it much harder to understand the the way the code is supposed to work, or make any changes in the future, or implement the hook appropriately.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82709





More information about the llvm-commits mailing list