diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-02-16 19:49:17 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-02-16 19:49:17 +0000 |
commit | adb6f226714dcfae363f51b453c4590b0f42da5e (patch) | |
tree | b47715c7e30550eed4a68f7744f6cd1470887d50 /lib/Transforms/Scalar | |
parent | 7fca2294dad873aa7873e338ec3fcc4db49ea074 (diff) | |
download | external_llvm-adb6f226714dcfae363f51b453c4590b0f42da5e.zip external_llvm-adb6f226714dcfae363f51b453c4590b0f42da5e.tar.gz external_llvm-adb6f226714dcfae363f51b453c4590b0f42da5e.tar.bz2 |
Refactor to share code to find the position of a basic block successor in the
terminator's list of successors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index bf46892..b3a8687 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -2141,14 +2141,7 @@ bool GVN::performPRE(Function &F) { // We can't do PRE safely on a critical edge, so instead we schedule // the edge to be split and perform the PRE the next time we iterate // on the function. - unsigned SuccNum = 0; - for (unsigned i = 0, e = PREPred->getTerminator()->getNumSuccessors(); - i != e; ++i) - if (PREPred->getTerminator()->getSuccessor(i) == CurrentBlock) { - SuccNum = i; - break; - } - + unsigned SuccNum = SuccessorNumber(PREPred, CurrentBlock); if (isCriticalEdge(PREPred->getTerminator(), SuccNum)) { toSplit.push_back(std::make_pair(PREPred->getTerminator(), SuccNum)); continue; |