[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 7 14:50:12 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.11 -> 1.12
---
Log message:

Fold conditional branches on constants away.


---
Diffs of the changes:  (+6 -0)

Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.11 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.12
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.11	Fri Jan  7 16:44:09 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Fri Jan  7 16:49:57 2005
@@ -727,6 +727,12 @@
     }
 
     break;
+  case ISD::BRCOND:
+    if (N2C)
+      if (N2C->getValue()) // Unconditional branch
+        return getNode(ISD::BR, MVT::Other, N1, N3);
+      else
+        return N1;         // Never-taken branch
   }
 
   SDNode *N = new SDNode(Opcode, N1, N2, N3);






More information about the llvm-commits mailing list