[PATCH] SelectionDAG: fold (fp_to_u/sint (u/sint_to_fp val)) when possible

Eric Christopher echristo at gmail.com
Wed Feb 11 15:54:13 PST 2015


On Wed Feb 11 2015 at 3:52:06 PM Mehdi Amini <mehdi.amini at apple.com> wrote:

> +  Instruction *OpI = cast<Instruction>(FI.getOperand(0));
> +  if (!isa<UIToFPInst>(OpI) && !isa<SIToFPInst>(OpI))
> +    return nullptr;
>
> You are using isa<>() on the result of an unsafe cast, it makes me nervous
> and I don’t know if it is safe this way.
>
>
if (Instruction *Op1 = dyn_cast<Instruction>(FI.getOperand(0)) &&
    ...)

should work?

-eric


> +        return new SExtInst(OpI->getOperand(0), FITy);
> +      else
>
> You didn’t fix this.
>
>> Mehdi
>
>
> > On Feb 11, 2015, at 3:39 PM, Fiona Glaser <fglaser at apple.com> wrote:
> >
> > Patch updated based on comments.
> >
> > Fiona
> >
> > <floatcvtfold.diff>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150211/410d1230/attachment.html>


More information about the llvm-commits mailing list