[llvm] r216930 - Fix crash when looking up the addrspace of GEPs with vector types
Matt Arsenault
Matthew.Arsenault at amd.com
Tue Sep 2 11:47:54 PDT 2014
Author: arsenm
Date: Tue Sep 2 13:47:54 2014
New Revision: 216930
URL: http://llvm.org/viewvc/llvm-project?rev=216930&view=rev
Log:
Fix crash when looking up the addrspace of GEPs with vector types
Patch by Björn Steinbrink
Added:
llvm/trunk/test/Transforms/MergeFunc/vector-GEP-crash.ll
Modified:
llvm/trunk/include/llvm/IR/Operator.h
Modified: llvm/trunk/include/llvm/IR/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Operator.h?rev=216930&r1=216929&r2=216930&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Operator.h (original)
+++ llvm/trunk/include/llvm/IR/Operator.h Tue Sep 2 13:47:54 2014
@@ -402,7 +402,7 @@ public:
/// getPointerAddressSpace - Method to return the address space of the
/// pointer operand.
unsigned getPointerAddressSpace() const {
- return cast<PointerType>(getPointerOperandType())->getAddressSpace();
+ return getPointerOperandType()->getPointerAddressSpace();
}
unsigned getNumIndices() const { // Note: always non-negative
Added: llvm/trunk/test/Transforms/MergeFunc/vector-GEP-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/vector-GEP-crash.ll?rev=216930&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/MergeFunc/vector-GEP-crash.ll (added)
+++ llvm/trunk/test/Transforms/MergeFunc/vector-GEP-crash.ll Tue Sep 2 13:47:54 2014
@@ -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> <i64 0, i64 0>
+ ret void
+}
+
+define void @bar(<2 x i64*>) {
+ %tmp = getelementptr <2 x i64*> %0, <2 x i64> <i64 0, i64 0>
+ ret void
+}
More information about the llvm-commits
mailing list