[PATCH] D38662: [BasicAA] Support arbitrary pointer sizes (and fix an overflow bug)

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 15:39:24 PDT 2017


hfinkel added inline comments.


================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:519
+      // relevant values of V, (C2*Scale) can overflow. In that case, we cannot
+      // decompose the expression in this way.
+      APInt WideScaledOffset = IndexOffset.sextOrTrunc(MaxPointerSize*2) *
----------------
efriedma wrote:
> I'm not sure I understand this comment.
> 
> It's true that C2*Scale can overflow, but I'm not sure it makes sense to try to address that here.  The multiply by the scale can overflow no matter where the scale comes from (assuming the GEP isn't marked inbounds).
Can you please elaborate?

If this overflows, then the offset here isn't an offset, and the reasoning done later won't be correct.

In the test case, the GEPs are marked as inbounds. I don't think that's relevant here.


https://reviews.llvm.org/D38662





More information about the llvm-commits mailing list