[llvm-commits] [llvm] r167829 - in /llvm/trunk: include/llvm/Support/GetElementPtrTypeIterator.h test/Transforms/InstCombine/vector_gep1.ll
Duncan Sands
baldrick at free.fr
Tue Nov 13 05:01:00 PST 2012
Author: baldrick
Date: Tue Nov 13 07:01:00 2012
New Revision: 167829
URL: http://llvm.org/viewvc/llvm-project?rev=167829&view=rev
Log:
Fix the instcombine GEP index widening transform to work correctly for vector
getelementptrs.
Modified:
llvm/trunk/include/llvm/Support/GetElementPtrTypeIterator.h
llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll
Modified: llvm/trunk/include/llvm/Support/GetElementPtrTypeIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GetElementPtrTypeIterator.h?rev=167829&r1=167828&r2=167829&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GetElementPtrTypeIterator.h (original)
+++ llvm/trunk/include/llvm/Support/GetElementPtrTypeIterator.h Tue Nov 13 07:01:00 2012
@@ -83,15 +83,15 @@
typedef generic_gep_type_iterator<> gep_type_iterator;
inline gep_type_iterator gep_type_begin(const User *GEP) {
- return gep_type_iterator::begin(GEP->getOperand(0)->getType(),
- GEP->op_begin()+1);
+ return gep_type_iterator::begin
+ (GEP->getOperand(0)->getType()->getScalarType(), GEP->op_begin()+1);
}
inline gep_type_iterator gep_type_end(const User *GEP) {
return gep_type_iterator::end(GEP->op_end());
}
inline gep_type_iterator gep_type_begin(const User &GEP) {
- return gep_type_iterator::begin(GEP.getOperand(0)->getType(),
- GEP.op_begin()+1);
+ return gep_type_iterator::begin
+ (GEP.getOperand(0)->getType()->getScalarType(), GEP.op_begin()+1);
}
inline gep_type_iterator gep_type_end(const User &GEP) {
return gep_type_iterator::end(GEP.op_end());
Modified: llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll?rev=167829&r1=167828&r2=167829&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/vector_gep1.ll Tue Nov 13 07:01:00 2012
@@ -35,3 +35,8 @@
%B = icmp ult <2 x i8*> %g, zeroinitializer
ret <2 x i1> %B
}
+
+define <2 x i32*> @test7(<2 x {i32, i32}*> %a) {
+ %w = getelementptr <2 x {i32, i32}*> %a, <2 x i32> <i32 5, i32 9>, <2 x i32> zeroinitializer
+ ret <2 x i32*> %w
+}
More information about the llvm-commits
mailing list