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

Mehdi Amini mehdi.amini at apple.com
Mon Feb 16 11:47:25 PST 2015


Functionally LGTM.

Minor comments:

The commit about DAG contains a change that I think you intended to be part of the InstCombine commit.

Also:

+  if (N0.getOpcode() == ISD::UINT_TO_FP || N0.getOpcode() == ISD::SINT_TO_FP) {
…
…
…
+  }
+  return SDValue();

I think it is a case where the coding standard prefers Early Exit (http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code )

if (N0.getOpcode() != ISD::UINT_TO_FP && N0.getOpcode() != ISD::SINT_TO_FP)
  return SDValue(); 

(I think it is what you did in InstCombine).


Thanks,

Mehdi




> On Feb 16, 2015, at 11:10 AM, Fiona Glaser <fglaser at apple.com> wrote:
> 
> Here’s the latest version of my patch. Are there any further issues here, or is the DAG combine okay?
> 
> Fiona
> 
> <floatcvtfold.diff>





More information about the llvm-commits mailing list