[llvm-commits] [llvm] r47252 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Chris Lattner clattner at apple.com
Sun Feb 17 23:34:56 PST 2008


On Feb 17, 2008, at 10:27 PM, Bill Wendling wrote:

> What are the bugs?

Specifically, it is good to say what you're fixing in the commit log,  
so that it shows up in svn log.

-Chris

>
> -bw
>
> On Feb 17, 2008, at 6:31 PM, Owen Anderson wrote:
>
>> Author: resistor
>> Date: Sun Feb 17 20:31:23 2008
>> New Revision: 47252
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=47252&view=rev
>> Log:
>> Fix bugs that Chris noticed in my last patch.
>>
>> Modified:
>>    llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/
>> BasicAliasAnalysis.cpp?rev=47252&r1=47251&r2=47252&view=diff
>>
>> = 
>> =====================================================================
>> ========
>> --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
>> +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17
>> 20:31:23 2008
>> @@ -250,22 +250,30 @@
>>     const Value *Object = getUnderlyingObject(P);
>>     // Allocations and byval arguments are "new" objects.
>>     if (Object &&
>> -        (isa<AllocationInst>(Object) ||
>> -         (isa<Argument>(Object) &&
>> -                                 (cast<Argument>(Object)-
>>> hasByValAttr() ||
>> -                                  cast<Argument>(Object)-
>>> hasNoAliasAttr())))) {
>> +        (isa<AllocationInst>(Object) || isa<Argument>(Object))) {
>>       // Okay, the pointer is to a stack allocated (or effectively
>> so, for
>>       // for noalias parameters) object.  If we can prove that
>>       // the pointer never "escapes", then we know the call cannot
>> clobber it,
>>       // because it simply can't get its address.
>> -      if (!AddressMightEscape(Object))
>> -        return NoModRef;
>> +      if (isa<AllocationInst>(Object) ||
>> +          cast<Argument>(Object)->hasByValAttr() ||
>> +          cast<Argument>(Object)->hasNoAliasAttr())
>> +        if (!AddressMightEscape(Object)) {
>> +          for (CallSite::arg_iterator CI = CS.arg_begin(), CE =
>> CS.arg_end();
>> +              CI != CE; ++CI)
>> +            if (getUnderlyingObject(CI->get()) == P)
>> +              return AliasAnalysis::getModRefInfo(CS, P, Size);
>> +
>> +          return NoModRef;
>> +        }
>>
>>       // If this is a tail call and P points to a stack location,
>> we know that
>>       // the tail call cannot access or modify the local stack.
>> -      if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction()))
>> -        if (CI->isTailCall() && !isa<MallocInst>(Object))
>> -          return NoModRef;
>> +      if (isa<AllocationInst>(Object) ||
>> +          cast<Argument>(Object)->hasByValAttr())
>> +        if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction()))
>> +          if (CI->isTailCall() && !isa<MallocInst>(Object))
>> +            return NoModRef;
>>     }
>>   }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list