[PATCH] D157603: [RISCV] Truncate constants to EltSize when combine store of BUILD_VECTOR
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 23:11:14 PDT 2023
wangpc marked 3 inline comments as done.
wangpc added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:13486
continue;
- NewC.insertBits(Val.getConstantOperandAPInt(i),
- i * Val.getScalarValueSizeInBits());
+ NewC.insertBits(Val.getConstantOperandAPInt(i).zextOrTrunc(EleSize),
+ i * EleSize);
----------------
craig.topper wrote:
> wangpc wrote:
> > craig.topper wrote:
> > > Why does it need to be `zextOrTrunc`? Can it just be `trunc`? It never need to be extended right?
> > Actually I don't know, here is just defensive programming.
> I would use trunc so we get the assertion. If we did need to extend for some reason, I don't know that zero extend would be correct.
OK, it makes sense to me.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157603/new/
https://reviews.llvm.org/D157603
More information about the llvm-commits
mailing list