Don't attempt to handle unsized types in ScalarEvolution's GEP analyzer.
authorDan Gohman <gohman@apple.com>
Sat, 9 May 2009 00:14:52 +0000 (00:14 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 9 May 2009 00:14:52 +0000 (00:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71302 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index c53d1f5aaeabf21e7e782baea9a361a365463126..3f2656240e4bdecfdbe8b7ab970cab6d0d678d4c 100644 (file)
@@ -1935,6 +1935,9 @@ SCEVHandle ScalarEvolution::createNodeForGEP(User *GEP) {
 
   const Type *IntPtrTy = TD->getIntPtrType();
   Value *Base = GEP->getOperand(0);
+  // Don't attempt to analyze GEPs over unsized objects.
+  if (!cast<PointerType>(Base->getType())->getElementType()->isSized())
+    return getUnknown(GEP);
   SCEVHandle TotalOffset = getIntegerSCEV(0, IntPtrTy);
   gep_type_iterator GTI = gep_type_begin(GEP);
   for (GetElementPtrInst::op_iterator I = next(GEP->op_begin()),