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

Mehdi Amini mehdi.amini at apple.com
Wed Feb 11 15:49:10 PST 2015


+  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.

+        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>





More information about the llvm-commits mailing list