From 0565503d5d66cbe9c0908595d11583bd67712d61 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 2 Sep 2014 18:47:54 +0000 Subject: [PATCH] Fix crash when looking up the addrspace of GEPs with vector types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Björn Steinbrink git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216930 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Operator.h | 2 +- test/Transforms/MergeFunc/vector-GEP-crash.ll | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/Transforms/MergeFunc/vector-GEP-crash.ll diff --git a/include/llvm/IR/Operator.h b/include/llvm/IR/Operator.h index 888cabffe37..762f4a75c31 100644 --- a/include/llvm/IR/Operator.h +++ b/include/llvm/IR/Operator.h @@ -402,7 +402,7 @@ public: /// getPointerAddressSpace - Method to return the address space of the /// pointer operand. unsigned getPointerAddressSpace() const { - return cast(getPointerOperandType())->getAddressSpace(); + return getPointerOperandType()->getPointerAddressSpace(); } unsigned getNumIndices() const { // Note: always non-negative diff --git a/test/Transforms/MergeFunc/vector-GEP-crash.ll b/test/Transforms/MergeFunc/vector-GEP-crash.ll new file mode 100644 index 00000000000..a1eefa0bc98 --- /dev/null +++ b/test/Transforms/MergeFunc/vector-GEP-crash.ll @@ -0,0 +1,12 @@ +; RUN: opt -mergefunc -disable-output < %s +; This used to cause a crash when compairing the GEPs + +define void @foo(<2 x i64*>) { + %tmp = getelementptr <2 x i64*> %0, <2 x i64> + ret void +} + +define void @bar(<2 x i64*>) { + %tmp = getelementptr <2 x i64*> %0, <2 x i64> + ret void +}