[llvm] [AMDGPU] Make getDWordFromOffset robust against exotic types (PR #70153)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 19:20:56 PDT 2023
================
@@ -11230,26 +11230,41 @@ static bool hasNon16BitAccesses(uint64_t PermMask, SDValue &Op,
static SDValue getDWordFromOffset(SelectionDAG &DAG, SDLoc SL, SDValue Src,
unsigned DWordOffset) {
SDValue Ret;
- if (Src.getValueSizeInBits() <= 32)
+
+ auto ValueSize = Src.getValueSizeInBits().getFixedValue();
+
+ if (ValueSize <= 32)
return DAG.getBitcastedAnyExtOrTrunc(Src, SL, MVT::i32);
- if (Src.getValueSizeInBits() >= 256) {
- assert(!(Src.getValueSizeInBits() % 32));
- Ret = DAG.getBitcast(
- MVT::getVectorVT(MVT::i32, Src.getValueSizeInBits() / 32), Src);
+ if (!(ValueSize % 32)) {
+ Ret = DAG.getBitcast(MVT::getVectorVT(MVT::i32, ValueSize / 32), Src);
----------------
arsenm wrote:
I would expect this to use EVT. What happens if the number of elements isn't a defined MVT?
https://github.com/llvm/llvm-project/pull/70153
More information about the llvm-commits
mailing list