This is a positive combination as long as the NEG is NOT free, as we are reducing the number of NEG from two to one.
Details
- Reviewers
efriedma craig.topper RKSimon dmgreen arsenm jsji nemanjai spatel - Group Reviewers
Restricted Project - Commits
- rGd48ac7d54d8a: [DAGCombine] Fold the (fma -x, y, -z) to -(fma x, y, z)
Diff Detail
Event Timeline
Unit tests: pass. 61273 tests passed, 0 failed and 736 were skipped.
clang-tidy: pass.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Wouldn't it be better to make use of the TargetLowering::isNegatibleForFree/getNegatedExpression mechanism?
This is really a good suggestion. I will go with that mechanism, though it seems that, it didn't respect the TLI.isFNegFree() and UnsafeFPMath which didn't make sense. (When it is FNEG opcode, we just return 2 to indicate that it is profitable. What if some target is free for FNEG operations ...)
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
12661 | It would be better if this function returns enum constant to improve readability. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
12661 | Yeah, thats been a pet peeve of mine as well for a long time - I'll take a look (might be after the release though) |
It would be better if this function returns enum constant to improve readability.