[polly] r227057 - [FIX] Independent blocks with intrinsics handling
Johannes Doerfert
doerfert at cs.uni-saarland.de
Sun Jan 25 11:09:49 PST 2015
Author: jdoerfert
Date: Sun Jan 25 13:09:49 2015
New Revision: 227057
URL: http://llvm.org/viewvc/llvm-project?rev=227057&view=rev
Log:
[FIX] Independent blocks with intrinsics handling
Also an old option was removed from some new test cases
Modified:
polly/trunk/lib/Transform/IndependentBlocks.cpp
polly/trunk/test/Isl/CodeGen/intrinsics_lifetime.ll
polly/trunk/test/Isl/CodeGen/intrinsics_misc.ll
polly/trunk/test/ScopDetect/intrinsics_2.ll
polly/trunk/test/ScopDetect/intrinsics_3.ll
Modified: polly/trunk/lib/Transform/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndependentBlocks.cpp?rev=227057&r1=227056&r2=227057&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/Transform/IndependentBlocks.cpp Sun Jan 25 13:09:49 2015
@@ -21,6 +21,7 @@
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
@@ -129,6 +130,7 @@ struct IndependentBlocks : public Functi
// Split the exit block to hold load instructions.
bool splitExitBlock(Region *R);
+ bool isIgnoredIntrinsic(Instruction *Inst);
bool onlyUsedInRegion(Instruction *Inst, const Region *R);
bool translateScalarToArray(BasicBlock *BB, const Region *R);
bool translateScalarToArray(Instruction *Inst, const Region *R);
@@ -141,6 +143,30 @@ struct IndependentBlocks : public Functi
};
}
+bool IndependentBlocks::isIgnoredIntrinsic(Instruction *Inst) {
+ if (auto *IT = dyn_cast<IntrinsicInst>(Inst)) {
+ switch (IT->getIntrinsicID()) {
+ // Lifetime markers are supported/ignored.
+ case llvm::Intrinsic::lifetime_start:
+ case llvm::Intrinsic::lifetime_end:
+ // Invariant markers are supported/ignored.
+ case llvm::Intrinsic::invariant_start:
+ case llvm::Intrinsic::invariant_end:
+ // Some misc annotations are supported/ignored.
+ case llvm::Intrinsic::var_annotation:
+ case llvm::Intrinsic::ptr_annotation:
+ case llvm::Intrinsic::annotation:
+ case llvm::Intrinsic::donothing:
+ case llvm::Intrinsic::assume:
+ case llvm::Intrinsic::expect:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
bool IndependentBlocks::isSafeToMove(Instruction *Inst) {
if (Inst->mayReadFromMemory() || Inst->mayWriteToMemory())
return false;
@@ -276,7 +302,7 @@ bool IndependentBlocks::eliminateDeadCod
// Find all trivially dead instructions.
for (BasicBlock *BB : R->blocks())
for (Instruction &Inst : *BB)
- if (isInstructionTriviallyDead(&Inst))
+ if (!isIgnoredIntrinsic(&Inst) && isInstructionTriviallyDead(&Inst))
WorkList.push_back(&Inst);
if (WorkList.empty())
@@ -368,6 +394,8 @@ bool IndependentBlocks::translateScalarT
const Region *R) {
if (canSynthesize(Inst, LI, SE, R) && onlyUsedInRegion(Inst, R))
return false;
+ if (isIgnoredIntrinsic(Inst))
+ return false;
SmallVector<Instruction *, 4> LoadInside, LoadOutside;
for (User *U : Inst->users())
Modified: polly/trunk/test/Isl/CodeGen/intrinsics_lifetime.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/intrinsics_lifetime.ll?rev=227057&r1=227056&r2=227057&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/intrinsics_lifetime.ll (original)
+++ polly/trunk/test/Isl/CodeGen/intrinsics_lifetime.ll Sun Jan 25 13:09:49 2015
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -basicaa -polly-codegen-isl -polly-codegen-scev -S < %s | FileCheck %s
+; RUN: opt %loadPolly -basicaa -polly-codegen-isl -S < %s | FileCheck %s
;
; Verify that we remove the lifetime markers from the optimized SCoP.
;
Modified: polly/trunk/test/Isl/CodeGen/intrinsics_misc.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/intrinsics_misc.ll?rev=227057&r1=227056&r2=227057&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/intrinsics_misc.ll (original)
+++ polly/trunk/test/Isl/CodeGen/intrinsics_misc.ll Sun Jan 25 13:09:49 2015
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -basicaa -polly-codegen-isl -polly-codegen-scev -S < %s | FileCheck %s
+; RUN: opt %loadPolly -basicaa -polly-codegen-isl -S < %s | FileCheck %s
;
; Verify that we remove the misc intrinsics from the optimized SCoP.
;
Modified: polly/trunk/test/ScopDetect/intrinsics_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/intrinsics_2.ll?rev=227057&r1=227056&r2=227057&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/intrinsics_2.ll (original)
+++ polly/trunk/test/ScopDetect/intrinsics_2.ll Sun Jan 25 13:09:49 2015
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -basicaa -polly-detect -polly-codegen-scev -analyze < %s | FileCheck %s
+; RUN: opt %loadPolly -basicaa -polly-detect -analyze < %s | FileCheck %s
;
; Verify that we allow the lifetime markers for the tmp array.
;
Modified: polly/trunk/test/ScopDetect/intrinsics_3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/intrinsics_3.ll?rev=227057&r1=227056&r2=227057&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/intrinsics_3.ll (original)
+++ polly/trunk/test/ScopDetect/intrinsics_3.ll Sun Jan 25 13:09:49 2015
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -basicaa -polly-detect -polly-codegen-scev -analyze < %s | FileCheck %s
+; RUN: opt %loadPolly -basicaa -polly-detect -analyze < %s | FileCheck %s
;
; Verify that we allow the misc intrinsics.
;
More information about the llvm-commits
mailing list