Using this helper makes work about neutral elements more easier. Although I only
find one case now, I think it will have more chance to be used since so many
combine works are related to neutral elements.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please can you look at whether this is compatible with something similar we already have in foldSelectWithIdentityConstant in DAGCombiner.cpp?
I am not sure what is the compatibility issue. I think foldSelectWithIdentityConstant could be also used for operations which not have communicative property (e.g. div).
I#m sorry - compatibility was a poor word to use - my hope is that we can remove the 'isIdentityConstantForOpcode' lambda inside foldSelectWithIdentityConstant and use isNeutralConstant instead - either as part of this patch or a future patch.
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | ||
---|---|---|
10738 | Can you add a OperandNo argument as well? It can default to 0 if necessary. This will allow us to handle sub/fsub, div/fdiv and shifts in future patches. llvm::isNeutralConstant(unsigned Opcode, SDNodeFlags Flags, SDValue V, unsigned OperandNo = 0) |
Rebase and address RKSimon's comment. I do not replace foldSelectWithIdentityConstant
since it makes some axv512 test fails.
Cheers - would it be possible to add additional riscv test coverage now that you're handling a lot more than just fadd?
Actually, there is no any new functional change in RISC-V. Those new opcodes are filtered out by BinOpToRVVReduce.
OperandNo