[InstCombine] Rewrite the binary op shrinking in visitFPTrunc to avoid creating overl...
authorCraig Topper <craig.topper@intel.com>
Fri, 2 Mar 2018 21:25:18 +0000 (21:25 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 2 Mar 2018 21:25:18 +0000 (21:25 +0000)
commitc7461e1aad7c7e0a857ad5356c32526a71f241b6
tree6250fc06a3707d7c6ffd3e7594c5d908dc76ce62
parent1785e244eb132b0cd46de81c06401d8b73f32748
[InstCombine] Rewrite the binary op shrinking in visitFPTrunc to avoid creating overly small ConstantFPs that we'll just need to extend again.

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.

Differential Revision: https://reviews.llvm.org/D44038

llvm-svn: 326617
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp