This allows us to fold fma's that multiply with 0.0. Also, the
multiply by 1.0 case is handled there as well. The fneg/fabs cases
are not handled by SimplifyFMulInst, so we need to keep them.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 37910 Build 37909: arc lint + arc unit
Event Timeline
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2247–2252 | I don't understand what this block does. How does an fmul simplify to a different fmul? And then it becomes LHS^2? | |
2260–2262 | It would be easier to read if you move the simplify call below these local variables and then re-use those names. | |
llvm/test/Transforms/InstCombine/fma.ll | ||
185 | I'm not seeing how these got commuted. | |
372–375 | Please add all of the new tests with baseline results as a preliminary commit, so we just have the diffs here. |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2247–2252 |
If we simplify to a different fmul, we can update the existing FMA and we do not have to replace it with a new fmul + fadd. Not sure if that happens in practice though. Simplifications like the ones below ( -x * -y => x * y) could result in a different fmul. But currently we do not do this in SimplifyFMulInst. If there is a reason we never do create different fmuls there, then we can drop it.
That should have been RHS of course. | |
2260–2262 | Sure, I've moved it down. | |
llvm/test/Transforms/InstCombine/fma.ll | ||
185 | That was noise of update_test_checks.py I think. The way it generates checks for arguments, it will match both fmul %x, %y and fmul %y, %x. I've stripped the unnecessary changes. | |
372–375 | Done |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2247–2252 | I think we should drop this clause...unless there is a test that shows the intended transform? // -X * -Y --> X * Y (can't do that in instsimplify because it's a new instruction) |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
2247–2252 | Thanks for clarifying! I've dropped it. |
I don't understand what this block does. How does an fmul simplify to a different fmul? And then it becomes LHS^2?