[llvm] [NVPTX] Fix crash caused by ComputePTXValueVTs (PR #104524)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 15:55:12 PDT 2024


================
@@ -226,7 +227,8 @@ static void ComputePTXValueVTs(const TargetLowering &TLI, const DataLayout &DL,
         }
         NumElts /= 2;
       } else if (EltVT.getSimpleVT() == MVT::i8 &&
-                 (NumElts % 4 == 0 || NumElts == 3)) {
+                 ((NumElts % 4 == 0 && isPowerOf2_32(NumElts)) ||
----------------
justinfargnoli wrote:

> AFAICT, previously, we'd accept i8 vectors with multiples of 4 elements, and a special case of v3i8, and lowered them all as N * v4i8.

Without this PR, vector types like `v12i8` will result in a [compiler crash](https://godbolt.org/z/8KhvahMob). 

This PR should only disable this code on inputs, which, when invoked via `LowerReturn()`, would've resulted in a crash.

> This, at the very least, needs a comment explaining what's going on

I've added a comment in 0c7cdb6aaec65c9c2e75cef7bd10988a4813ed81.

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


More information about the llvm-commits mailing list