From 4ab32e0db95b14e7d316a2a965a134ae992b8578 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Tue, 30 Aug 2016 02:44:14 +0300 Subject: [PATCH] GH #49: Run GVN again after InstCombine. --- lib/Transforms/IPO/PassManagerBuilder.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Transforms/IPO/PassManagerBuilder.cpp b/lib/Transforms/IPO/PassManagerBuilder.cpp index 941efb210d1c..6d0071d4f60a 100644 --- a/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -342,6 +342,8 @@ void PassManagerBuilder::addFunctionSimplificationPasses( // Run instcombine after redundancy elimination to exploit opportunities // opened up by them. addInstructionCombiningPass(MPM); + if (OptLevel > 1) + MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies addExtensionsToPM(EP_Peephole, MPM); MPM.add(createJumpThreadingPass()); // Thread jumps MPM.add(createCorrelatedValuePropagationPass());