llvm.org GIT mirror llvm / 2d42f75
[NewGVN] Add a flag to enable the pass via `-mllvm`. NewGVN can be tested passing `-mllvm -enable-newgvn` to clang. Differential Revision: https://reviews.llvm.org/D28059 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290548 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
2 changed file(s) with 15 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
131131 bool LoopVectorize;
132132 bool RerollLoops;
133133 bool LoadCombine;
134 bool NewGVN;
134135 bool DisableGVNLoadPRE;
135136 bool VerifyInput;
136137 bool VerifyOutput;
7474 cl::Hidden,
7575 cl::desc("Run the load combining pass"));
7676
77 static cl::opt RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden,
78 cl::desc("Run the NewGVN pass"));
79
7780 static cl::opt
7881 RunSLPAfterLoopVectorization("run-slp-after-loop-vectorization",
7982 cl::init(true), cl::Hidden,
161164 LoopVectorize = RunLoopVectorization;
162165 RerollLoops = RunLoopRerolling;
163166 LoadCombine = RunLoadCombine;
167 NewGVN = RunNewGVN;
164168 DisableGVNLoadPRE = false;
165169 VerifyInput = false;
166170 VerifyOutput = false;
327331 if (OptLevel > 1) {
328332 if (EnableMLSM)
329333 MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds
330 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
334 MPM.add(NewGVN ? createNewGVNPass()
335 : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
331336 }
332337 MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset
333338 MPM.add(createSCCPPass()); // Constant prop with SCCP
359364 addInstructionCombiningPass(MPM);
360365 addExtensionsToPM(EP_Peephole, MPM);
361366 if (OptLevel > 1 && UseGVNAfterVectorization)
362 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
367 MPM.add(NewGVN
368 ? createNewGVNPass()
369 : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
363370 else
364371 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
365372
604611 addInstructionCombiningPass(MPM);
605612 addExtensionsToPM(EP_Peephole, MPM);
606613 if (OptLevel > 1 && UseGVNAfterVectorization)
607 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
614 MPM.add(NewGVN
615 ? createNewGVNPass()
616 : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
608617 else
609618 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
610619
756765 PM.add(createLICMPass()); // Hoist loop invariants.
757766 if (EnableMLSM)
758767 PM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds.
759 PM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies.
768 PM.add(NewGVN ? createNewGVNPass()
769 : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies.
760770 PM.add(createMemCpyOptPass()); // Remove dead memcpys.
761771
762772 // Nuke dead stores.