[llvm-commits] [llvm] r37964 - /llvm/trunk/lib/CodeGen/IfConversion.cpp

Evan Cheng evan.cheng at apple.com
Fri Jul 6 16:24:39 PDT 2007


Author: evancheng
Date: Fri Jul  6 18:24:39 2007
New Revision: 37964

URL: http://llvm.org/viewvc/llvm-project?rev=37964&view=rev
Log:
Teach if-conversion about instructions that were already predicated, e.g. conditional move.

Modified:
    llvm/trunk/lib/CodeGen/IfConversion.cpp

Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=37964&r1=37963&r2=37964&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Fri Jul  6 18:24:39 2007
@@ -529,6 +529,7 @@
   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 @@
     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 @@
       }
 
       // Predicate may have been modified, the subsequent (currently)
-      // unpredocated instructions cannot be correctly predicated.
+      // unpredicated instructions cannot be correctly predicated.
       BBI.IsUnpredicable = true;
       return;
     }





More information about the llvm-commits mailing list