PATCH + test for PR18032 (InstCombine issue)

Stepan Dyatkovskiy stpworld at narod.ru
Mon Dec 23 06:27:47 PST 2013


ping
Stepan Dyatkovskiy wrote:
> Hi all,
> Please find in attachment my PR18032 fix for review.
>
> Issue description:
> InstCombine Pass emits wrong alignment for 'load' instruction with
> 'null' as
> address.
> Problem was in Local.cpp, llvm::getOrEnforceKnownAlignment method.
> Method analyzes trailing zeroes in address values and suggest its own
> aligment.
> For example: for address 0x123123a8 we have 3 binary trailing zeroes, and
> thus, method will suggest you 8 bytes alignment.
> Doing same logic, it will suggest you maximum possible alignment (2^29) for
> 'null' pointer.
> Then InstCombiner::visitLoadInst method will select maximum alignment of
> what
> was given in IR and what was suggested by getOrEnforceKnownAlignment; these
> strings:
>     if (KnownAlign > EffectiveLoadAlign)
>       LI.setAlignment(KnownAlign);
> So, finally we got align of 536870912 bytes:
>
> The fix:
> Add one more special case for getOrEnforceKnownAlignment. If address is 0,
> we don't need to anylize trailing zeroes,
> just return alignment known already (PrefAlign value).
>
> -Stepan




More information about the llvm-commits mailing list