If a GEP index simply advances by multiples of a type of zero size,
then replace the index with zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119974 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index e617ff2..4b6320b 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -714,7 +714,7 @@
// getelementptr P, N -> P if P points to a type of zero size.
if (TD) {
const Type *Ty = PtrTy->getElementType();
- if (Ty->isSized() && !TD->getTypeAllocSize(Ty))
+ if (Ty->isSized() && TD->getTypeAllocSize(Ty) == 0)
return Ops[0];
}
}