]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/patches/patch-12-add-llvm-gvn-option.diff
Merge ^/head r274961 through r276301.
[FreeBSD/FreeBSD.git] / contrib / llvm / patches / patch-12-add-llvm-gvn-option.diff
1 Add an llvm option to enable/disable running the global value numbering
2 optimization pass.  Disabling this pass helps to minimize the size of
3 boot2.
4
5 Introduced here: http://svnweb.freebsd.org/changeset/base/274968
6
7 Index: lib/Transforms/IPO/PassManagerBuilder.cpp
8 ===================================================================
9 --- lib/Transforms/IPO/PassManagerBuilder.cpp
10 +++ lib/Transforms/IPO/PassManagerBuilder.cpp
11 @@ -57,6 +57,10 @@ static cl::opt<bool> RunLoadCombine("combine-loads
12                                      cl::Hidden,
13                                      cl::desc("Run the load combining pass"));
14  
15 +static cl::opt<bool> RunGVN("enable-gvn", cl::init(true),
16 +                            cl::Hidden,
17 +                            cl::desc("Run the global value numbering pass"));
18 +
19  PassManagerBuilder::PassManagerBuilder() {
20      OptLevel = 2;
21      SizeLevel = 0;
22 @@ -210,7 +214,8 @@ void PassManagerBuilder::populateModulePassManager
23  
24    if (OptLevel > 1) {
25      MPM.add(createMergedLoadStoreMotionPass()); // Merge load/stores in diamond
26 -    MPM.add(createGVNPass());                 // Remove redundancies
27 +    if (RunGVN)
28 +      MPM.add(createGVNPass());                 // Remove redundancies
29    }
30    MPM.add(createMemCpyOptPass());             // Remove memcpy / form memset
31    MPM.add(createSCCPPass());                  // Constant prop with SCCP