summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
diff options
context:
space:
mode:
authorHaicheng Wu <haicheng@codeaurora.org>2016-08-17 22:42:58 +0000
committerHaicheng Wu <haicheng@codeaurora.org>2016-08-17 22:42:58 +0000
commite787763275d67fbc2a006f8c41e6e40d05de6150 (patch)
treea7a1ea7dbfbd26a5d097a50cb662e54a54e84c36 /llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
parent5c0c063ad56aafd8e186d87bb2d0ce5651202256 (diff)
downloadbcm5719-llvm-e787763275d67fbc2a006f8c41e6e40d05de6150.tar.gz
bcm5719-llvm-e787763275d67fbc2a006f8c41e6e40d05de6150.zip
[LoopUnroll] Move a simple check earlier. NFC.
Move the check of CallInst earlier to skip expensive recursive operations. Differential Revision: https://reviews.llvm.org/D23611 llvm-svn: 278998
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index 0a45732a892..f53ac86b14c 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -431,16 +431,16 @@ analyzeLoopUnrollCost(const Loop *L, unsigned TripCount, DominatorTree &DT,
if (IsFree)
continue;
- // If the instruction might have a side-effect recursively account for
- // the cost of it and all the instructions leading up to it.
- if (I.mayHaveSideEffects())
- AddCostRecursively(I, Iteration);
-
// Can't properly model a cost of a call.
// FIXME: With a proper cost model we should be able to do it.
if(isa<CallInst>(&I))
return None;
+ // If the instruction might have a side-effect recursively account for
+ // the cost of it and all the instructions leading up to it.
+ if (I.mayHaveSideEffects())
+ AddCostRecursively(I, Iteration);
+
// If unrolled body turns out to be too big, bail out.
if (UnrolledCost > MaxUnrolledLoopSize) {
DEBUG(dbgs() << " Exceeded threshold.. exiting.\n"
OpenPOWER on IntegriCloud