summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopRotation.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-02-12 21:01:33 +0000
committerJustin Lebar <jlebar@google.com>2016-02-12 21:01:33 +0000
commitdf04d2a1f1b9621fc75a28a45c4193b03da59bf8 (patch)
tree6ab2798b7358e1a0705792c34d5e7890ccbe74c4 /llvm/lib/Transforms/Scalar/LoopRotation.cpp
parent144c5a6c154b3d639709c59892a41139aadc5032 (diff)
downloadbcm5719-llvm-df04d2a1f1b9621fc75a28a45c4193b03da59bf8.tar.gz
bcm5719-llvm-df04d2a1f1b9621fc75a28a45c4193b03da59bf8.zip
[LoopRotate] Don't perform loop rotation if the loop header calls a convergent function.
Summary: Calls to convergent functions can be duplicated, but only if the duplicates are not control-flow dependent on any additional values. Loop rotation doesn't meet the bar. Reviewers: jingyue Subscribers: mzolotukhin, llvm-commits, arsenm, joker.eph, resistor, tra, hfinkel, broune Differential Revision: http://reviews.llvm.org/D17127 llvm-svn: 260729
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopRotation.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
index 5e6c2da08cc..14621e51b60 100644
--- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
@@ -165,6 +165,11 @@ static bool rotateLoop(Loop *L, unsigned MaxHeaderSize, LoopInfo *LI,
<< " instructions: "; L->dump());
return false;
}
+ if (Metrics.convergent) {
+ DEBUG(dbgs() << "LoopRotation: NOT rotating - contains convergent "
+ "instructions: "; L->dump());
+ return false;
+ }
if (Metrics.NumInsts > MaxHeaderSize)
return false;
}
OpenPOWER on IntegriCloud