[PATCH] D52294: [InstCombine] Fix incongruous GEP type addrspace

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 11:34:26 PDT 2018


spatel added a comment.

Looking at the existing code in this file, this seems like the way to handle it. Reviewing https://reviews.llvm.org/D44833 (where I added this transform), can we minimize the test to something like:

  define i32 addrspace(3)* @bitcast_vec_to_array_gep(<7 x i32>* %x, i64 %y, i64 %z) {
    %arr_ptr = bitcast <7 x i32>* %x to [7 x i32]*
    %asc = addrspacecast [7 x i32]* %arr_ptr to [7 x i32] addrspace(3)*
    %gep = getelementptr [7 x i32], [7 x i32] addrspace(3)* %asc, i64 %y, i64 %z
    ret i32 addrspace(3)* %gep
  }

There should be an 'inbounds' test too to cover the other code path. Given that this doesn't trigger the IR verifier (should we fix that too?), you could add the tests showing the bogus IR as a preliminary commit.


Repository:
  rL LLVM

https://reviews.llvm.org/D52294





More information about the llvm-commits mailing list