diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2014-09-05 14:04:38 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-09-05 15:33:33 +0800 |
commit | 3fa78a31a9fe1092fc6172077e2d78545d2b2c43 (patch) | |
tree | 1aa253cde64ee0eb6dde1a2c0023a942dfddd6e9 | |
parent | 374e8c928de483aa83f940464ed33bed74e6eaf1 (diff) |
GBE: avoid one optimization pass to generate wide integer.
Integer type wider than 64 bit is hard to handle on Gen.
Let's try to prevent ScalarReplAggregates pass to generate
such type of integer.
v2:
fix compilation error with LLVM 3.3.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
-rw-r--r-- | backend/src/llvm/llvm_to_gen.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp index 758ea482..a7d27474 100644 --- a/backend/src/llvm/llvm_to_gen.cpp +++ b/backend/src/llvm/llvm_to_gen.cpp @@ -76,14 +76,14 @@ namespace gbe BVAR(OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS, false); using namespace llvm; - void runFuntionPass(Module &mod, TargetLibraryInfo *libraryInfo) + void runFuntionPass(Module &mod, TargetLibraryInfo *libraryInfo, DataLayout &DL) { FunctionPassManager FPM(&mod); #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5 - FPM.add(new DataLayoutPass(&mod)); + FPM.add(new DataLayoutPass(DL)); #else - FPM.add(new DataLayout(&mod)); + FPM.add(&DL); #endif #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >=5 @@ -107,14 +107,14 @@ namespace gbe FPM.doFinalization(); } - void runModulePass(Module &mod, TargetLibraryInfo *libraryInfo, int optLevel) + void runModulePass(Module &mod, TargetLibraryInfo *libraryInfo, DataLayout &DL, int optLevel) { llvm::PassManager MPM; #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5 - MPM.add(new DataLayoutPass(&mod)); + MPM.add(new DataLayoutPass(DL)); #else - MPM.add(new DataLayout(&mod)); + MPM.add(&DL); #endif MPM.add(new TargetLibraryInfo(*libraryInfo)); MPM.add(createTypeBasedAliasAnalysisPass()); @@ -192,19 +192,20 @@ namespace gbe if (M.get() == 0) return false; } Module &mod = (module!=NULL)?*(llvm::Module*)module:*M.get(); + DataLayout DL(&mod); Triple TargetTriple(mod.getTargetTriple()); TargetLibraryInfo *libraryInfo = new TargetLibraryInfo(TargetTriple); libraryInfo->disableAllFunctions(); - runFuntionPass(mod, libraryInfo); - runModulePass(mod, libraryInfo, optLevel); + runFuntionPass(mod, libraryInfo, DL); + runModulePass(mod, libraryInfo, DL, optLevel); llvm::PassManager passes; #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5 - passes.add(new DataLayoutPass(&mod)); + passes.add(new DataLayoutPass(DL)); #else - passes.add(new DataLayout(&mod)); + passes.add(&DL); #endif // Print the code before further optimizations if (OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS) @@ -215,7 +216,7 @@ namespace gbe #endif passes.add(createIntrinsicLoweringPass()); passes.add(createFunctionInliningPass(200000)); - passes.add(createScalarReplAggregatesPass()); // Break up allocas + passes.add(createScalarReplAggregatesPass(64, true, -1, -1, 64)); passes.add(createLoadStoreOptimizationPass()); passes.add(createRemoveGEPPass(unit)); passes.add(createConstantPropagationPass()); |