[llvm-commits] [llvm] r89602 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Nov 22 20:57:30 PST 2009
On Sun, Nov 22, 2009 at 12:20 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Eli Friedman wrote:
>>
>> On Sun, Nov 22, 2009 at 2:54 PM, Eli Friedman<eli.friedman at gmail.com>
>> wrote:
>>>
>>> On Sun, Nov 22, 2009 at 11:16 AM, Chris Lattner<sabre at nondot.org> wrote:
>>>>
>>>> --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
>>>> +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Nov 22 10:16:48
>>>> 2009
>>>> @@ -263,6 +263,7 @@
>>>> bool BasicAliasAnalysis::pointsToConstantMemory(const Value *P) {
>>>> if (const GlobalVariable *GV =
>>>> dyn_cast<GlobalVariable>(P->getUnderlyingObject()))
>>>> + // FIXME: shouldn't this require GV to be "ODR"?
>>>> return GV->isConstant();
>>>> return false;
>>>> }
>>>
>>> I don't think it legal for a non-constant to override a constant.
>>> (This isn't looking at the initializer.)
>>
>> Erm, more precisely, it isn't legal to modify a global that is marked
>> constant in any module.
>
> So we could optimize GlobalVariables with constant initializers into having
> _odr linkage (where applicable of course)?
No; there isn't any guarantee it won't be overridden, just that it
won't be modified at runtime.
-Eli
More information about the llvm-commits
mailing list