[llvm] r242895 - [GMR] Add a flag to enable GlobalsModRef in the normal compilation

Chandler Carruth chandlerc at gmail.com
Wed Jul 22 04:57:28 PDT 2015

Author: chandlerc
Date: Wed Jul 22 06:57:28 2015
New Revision: 242895

URL: http://llvm.org/viewvc/llvm-project?rev=242895&view=rev
[GMR] Add a flag to enable GlobalsModRef in the normal compilation

Even before I started improving its runtime, it was already crazy fast
once the call graph exists, and if we can get it to be conservatively
correct, will still likely catch a lot of interesting and useful cases.
So it may well be useful to enable by default.

But more importantly for me, this should make it easier for me to test
that changes aren't breaking it in fundamental ways by enabling it for
normal builds.


Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=242895&r1=242894&r2=242895&view=diff
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Wed Jul 22 06:57:28 2015
@@ -89,6 +89,11 @@ static cl::opt<bool> EnableLoopDistribut
     "enable-loop-distribute", cl::init(false), cl::Hidden,
     cl::desc("Enable the new, experimental LoopDistribution Pass"));
+static cl::opt<bool> EnableNonLTOGlobalsModRef(
+    "enable-non-lto-gmr", cl::init(false), cl::Hidden,
+    cl::desc(
+        "Enable the GlobalsModRef AliasAnalysis outside of the LTO pipeline."));
 PassManagerBuilder::PassManagerBuilder() {
     OptLevel = 2;
     SizeLevel = 0;
@@ -213,6 +218,12 @@ void PassManagerBuilder::populateModuleP
     MPM.add(createCFGSimplificationPass());   // Clean up after IPCP & DAE
+  if (EnableNonLTOGlobalsModRef)
+    // We add a module alias analysis pass here. In part due to bugs in the
+    // analysis infrastructure this "works" in that the analysis stays alive
+    // for the entire SCC pass run below.
+    MPM.add(createGlobalsModRefPass());
   // Start of CallGraph SCC passes.
   if (!DisableUnitAtATime)
     MPM.add(createPruneEHPass());             // Remove dead EH info

More information about the llvm-commits mailing list