[llvm-commits] [llvm] r71688 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Eli Friedman eli.friedman at gmail.com
Wed May 13 13:24:26 PDT 2009


On Wed, May 13, 2009 at 1:18 PM, Dale Johannesen <dalej at apple.com> wrote:
>
> On May 13, 2009, at 1:15 PMPDT, Eli Friedman wrote:
>
>> On Wed, May 13, 2009 at 12:03 PM, Dale Johannesen <dalej at apple.com>
>> wrote:
>>> The previous test
>>>
>>>>>        if (!isa<AllocaInst>(I->getOperand(0)) &&
>>>>>            !isa<Constant>(I->getOperand(0)))
>>>>>          return false;
>>>
>>> will reject GEP's won't it?
>>
>> It will reject GEP instructions, but not GEP constant expressions.
>
> Right, a couple people have explained that.  However, the case we want
> to look for is a weak external, which is undefined and therefore
> cannot be initialized.  I think constant expressions can only arise
> from initializers?

Wrong; for example, take a testcase like the following:
__attribute((weak)) extern int x[2];
int a() { return x[0]; }

-Eli




More information about the llvm-commits mailing list