summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorWeiming Zhao <weimingz@codeaurora.org>2015-09-28 17:03:23 +0000
committerWeiming Zhao <weimingz@codeaurora.org>2015-09-28 17:03:23 +0000
commit310770a90fe20783ef7798c98b6e556eb3dd3040 (patch)
tree3529a7abed934d454235ffcf2b055e6e1b6f97e4 /llvm/lib/Transforms
parent95e59aaa54a121aa31d7499c856f09df04c969d2 (diff)
downloadbcm5719-llvm-310770a90fe20783ef7798c98b6e556eb3dd3040.tar.gz
bcm5719-llvm-310770a90fe20783ef7798c98b6e556eb3dd3040.zip
[LoopReroll] Ignore debug intrinsics
Originally, debug intrinsics and annotation intrinsics may prevent the loop to be rerolled, now they are ignored. Differential Revision: http://reviews.llvm.org/D13150 llvm-svn: 248718
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopRerollPass.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
index f007d6855a4..282071364dc 100644
--- a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
@@ -993,6 +993,25 @@ bool LoopReroll::DAGRootTracker::instrDependsOn(Instruction *I,
return false;
}
+static bool isIgnorableInst(const Instruction *I) {
+ if (isa<DbgInfoIntrinsic>(I))
+ return true;
+ const IntrinsicInst* II = dyn_cast<IntrinsicInst>(I);
+ if (!II)
+ return false;
+ switch (II->getIntrinsicID()) {
+ default:
+ return false;
+ case llvm::Intrinsic::annotation:
+ case Intrinsic::ptr_annotation:
+ case Intrinsic::var_annotation:
+ // TODO: the following intrinsics may also be whitelisted:
+ // lifetime_start, lifetime_end, invariant_start, invariant_end
+ return true;
+ }
+ return false;
+}
+
bool LoopReroll::DAGRootTracker::validate(ReductionTracker &Reductions) {
// We now need to check for equivalence of the use graph of each root with
// that of the primary induction variable (excluding the roots). Our goal
@@ -1026,7 +1045,7 @@ bool LoopReroll::DAGRootTracker::validate(ReductionTracker &Reductions) {
// Make sure all instructions in the loop are in one and only one
// set.
for (auto &KV : Uses) {
- if (KV.second.count() != 1) {
+ if (KV.second.count() != 1 && !isIgnorableInst(KV.first)) {
DEBUG(dbgs() << "LRR: Aborting - instruction is not used in 1 iteration: "
<< *KV.first << " (#uses=" << KV.second.count() << ")\n");
return false;
OpenPOWER on IntegriCloud