[llvm-commits] [llvm] r106201 - /llvm/trunk/utils/TableGen/Record.cpp

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Wed Jun 16 18:50:40 PDT 2010


Author: bruno
Date: Wed Jun 16 20:50:39 2010
New Revision: 106201

URL: http://llvm.org/viewvc/llvm-project?rev=106201&view=rev
Log:
Fix the handling of !if result, avoiding null results for non 'int'.

Modified:
    llvm/trunk/utils/TableGen/Record.cpp

Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=106201&r1=106200&r2=106201&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Wed Jun 16 20:50:39 2010
@@ -981,8 +981,9 @@
   }
 
   case IF: {
-    IntInit *LHSi =
-      dynamic_cast<IntInit*>(LHS->convertInitializerTo(new IntRecTy()));
+    IntInit *LHSi = dynamic_cast<IntInit*>(LHS);
+    if (Init *I = LHS->convertInitializerTo(new IntRecTy()))
+      LHSi = dynamic_cast<IntInit*>(I);
     if (LHSi) {
       if (LHSi->getValue()) {
         return MHS;
@@ -1001,8 +1002,9 @@
   Init *lhs = LHS->resolveReferences(R, RV);
 
   if (Opc == IF && lhs != LHS) {
-    IntInit *Value =
-      dynamic_cast<IntInit*>(LHS->convertInitializerTo(new IntRecTy()));
+    IntInit *Value = dynamic_cast<IntInit*>(lhs);
+    if (Init *I = lhs->convertInitializerTo(new IntRecTy()))
+      Value = dynamic_cast<IntInit*>(I);
     if (Value != 0) {
       // Short-circuit
       if (Value->getValue()) {





More information about the llvm-commits mailing list