[llvm] [AMDGPU] Fix PromoteAlloca size check of alloca for store (PR #72528)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 15:51:48 PST 2023


bcahoon wrote:

Hi @Pierre-vh, I decided the change the test to better show the bug. The following is the output prior to the patch. The set of extract/insert element for the 2nd store start with the last value generated by the first set of extract/insert element instruction. The initial value becomes poison because the last insertelement uses an invalid index (outside the range). Let me know if that does/doesn't help.

  %0 = extractelement <4 x i32> %store1, i64 0
  %1 = insertelement <3 x i32> undef, i32 %0, i32 0
  %2 = extractelement <4 x i32> %store1, i64 1
  %3 = insertelement <3 x i32> %1, i32 %2, i32 1
  %4 = extractelement <4 x i32> %store1, i64 2
  %5 = insertelement <3 x i32> %3, i32 %4, i32 2
  %6 = extractelement <4 x i32> %store1, i64 3
  %7 = extractelement <4 x i32> %store2, i64 0
  %8 = insertelement <3 x i32> **poison**, i32 %7, i32 0
  %9 = extractelement <4 x i32> %store2, i64 1
  %10 = insertelement <3 x i32> %8, i32 %9, i32 1
  %11 = extractelement <4 x i32> %store2, i64 2
  %12 = insertelement <3 x i32> %10, i32 %11, i32 2
  %13 = extractelement <4 x i32> %store2, i64 3
  ret void



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


More information about the llvm-commits mailing list