diff options
author | Matthew Simpson <mssimpso@codeaurora.org> | 2017-03-29 18:23:08 +0000 |
---|---|---|
committer | Matthew Simpson <mssimpso@codeaurora.org> | 2017-03-29 18:23:08 +0000 |
commit | c8f0aeccda9914cc0f0b0c792d80788df246512a (patch) | |
tree | d7c27723579a2bfc43afca3ab8347d111a108042 /llvm/test/Transforms/InstCombine/getelementptr.ll | |
parent | e144b723727f4264cc0a22656191156cf1b8edb1 (diff) | |
download | bcm5719-llvm-c8f0aeccda9914cc0f0b0c792d80788df246512a.tar.gz bcm5719-llvm-c8f0aeccda9914cc0f0b0c792d80788df246512a.zip |
[InstCombine] Correct the check for vector GEPs
Some of the GEP combines (e.g., descaling) can't handle vector GEPs. We have an
existing check that attempts to bail out if given a vector GEP. However, the
check only tests the GEP's pointer operand. A GEP results in a vector of
pointers if at least one of its operands is vector-typed (e.g., its pointer
operand could be a scalar, but its index could be a vector). We should just
check the type of the GEP itself. This should fix PR32414.
Reference: https://bugs.llvm.org/show_bug.cgi?id=32414
Differential Revision: https://reviews.llvm.org/D31470
llvm-svn: 299017
Diffstat (limited to 'llvm/test/Transforms/InstCombine/getelementptr.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/getelementptr.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll index 6e2ac92b93c..de8190da01c 100644 --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -931,4 +931,15 @@ define i32 addrspace(1)* @ascast_0_0_gep([128 x i32]* %p) nounwind { ret i32 addrspace(1)* %x } +define <2 x i32*> @PR32414(i32** %ptr) { +; CHECK-LABEL: @PR32414( +; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32** %ptr to i32* +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], <2 x i64> <i64 0, i64 1> +; CHECK-NEXT: ret <2 x i32*> [[TMP1]] +; + %tmp0 = bitcast i32** %ptr to i32* + %tmp1 = getelementptr inbounds i32, i32* %tmp0, <2 x i64> <i64 0, i64 1> + ret <2 x i32*> %tmp1 +} + ; CHECK: attributes [[NUW]] = { nounwind } |