summaryrefslogtreecommitdiff
path: root/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-06-14 23:13:19 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-06-14 23:13:19 +0000
commite37e24331c6fb3e83d5fb0c9ce31be619359a52a (patch)
treeb29561e0b8852d536a9cc5a258b699a1c9b490da /lib/CodeGen/IfConversion.cpp
parent51eaa86758338d5935c0eff0469c418b1256aba7 (diff)
downloadllvm-e37e24331c6fb3e83d5fb0c9ce31be619359a52a.tar.gz
llvm-e37e24331c6fb3e83d5fb0c9ce31be619359a52a.tar.bz2
llvm-e37e24331c6fb3e83d5fb0c9ce31be619359a52a.tar.xz
If BB is predicated, invalidate its predecessor(s) which would if-convert it. It needs to be re-analyzed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r--lib/CodeGen/IfConversion.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 87340d3700..b1aa31a28e 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -656,15 +656,19 @@ static bool canFallThroughTo(MachineBasicBlock *BB, MachineBasicBlock *ToBB) {
}
/// ReTryPreds - Invalidate predecessor BB info so it would be re-analyzed
-/// to determine if it can be if-converted.
+/// to determine if it can be if-converted. If predecessor is already
+/// enqueud, dequeue it!
void IfConverter::ReTryPreds(MachineBasicBlock *BB) {
for (MachineBasicBlock::pred_iterator PI = BB->pred_begin(),
E = BB->pred_end(); PI != E; ++PI) {
BBInfo &PBBI = BBAnalysis[(*PI)->getNumber()];
- if (!PBBI.IsDone && PBBI.Kind == ICNotClassfied) {
+ if (PBBI.IsDone)
+ continue;
+ if (PBBI.Kind == ICNotClassfied) {
assert(!PBBI.IsEnqueued && "Unexpected");
PBBI.IsAnalyzed = false;
- }
+ } else if (PBBI.IsEnqueued && PBBI.BB != BB)
+ PBBI.IsEnqueued = false;
}
}