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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 14:56:54 PDT 2017


efriedma added a comment.

> because I believe that it is not uncommon to use i64 indexing expressions in 32-bit code

Whether or not that's true at the source-code level, it's should be uncommon at the IR level; instcombine will canonicalize GEP indexing to use pointer-width values.



================
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) *
----------------
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).


https://reviews.llvm.org/D38662





More information about the llvm-commits mailing list