aboutsummaryrefslogtreecommitdiff
path: root/tools/gccld/GenerateCode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gccld/GenerateCode.cpp')
-rw-r--r--tools/gccld/GenerateCode.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp
index 3277c48e22..982a7e3cd4 100644
--- a/tools/gccld/GenerateCode.cpp
+++ b/tools/gccld/GenerateCode.cpp
@@ -111,6 +111,11 @@ GenerateBytecode (Module *M, bool Strip, bool Internalize, std::ostream *Out) {
if (!DisableInline)
addPass(Passes, createFunctionInliningPass()); // Inline small functions
+ // The IPO passes may leave cruft around. Clean up after them.
+ addPass(Passes, createInstructionCombiningPass());
+
+ addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
+
// Run a few AA driven optimizations here and now, to cleanup the code.
// Eventually we should put an IP AA in place here.
@@ -118,8 +123,7 @@ GenerateBytecode (Module *M, bool Strip, bool Internalize, std::ostream *Out) {
addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs
addPass(Passes, createGCSEPass()); // Remove common subexprs
- // The FuncResolve pass may leave cruft around if functions were prototyped
- // differently than they were defined. Remove this cruft.
+ // Cleanup and simplify the code after the scalar optimizations.
addPass(Passes, createInstructionCombiningPass());
// Delete basic blocks, which optimization passes may have killed...