This patch originated from D46562 and is a proper subset, with some issues addressed for fmul.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/CodeGen/X86/fp-fold.ll | ||
---|---|---|
104 ↗ | (On Diff #150549) | Can remove the TODO now. |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
724–726 ↗ | (On Diff #150549) | Hang on - I missed this change. Why does this require nsz? |
Comment Actions
Hmm...how does NaN change anything?
Instcombine moves fneg without any FMF:
// Sink negation: -X * Y --> -(X * Y)
Comment Actions
So Options.HonorSignDependentRoundingFPMath is sufficient to guard fmul negate and we can drop the unsafe context, is that only true for multiply? What about divide?
Comment Actions
I've never looked at HonorSignDependentRoundingFPMath:
/// If this is enabled (set to true), the code generator must /// assume that the rounding mode may dynamically change.
That would seem to preclude a bunch of transforms, but I don't know why that's guarding this particular transform.
We need to split this diff into its own patch and find the existing tests and/or add new tests, so we know what's going on here.
fmul and fdiv should be treated the same with regard to fneg transforms (although instcombine probably gets this wrong).