[llvm] [SLP] NFC. Use InstructionsState::getOpcode only when necessary. (PR #120210)

Han-Kuan Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 22:52:08 PST 2024


HanKuanChen wrote:

Use `isa_and_present` may be better than valid check + `getOpcode`.
e.g.,
old code:
`if (S.getOpcode() != Instruction::PHI || S.isAltShuffle())`

isa_and_present:
`if (!isa_and_present<PHINode>(S.getMainOp()) || S.isAltShuffle())`

valid check:
`if ((!S.valid() || S.getOpcode() != Instruction::PHI) || S.isAltShuffle())`

https://github.com/llvm/llvm-project/pull/120210


More information about the llvm-commits mailing list