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

Chris Lattner sabre at nondot.org
Mon Nov 23 09:08:23 PST 2009


On Nov 23, 2009, at 12:24 AM, Duncan Sands wrote:

> Hi Chris,
> 
>> bool BasicAliasAnalysis::pointsToConstantMemory(const Value *P) {
>>   if (const GlobalVariable *GV =          dyn_cast<GlobalVariable>(P->getUnderlyingObject()))
>> +    // FIXME: shouldn't this require GV to be "ODR"?
> 
> I'm not sure, but I think it's the case that something declared weak and
> constant can safely be considered constant, i.e. readonly.  However you
> can't assume that the initializer it has is correct - some other (read-only)
> initializer may be substituted at link time.

Makes sense, I committed the patch.  The test is verifying whether it is constant (thus a store is guaranteed not to alias it) not anything about its specific value.  Thanks all!

-Chris



More information about the llvm-commits mailing list