Yes, but sadly it doesn't work for ConstantExpr selects, just Instruction
selects. It's possible to define interfaces which abstract over the two,
but I figured the code here is still fairly readable.


On Tue, Feb 25, 2014 at 7:20 PM, Alon Zakai <notifications@github.com>wrote:

> In 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;
>
> isn't the former syntax more clear?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/kripken/emscripten-fastcomp/pull/23/files#r10067158>
> .
>