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

Chris Lattner clattner at apple.com
Mon Jan 10 15:43:31 PST 2011


On Jan 10, 2011, at 1:58 PM, Dan Gohman wrote:

>> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Jan  8 20:28:48 2011
>> @@ -2719,6 +2719,11 @@
>>                  HasNUW = true;
>>                if (OBO->hasNoSignedWrap())
>>                  HasNSW = true;
>> +              } else if (isa<GEPOperator>(BEValueV)) {
>> +                // If the increment is a GEP, then we know it won't perform an
>> +                // unsigned overflow, because the address space cannot be
>> +                // wrapped around.
>> +                HasNUW = true;
> 
> 
> Hi Chris, this isn't safe unless the GEP has the inbounds flag.
> inbounds is to GEP very nearly what nuw and nsw are to add and sub.

I don't really understand the issue, but I'm happy to defer to your expertise here, should I add the check for the flag?

-Chris



More information about the llvm-commits mailing list