[Beignet] [PATCH] GBE: avoid one optimization pass to generate wide integer.
Zhigang Gong
zhigang.gong at intel.com
Thu Sep 4 23:49:52 PDT 2014
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.
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
backend/src/llvm/llvm_to_gen.cpp | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 758ea48..21aa4c6 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, const 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, const 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());
--
1.8.3.2
More information about the Beignet
mailing list