[llvm] [RISCV] Explicitly check for supported opcodes in optimizeCondBranch. NFC (PR #145622)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 24 18:47:57 PDT 2025
topperc wrote:
> > Ultimately I want to try to fix that the RISCVCC enum has turned into a proxy for opcode by having an entry for each vendor's branch instructions.
>
> Do you have a view on where you're trying to go? Just having the conditions, or also having e.g. both `equal` and `equal to immediate`?
I'm considering making analyzeBranch return the raw opcode instead of the condition code enum. And make the reverseBranchCondition work on raw opcodes.
I would reduce the condition code enum back down to 6 values.
This would leave select instructions as the primary user of the condition code enum. My thought is we could use the select opcode + condition code enum to expand the select into branches.
It might still be useful to translate an opcode into the 6 condition codes like we currently need to do for evaluateCondBranch. So I may leave getCondFromBranchOpc but reduce it to only return the 6 possible values.
https://github.com/llvm/llvm-project/pull/145622
More information about the llvm-commits
mailing list