In function SITargetLowering::performExtractVectorElt,
the output type was not considered which could lead to type mismatches
later.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
10817 | This condition has to be stengtened. This is valid for smin, smax, umin and umax if the types have the same size or if they are truncated. |
Implicit element conversion strikes again. LGTM but needs tests
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
10817 | Not sure what you mean, those are handled below? |
Sure sorry! I didn't know phabricatior sent notifications when the patch is marked as draft. I submitted it in draft mode and I hoped to submit it after adding the tests.
- Added test (I found the test a bit awkward but I haven't managed to trigger it otherwise)
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
10817 | I meant that when ResVT != VecEltVT the transformation could not be valid. For example, if ResVT == i8 but VecEltVT == i16 for the min/max operations. I wasn't able to trigger this path, so I haven't added the code to do the transformation. Still, I added a check in the if anyways. | |
llvm/test/CodeGen/AMDGPU/dagcomb-extract-vec-elt-different-sizes.ll | ||
1 ↗ | (On Diff #484200) | @arsenm If you have some advice about how to reduce even more this test case I'll be glad. I tried triggering this case by hand but I didn't succeed. In the end I used llvm-reduce and applied some optimizations to get up to this. |
llvm/test/CodeGen/AMDGPU/dagcomb-extract-vec-elt-different-sizes.ll | ||
---|---|---|
2 ↗ | (On Diff #484200) | Should drop the -verify-machineinstrs, I've been thinking we should drop most of these in tests |
5–7 ↗ | (On Diff #484200) | Don't need this stuff |
9 ↗ | (On Diff #484200) | Should use opaque pointers |
93 ↗ | (On Diff #484200) | I'm sure you don't need the addrspacecasts here, should just change the address spaces of the arguments (We should have an optimization and have llvm-reduce start doing this too) |
110 ↗ | (On Diff #484200) | Does it only happen with 1 x vectors, and do you need so many elements? |
119 ↗ | (On Diff #484200) | Can you hit this with a few more vector types? |
- Remove -verify-machineinstrs
- Remove source_filename, datalayout and triple
- Make test pointers opaque
- Remove addresspace cast and move addrspace to the declaration
llvm/test/CodeGen/AMDGPU/dagcomb-extract-vec-elt-different-sizes.ll | ||
---|---|---|
110 ↗ | (On Diff #484200) | It seems that <1 x i8> is the only case where the bug gets triggered: I tried using directly i8; using <8 x i1>; changing the int type to i16, i32 or float; or changing the number of elements in the vector. I also tried removing some of the store instructions or replacing some of its arguments by another. |
This condition has to be stengtened. This is valid for smin, smax, umin and umax if the types have the same size or if they are truncated.