summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-04 21:48:01 +0000
committerChris Lattner <sabre@nondot.org>2006-03-04 21:48:01 +0000
commit3e19c23765c17304a8a5564dc85579501154a10b (patch)
treec7a196d7a0edf3cd7920bfbe6806caa0c51b7c58 /llvm/lib/Analysis
parentf97c7f5dbba625fe15c15c886dba52e67411a747 (diff)
downloadbcm5719-llvm-3e19c23765c17304a8a5564dc85579501154a10b.tar.gz
bcm5719-llvm-3e19c23765c17304a8a5564dc85579501154a10b.zip
Fix a crash compiling Obsequi
llvm-svn: 26529
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index f10691e531f..9a839ffdc52 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -637,17 +637,24 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops,
// than the first constant index of GEP2.
// Advance BasePtr[12]Ty over this first differing constant operand.
- BasePtr2Ty = cast<CompositeType>(BasePtr1Ty)->getTypeAtIndex(GEP2Ops[FirstConstantOper]);
- BasePtr1Ty = cast<CompositeType>(BasePtr1Ty)->getTypeAtIndex(GEP1Ops[FirstConstantOper]);
+ BasePtr2Ty = cast<CompositeType>(BasePtr1Ty)->
+ getTypeAtIndex(GEP2Ops[FirstConstantOper]);
+ BasePtr1Ty = cast<CompositeType>(BasePtr1Ty)->
+ getTypeAtIndex(GEP1Ops[FirstConstantOper]);
// We are going to be using TargetData::getIndexedOffset to determine the
// offset that each of the GEP's is reaching. To do this, we have to convert
// all variable references to constant references. To do this, we convert the
- // initial equal sequence of variables into constant zeros to start with.
- for (unsigned i = 0; i != FirstConstantOper; ++i)
- if (!isa<ConstantInt>(GEP1Ops[i]) || !isa<ConstantInt>(GEP2Ops[i]))
+ // initial sequence of array subscripts into constant zeros to start with.
+ const Type *ZeroIdxTy = GEPPointerTy;
+ for (unsigned i = 0; i != FirstConstantOper; ++i) {
+ if (!isa<StructType>(ZeroIdxTy))
GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Type::UIntTy);
+ if (const CompositeType *CT = dyn_cast<CompositeType>(ZeroIdxTy))
+ ZeroIdxTy = CT->getTypeAtIndex(GEP1Ops[i]);
+ }
+
// We know that GEP1Ops[FirstConstantOper] & GEP2Ops[FirstConstantOper] are ok
// Loop over the rest of the operands...
OpenPOWER on IntegriCloud