Page MenuHomePhabricator

[InstCombine] Rewrite the binary op shrinking in visitFPTrunc to avoid creating overly small ConstantFPs that we'll just need to extend again.

Authored by craig.topper on Mar 2 2018, 11:45 AM.



Instead of returning the smaller FP constant we now return the minimal Type the constant can fit into. We also return the Type of the input to any fp extends. The legality checks are then done on just the size of these Types. If we find something profitable we then emit FPTruncs in front of the smaller binop and assume those FPTruncs will be constant folded or combined with any ConstantFPs or fpextends.

Diff Detail


Event Timeline

craig.topper created this revision.Mar 2 2018, 11:45 AM
scanon accepted this revision.Mar 2 2018, 12:04 PM

Works for me.

This revision is now accepted and ready to land.Mar 2 2018, 12:04 PM
This revision was automatically updated to reflect the committed changes.