[PATCH] D105131: Change the phase ordering of SROA in the LTO to enable more cse opportunities

Jin Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 09:54:16 PDT 2021


jinlin created this revision.
Herald added subscribers: ormris, hiraditya, inglorion.
jinlin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Change the phase ordering of SROA in the LTO to enable more cse opportunities.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105131

Files:
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp


Index: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -1041,8 +1041,9 @@
 
   // Now that we internalized some globals, see if we can hack on them!
   PM.add(createGlobalOptimizerPass());
-  // Promote any localized global vars.
-  PM.add(createPromoteMemoryToRegisterPass());
+  // Break up allocas
+  PM.add(createSROAPass());
+  PM.add(createEarlyCSEPass());
 
   // Linking modules together can lead to duplicated global constants, only
   // keep one copy of each constant.
@@ -1095,9 +1096,6 @@
   addExtensionsToPM(EP_Peephole, PM);
   PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true));
 
-  // Break up allocas
-  PM.add(createSROAPass());
-
   // LTO provides additional opportunities for tailcall elimination due to
   // link-time inlining, and visibility of nocapture attribute.
   if (OptLevel > 1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105131.355279.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/164c656e/attachment.bin>


More information about the llvm-commits mailing list