[PATCH] D114361: [MachineCSE] Add an option to enable global CSE

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 05:03:55 PST 2021


lkail added a comment.

`Global` is not a good name here. MachineCSE is working on the whole function, which is `global` in compiler's terminology, by walking through the DominatorTree.



================
Comment at: llvm/lib/CodeGen/MachineCSE.cpp:462
+  // Enable global CSE when optimizing for size.
+  if (!EnableGlobalCSE && !MI->getMF()->getFunction().hasOptSize() &&
+      TII->isAsCheapAsAMove(*MI)) {
----------------
Why only apply to this heuristics? Since your intention is reducing size, why not always consider profitable if `hasOptSize`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114361



More information about the llvm-commits mailing list