[cfe-dev] [PATCH] Fix for bug 21725: wrong results with union and strict-aliasing

Jeroen Dobbelaere jeroen.dobbelaere at gmail.com
Fri Mar 20 13:37:47 PDT 2015


Getting more detailed tbaa information (for both, the access and the
structure content) should help for this case.

Greetings,

Jeroen

On Fri, Mar 20, 2015 at 9:01 PM, Daniel Berlin <dberlin at dberlin.org> wrote:

> So, on that review thread Nick, sadly, pointed out a difference between
> language and llvm level analysis.
>
> void test_s03c(struct S03* a, struct S03* b)
> {
>   a->mS00_1[0].mI_2=1;
>   b->mS00_1[1].mI_2=2;
>
>   // c++11:   NoAlias
>   // llvm:    MayAlias ******** performance
>   // future:  NoAlias
> }
>
>
> (Assuming for a second that we all agree they are NoAlias at the C++ level.
>
> You can make these alias at the LLVM level using negative GEPs  to make
> the a and b pointers go to the same place (and while I had noticed this at
> the local level, nick deviously pointed out it could have happened in our
> caller).
>
> The good news is nick believes it's still possible to get this
> optimization back in some cases :)
>
> [...]
>
-- 
Jeroen Dobbelaere
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150320/c032d134/attachment.html>


More information about the cfe-dev mailing list