Displaying 2 results from an estimated 2 matches for "ischeapercommuteaddmul".
2020 Jul 01
2
How to prevent llvm's default optimization
...DAGCombiner::isMulAddWithConstProfitable
And I think the above condition is too aggressive.
// If the add only has one use, this would be OK to do.
if (AddNode.getNode()->hasOneUse())
return true;
Shall we make it to
if (AddNode.getNode()->hasOneUse() && TargetLowering.isCheaperCommuteAddMul(......))
return true;
The virtual hook nethod isCheaperCommuteAddMul will return true by default, but specific targets like arm/riscv can make their own decision.
Just like virtual bool TargetLowering::decomposeMulByConstant
What's your opinion?
Ben
At 2020-07-01 02:29:36, &q...
2020 Jun 30
2
How to prevent llvm's default optimization
Yes - this has been in InstCombine for a long time:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp#L268
We could say that the canonicalization should be reversed, but that
probably uncovers more missing optimizations.
The code size concern is legitimate. For example on x86, gcc asm is 2 bytes
smaller on this example: