summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2019-07-31 09:27:54 +0000
committerFlorian Hahn <flo@fhahn.com>2019-07-31 09:27:54 +0000
commit189efe295b6e843c53c172e9f26436f9e8434d21 (patch)
treeb4eb96e792b6168c3edc4191a5d02b4464f170a9 /llvm/lib/Analysis
parentf87a9626f1df7083c30222693188401d3321f7b0 (diff)
downloadbcm5719-llvm-189efe295b6e843c53c172e9f26436f9e8434d21.tar.gz
bcm5719-llvm-189efe295b6e843c53c172e9f26436f9e8434d21.zip
Recommit "[GVN] Preserve loop related analysis/canonical forms."
This fixes some pipeline tests. This reverts commit d0b6f42936bfb6d56d325c732ae79400c9c6016a. llvm-svn: 367401
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/CFG.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/CFG.cpp b/llvm/lib/Analysis/CFG.cpp
index 18b83d6838c..8215b4ecbb0 100644
--- a/llvm/lib/Analysis/CFG.cpp
+++ b/llvm/lib/Analysis/CFG.cpp
@@ -87,11 +87,18 @@ unsigned llvm::GetSuccessorNumber(const BasicBlock *BB,
/// with multiple predecessors.
bool llvm::isCriticalEdge(const Instruction *TI, unsigned SuccNum,
bool AllowIdenticalEdges) {
- assert(TI->isTerminator() && "Must be a terminator to have successors!");
assert(SuccNum < TI->getNumSuccessors() && "Illegal edge specification!");
+ return isCriticalEdge(TI, TI->getSuccessor(SuccNum), AllowIdenticalEdges);
+}
+
+bool llvm::isCriticalEdge(const Instruction *TI, const BasicBlock *Dest,
+ bool AllowIdenticalEdges) {
+ assert(TI->isTerminator() && "Must be a terminator to have successors!");
if (TI->getNumSuccessors() == 1) return false;
- const BasicBlock *Dest = TI->getSuccessor(SuccNum);
+ assert(find(predecessors(Dest), TI->getParent()) != pred_end(Dest) &&
+ "No edge between TI's block and Dest.");
+
const_pred_iterator I = pred_begin(Dest), E = pred_end(Dest);
// If there is more than one predecessor, this is a critical edge...
OpenPOWER on IntegriCloud