[llvm] [RISCV] Use TargetConstant for the immediate RISCVISD::SHL_ADD nodes. (PR #166312)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 09:16:08 PST 2025


topperc wrote:

> Is there a principle for when we should use constants vs target constants? I thought that as RISCVISD nodes were pre-selection, we should be using non-target constants, but I guess that's wrong?

If the operand is always a constant and should never be selected it by itself, it should probably be a target constant. That will give an error if it ends up unselected.

TargetConstant's also bypass type legalization which can be useful in some cases but that's not really relevant here since we always use XLenVT.

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


More information about the llvm-commits mailing list