[Beignet] [PATCH] Backend:LLVM 3.8 release support
Pan Xiuli
xiuli.pan at intel.com
Wed Jan 20 22:51:41 PST 2016
Add more support for relaese 3.8
Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
backend/src/backend/gen_program.cpp | 2 +-
backend/src/backend/program.cpp | 2 +-
backend/src/llvm/ExpandConstantExpr.cpp | 2 +-
backend/src/llvm/llvm_to_gen.cpp | 4 ++++
backend/src/llvm/llvm_unroll.cpp | 5 +++++
5 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
index 9f82702..48c66ed 100644
--- a/backend/src/backend/gen_program.cpp
+++ b/backend/src/backend/gen_program.cpp
@@ -426,7 +426,7 @@ namespace gbe {
using namespace gbe;
char* errMsg;
if(((GenProgram*)dst_program)->module == NULL){
- ((GenProgram*)dst_program)->module = llvm::CloneModule((llvm::Module*)((GenProgram*)src_program)->module);
+ ((GenProgram*)dst_program)->module = llvm::CloneModule((llvm::Module*)((GenProgram*)src_program)->module).release();
errSize = 0;
}else{
llvm::Module* src = (llvm::Module*)((GenProgram*)src_program)->module;
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 36af95f..df25147 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -119,7 +119,7 @@ namespace gbe {
ir::Unit *unit = new ir::Unit(ir::POINTER_64_BITS);
llvm::Module * cloned_module = NULL;
if(module){
- cloned_module = llvm::CloneModule((llvm::Module*)module);
+ cloned_module = llvm::CloneModule((llvm::Module*)module).release();
}
if (llvmToGen(*unit, fileName, module, optLevel, OCL_STRICT_CONFORMANCE) == false) {
if (fileName)
diff --git a/backend/src/llvm/ExpandConstantExpr.cpp b/backend/src/llvm/ExpandConstantExpr.cpp
index e9ec3ab..b6b8667 100644
--- a/backend/src/llvm/ExpandConstantExpr.cpp
+++ b/backend/src/llvm/ExpandConstantExpr.cpp
@@ -114,7 +114,7 @@ static Value *expandConstantVector(Instruction *InsertPt, ConstantVector *CV) {
int elemNum = CV->getType()->getNumElements();
Type *IntTy = IntegerType::get(CV->getContext(), 32);
- BasicBlock::iterator InsertPos(InsertPt);
+ BasicBlock::iterator InsertPos(&*InsertPt);
IRBuilder<> IRB(&*InsertPos);
Value *vec = UndefValue::get(CV->getType());
for (int i = 0; i < elemNum; i++) {
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index ceaee9b..0b3f0d2 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -140,7 +140,11 @@ namespace gbe
MPM.add(createBarrierNodupPass(false)); // remove noduplicate fnAttr before inlining.
MPM.add(createFunctionInliningPass(20000));
MPM.add(createBarrierNodupPass(true)); // restore noduplicate fnAttr after inlining.
+#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
+ MPM.add(createPostOrderFunctionAttrsPass());
+#else
MPM.add(createFunctionAttrsPass()); // Set readonly/readnone attrs
+#endif
//MPM.add(createScalarReplAggregatesPass(64, true, -1, -1, 64))
if(optLevel > 0)
diff --git a/backend/src/llvm/llvm_unroll.cpp b/backend/src/llvm/llvm_unroll.cpp
index 4cc3481..0f62bdc 100644
--- a/backend/src/llvm/llvm_unroll.cpp
+++ b/backend/src/llvm/llvm_unroll.cpp
@@ -163,6 +163,7 @@ namespace gbe {
Loop *currL = L;
#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
ScalarEvolution *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
+ LoopInfo &loopInfo = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
#else
ScalarEvolution *SE = &getAnalysis<ScalarEvolution>();
#endif
@@ -192,7 +193,11 @@ namespace gbe {
shouldUnroll = false;
setUnrollID(currL, false);
if (currL != L)
+#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
+ loopInfo.markAsRemoved(currL);
+#else
LPM.deleteLoopFromQueue(currL);
+#endif
}
currL = parentL;
currTripCount = parentTripCount;
--
2.5.0
More information about the Beignet
mailing list