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 +}