On Powerpc fma is faster than fadd + fmul for some types, (PPCTargetLowering::isFMAFasterThanFMulAndFAdd). we should implement target hook isProfitableToHoist to prevent simplifyCFGpass from breaking fma pattern by hoisting fmul to predecessor block.
Details
- Reviewers
hfinkel nemanjai - Group Reviewers
Restricted Project - Commits
- rG3f85134d710c: [PowerPC] implement target hook isProfitableToHoist
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
15390 | Can we please not have the same logic in two places. Please either call this one from the other by using VT.getTypeForEVT() and MF.getFunction() | |
llvm/test/Transforms/SimplifyCFG/PowerPC/prefer-fma.ll | ||
4 | I think it would be preferable to pre-commit this test case with full checks produced by the script and then just show the differences here. |
LGTM aside from a nit from me and a couple from clang-format. I'm sure you can address those on the commit.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
15399 | I think we can omit the check for nullptr here since you have already checked the instruction has a use. Perhaps just change it to: Also, I think it is more common to De-Morgan-ize these conditions to something like if (User->getOpcode() != Instruction::FSub && User->getOpcode() != Instruction::FAdd) |
Can we please not have the same logic in two places. Please either call this one from the other by using VT.getTypeForEVT() and MF.getFunction()
or write a separate helper function that can be called by both.