[llvm-commits] [llvm] r123105 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/nsw.ll

Frits van Bommel fvbommel at gmail.com
Sun Jan 9 23:35:50 PST 2011


On Mon, Jan 10, 2011 at 3:36 AM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Chris Lattner wrote:
>> teach SCEV analysis of PHI nodes that PHI recurences formed
>> with GEP instructions are always NUW, because PHIs cannot wrap
>> the end of the address space.
>
> Aren't GEPs also NSW? I tried looking this up in the LangRef but wasn't
> able to find it, but I've been coding under the impression that GEPs are
> both nuw and nsw.

On a 32-bit machine where the OS splits user/kernel memory as e.g.
3GB/1GB[1] there's no reason a pointer can't cross from 0x7fffffff to
0x80000000, so in general it's not a valid assumption.

Of course, if you happen to be on x86-64 then that assumption is
perfectly valid until some chip factory creates a CPU capable of
mapping the full 64-bit address space. AFAIK no such chip exists yet.


[1]: Also common: a 64-bit kernel running a 32-bit program, which can
map almost 4GB for the program.



More information about the llvm-commits mailing list