Fix the instcombine GEP index widening transform to work correctly for vector

getelementptrs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2012-11-13 13:01:00 +00:00
parent 2333e29be4
commit 707276d415
2 changed files with 9 additions and 4 deletions

View File

@ -83,15 +83,15 @@ namespace llvm {
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());

View File

@ -35,3 +35,8 @@ define <2 x i1> @test5(<2 x i8*> %a) {
%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
}