From e2fd38dcfcfb6e7fc3eb6e37e911e69f9dd0bbe8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 25 Feb 2014 18:53:48 -0800 Subject: Fix handling of ConstantExpr Selects. --- lib/Target/JSBackend/JSBackend.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') 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(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: { -- cgit v1.2.3-18-g5258