aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <sunfish@mozilla.com>2014-02-25 18:53:48 -0800
committerDan Gohman <sunfish@mozilla.com>2014-02-25 19:09:46 -0800
commite2fd38dcfcfb6e7fc3eb6e37e911e69f9dd0bbe8 (patch)
tree1b0a5e884d48ffee586b43619e11f8f7032afa9e
parentc69b67ab6dcb00a40d12dc35df7fe2c682c6c36a (diff)
Fix handling of ConstantExpr Selects.
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index a0c199e7db..5074378efb 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -1507,10 +1507,9 @@ void JSWriter::generateExpression(const User *I, raw_string_ostream& Code) {
break;
}
case Instruction::Select: {
- const SelectInst* SI = cast<SelectInst>(I);
- Code << getAssignIfNeeded(I) << getValueAsStr(SI->getCondition()) << " ? " <<
- getValueAsStr(SI->getTrueValue()) << " : " <<
- getValueAsStr(SI->getFalseValue());
+ Code << getAssignIfNeeded(I) << getValueAsStr(I->getOperand(0)) << " ? " <<
+ getValueAsStr(I->getOperand(1)) << " : " <<
+ getValueAsStr(I->getOperand(2));
break;
}
case Instruction::AtomicCmpXchg: {