Fix a problem with negative indexes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5681 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 2242d4f..d9456f5 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -301,11 +301,11 @@
}
}
- unsigned Offset1 = getTargetData().getIndexedOffset(GEPPointerTy, Indices1);
- unsigned Offset2 = getTargetData().getIndexedOffset(GEPPointerTy, Indices2);
+ int Offset1 = getTargetData().getIndexedOffset(GEPPointerTy, Indices1);
+ int Offset2 = getTargetData().getIndexedOffset(GEPPointerTy, Indices2);
assert(Offset1 < Offset2 &&"There is at least one different constant here!");
- if (Offset2-Offset1 >= SizeMax) {
+ if ((unsigned)(Offset2-Offset1) >= SizeMax) {
//std::cerr << "Determined that these two GEP's don't alias ["
// << SizeMax << " bytes]: \n" << *GEP1 << *GEP2;
return NoAlias;