summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChen Zheng <czhengsz@cn.ibm.com>2019-06-26 09:12:52 +0000
committerChen Zheng <czhengsz@cn.ibm.com>2019-06-26 09:12:52 +0000
commit46ce9e4fff45e9f744d8424f00386d650975fd31 (patch)
treeaaa8214c07e764210739d7312fb784092c9eb3f2 /llvm/lib/Analysis
parent0a43d1fa719983a6f1ff0e9c15bc77beeea550c3 (diff)
downloadbcm5719-llvm-46ce9e4fff45e9f744d8424f00386d650975fd31.tar.gz
bcm5719-llvm-46ce9e4fff45e9f744d8424f00386d650975fd31.zip
[HardwareLoops] NFC - move loop with irreducible control flow checking logic to isHardwareLoopProfitable()
llvm-svn: 364397
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/TargetTransformInfo.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 8f729dbfb73..5fde3443457 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -18,6 +18,8 @@
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Analysis/CFG.h"
+#include "llvm/Analysis/LoopIterator.h"
#include <utility>
using namespace llvm;
@@ -216,8 +218,14 @@ bool TargetTransformInfo::isLoweredToCall(const Function *F) const {
}
bool TargetTransformInfo::isHardwareLoopProfitable(
- Loop *L, ScalarEvolution &SE, AssumptionCache &AC,
+ Loop *L, LoopInfo &LI, ScalarEvolution &SE, AssumptionCache &AC,
TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const {
+ // If the loop has irreducible control flow, it can not be converted to
+ // Hardware loop.
+ LoopBlocksRPO RPOT(L);
+ RPOT.perform(&LI);
+ if (containsIrreducibleCFG<const BasicBlock *>(RPOT, LI))
+ return false;
return TTIImpl->isHardwareLoopProfitable(L, SE, AC, LibInfo, HWLoopInfo);
}
OpenPOWER on IntegriCloud