[llvm-dev] Possible bug of Alias Analysis?

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 17 00:25:39 PDT 2017


2017-10-17 8:45 GMT+02:00 Song, Ruiling <ruiling.song at intel.com>:
> Hi,
>
> I am an out-of-tree user of llvm. I am running into an regression issue against llvm 5.0.
> The issue was introduced by "[BasicAA] Use MayAlias instead of PartialAlias for fallback."( https://reviews.llvm.org/D34318)
> I have attached a very simple program to reproduce the issue. The symptom is alias analysis report NoAlias to GVN which cause GVN do wrong optimization.
> The BasicAA reports MayAlias while TBAA reports NoAlias, when query the pointers of below two instructions in attached sample:
> %5 = load float, float addrspace(4)* %add.ptr.i5, align 4, !tbaa !13
> store i32 %3, i32* %4, align 4, ! ?tbaa !3
> but in fact, they should be aliased as they are writing to/reading from the same buffer.
>
> you can run 'opt -S -aa -basicaa -tbaa -gvn aa-bug.ll -o -' to see what happens.
> I am not sure if we use llvm wrong or is it a bug that we should fix in llvm?

Your tbaa metadata suggests that the two locations cannot alias. Since
they still alias, the metadata is wrong. It looks like you are using a
plain cast between int/float pointers, which is illegal in C (6.5/7)
and in OpenCL (6.1.8). Try using -fno-strict-aliasing to avoid
emitting tbaa metadata.

Michael


More information about the llvm-dev mailing list