diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/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)