[Beignet] [PATCH] GBE: avoid one optimization pass to generate wide integer.
Yang, Rong R
rong.r.yang at intel.com
Fri Sep 5 01:14:05 PDT 2014
Compiler error in llvm3.3:
/home/champson/source/beignet/backend/src/llvm/llvm_to_gen.cpp: In function 'void gbe::runFuntionPass(llvm::Module&, llvm::TargetLibraryInfo*, const llvm::DataLayout&)':
/home/champson/source/beignet/backend/src/llvm/llvm_to_gen.cpp:86:16: error: invalid conversion from 'const llvm::Pass*' to 'llvm::Pass*' [-fpermissive]
FPM.add(&DL);
void runFuntionPass(Module &mod, TargetLibraryInfo *libraryInfo, const DataLayout &DL) should be
void runFuntionPass(Module &mod, TargetLibraryInfo *libraryInfo, DataLayout &DL)
and
void runModulePass(Module &mod, TargetLibraryInfo *libraryInfo, const DataLayout &DL, int optLevel) should be
void runModulePass(Module &mod, TargetLibraryInfo *libraryInfo, DataLayout &DL, int optLevel)
Others LGTM.
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Zhigang Gong
> Sent: Friday, September 05, 2014 2:50 PM
> To: beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: [Beignet] [PATCH] 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.
>
> 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
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list