[PATCH] Fix interference caused by fmul 2, x -> fadd x, x combine
hfinkel at anl.gov
hfinkel at anl.gov
Tue Sep 2 09:53:18 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
----------------
BV can only truncate integer operands, not FP ones. If you want to check that the types agree, please make it an assert.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6863
@@ +6862,3 @@
+
+ if (DAG.getTarget().Options.UnsafeFPMath) {
+ // If allowed, fold (fmul (fmul x, c1), c2) -> (fmul x, (fmul c1, c2))
----------------
As a general note, it looks like we don't currently preserve FastMathFlags at the SDAG level. We've fixed that for NSW/NUW, and we should probably fix that for FP ops too (obviously this is a separate issue from what you're addressing here).
================
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)) {
----------------
Okay, but what happens next? Wouldn't we get (fmul x, (fadd c, c))?
http://reviews.llvm.org/D4678
More information about the llvm-commits
mailing list