summaryrefslogtreecommitdiff
path: root/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-07-06 23:24:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-07-06 23:24:39 +0000
commitd2c5eb864fc80665ca57038793f2f4a296a87eb3 (patch)
treea763abc4fa6c3d9c8fdd4e6efedbc3baabad2b31 /lib/CodeGen/IfConversion.cpp
parentc419bd3396cc035942b219efae30dd2890ae430f (diff)
downloadllvm-d2c5eb864fc80665ca57038793f2f4a296a87eb3.tar.gz
llvm-d2c5eb864fc80665ca57038793f2f4a296a87eb3.tar.bz2
llvm-d2c5eb864fc80665ca57038793f2f4a296a87eb3.tar.xz
Teach if-conversion about instructions that were already predicated, e.g. conditional move.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37964 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r--lib/CodeGen/IfConversion.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 64328d6e04..b05f6630ea 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -529,6 +529,7 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
if (BBI.IsDone)
return;
+ bool AlreadyPredicated = BBI.Predicate.size() > 0;
// First analyze the end of BB branches.
BBI.TrueBB = BBI.FalseBB = NULL;
BBI.BrCond.clear();
@@ -558,8 +559,18 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
bool isCondBr = BBI.IsBrAnalyzable &&
(TID->Flags & M_BRANCH_FLAG) != 0 && (TID->Flags & M_BARRIER_FLAG) == 0;
- if (!isPredicated && !isCondBr)
- BBI.NonPredSize++;
+ if (!isCondBr) {
+ if (!isPredicated)
+ BBI.NonPredSize++;
+ else if (!AlreadyPredicated) {
+ // FIXME: This instruction is already predicated before the
+ // if-conversion pass. It's probably something like a conditional move.
+ // Mark this block unpredicable for now.
+ BBI.IsUnpredicable = true;
+ return;
+ }
+
+ }
if (BBI.ClobbersPred && !isPredicated) {
// Predicate modification instruction should end the block (except for
@@ -572,7 +583,7 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
}
// Predicate may have been modified, the subsequent (currently)
- // unpredocated instructions cannot be correctly predicated.
+ // unpredicated instructions cannot be correctly predicated.
BBI.IsUnpredicable = true;
return;
}