summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-17 01:50:39 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-17 01:50:39 +0000
commit477bf62048238950338421d1b6bd1ed0a82d35ea (patch)
treecf340a652314ce4128ac9a2ee74a7fe3d10f3643 /utils
parentc73993b67815c96bb270034bdc7b7e8edc16d614 (diff)
downloadllvm-477bf62048238950338421d1b6bd1ed0a82d35ea.tar.gz
llvm-477bf62048238950338421d1b6bd1ed0a82d35ea.tar.bz2
llvm-477bf62048238950338421d1b6bd1ed0a82d35ea.tar.xz
Fix the handling of !if result, avoiding null results for non 'int'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106201 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/Record.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 53a4abdaf2..f0147d328b 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -981,8 +981,9 @@ Init *TernOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) {
}
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 *TernOpInit::resolveReferences(Record &R, const RecordVal *RV) {
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()) {