[PATCH] Fix interference caused by fmul 2, x -> fadd x, x combine

Matt Arsenault Matthew.Arsenault at amd.com
Tue Sep 2 11:28:14 PDT 2014

Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:691
@@ +690,3 @@
+    // BuildVectors can truncate their operands. Ignore that case here.
+    // FIXME: We blindly ignore splats which include undef which is overly
hfinkel wrote:
> BV can only truncate integer operands, not FP ones. If you want to check that the types agree, please make it an assert.
This was already added in another patch which also used this. I can fix this separately

Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6875
@@ +6874,3 @@
+    // during an early run of DAGCombiner can prevent folding with fmuls
+    // inserted during lowering.
+    if (N0.getOpcode() == ISD::FADD && N0.getOperand(0) == N0.getOperand(1)) {
hfinkel wrote:
> Okay, but what happens next? Wouldn't we get (fmul x, (fadd c, c))?
The fmul 2.0, c will be constant folded into 2c which is the goal


More information about the llvm-commits mailing list