Index: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp =================================================================== --- lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -344,6 +344,10 @@ PtrA = PtrA->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetA); PtrB = PtrB->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetB); + if (DL.getTypeStoreSizeInBits(PtrA->getType()) != PtrBitWidth || + DL.getTypeStoreSizeInBits(PtrB->getType()) != PtrBitWidth) + return false; + APInt OffsetDelta = OffsetB - OffsetA; // Check if they are based on the same pointer. That makes the offsets Index: test/CodeGen/AMDGPU/vect-ptr-ptr-size-mismatch.ll =================================================================== --- /dev/null +++ test/CodeGen/AMDGPU/vect-ptr-ptr-size-mismatch.ll @@ -0,0 +1,26 @@ +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s + +%struct._globalized_locals_ty = type { [64 x i32], [64 x i32*], [64 x i32*], [64 x i32*] } + +@execution_param = external local_unnamed_addr addrspace(3) externally_initialized global i32, align 4 + +; GCN-LABEL: {{^}}test: +; GCN: s_cbranch +; GCN: s_endpgm +define amdgpu_kernel void @test() #0 { +entry: + br i1 undef, label %.worker, label %.mastercheck + +.worker: ; preds = %entry + ret void + +.mastercheck: ; preds = %entry + %tmp = load i32, i32 addrspace(3)* @execution_param, align 4 + %tmp3 = and i32 %tmp, 1 + %tmp4 = icmp eq i32 %tmp3, 0 + %tmp7 = select i1 %tmp4, i32** null, i32** getelementptr (%struct._globalized_locals_ty, %struct._globalized_locals_ty* null, i64 0, i32 1, i64 undef) + %tmp9 = select i1 %tmp4, i32** addrspacecast (i32* addrspace(5)* null to i32**), i32** null + store i32* undef, i32** %tmp9, align 8 + store i32* undef, i32** %tmp7, align 8 + unreachable +}