summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/Record.cpp
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
commit7f4235d1ba592870703d280c6ae85d64ed0bba7c (patch)
tree0835df7c1b45036f52c824936eccf2c5524a3b41 /llvm/utils/TableGen/Record.cpp
parent6e758c97fd1342df66ba960333dc73fd320028df (diff)
downloadbcm5719-llvm-7f4235d1ba592870703d280c6ae85d64ed0bba7c.tar.gz
bcm5719-llvm-7f4235d1ba592870703d280c6ae85d64ed0bba7c.zip
Fix the handling of !if result, avoiding null results for non 'int'.
llvm-svn: 106201
Diffstat (limited to 'llvm/utils/TableGen/Record.cpp')
-rw-r--r--llvm/utils/TableGen/Record.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp
index 53a4abdaf2b..f0147d328b8 100644
--- a/llvm/utils/TableGen/Record.cpp
+++ b/llvm/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()) {
OpenPOWER on IntegriCloud