For the following code, why can load be moved before store instruction? TBAA still applies even it is an anti-dependency. Somehow alias analysis is implemented differently in vectorization.
for int foo (long long *a, short *b, int n) { *a = (long long)(n * 100); return (*b) + 1000; } x86-64 code imull $100, %edx, %edx movswl (%rsi), %eax movslq %edx, %rdx movq %rdx, (%rdi) addl $1000, %eax ret Bingfeng -----Original Message----- From: Richard Biener [mailto:rguent...@suse.de] Sent: 03 February 2014 10:18 To: Florian Weimer Cc: Jakub Jelinek; Bingfeng Mei; gcc@gcc.gnu.org Subject: Re: No TBAA before ptr_derefs_may_alias_p? On Mon, 3 Feb 2014, Florian Weimer wrote: > On 02/03/2014 10:59 AM, Jakub Jelinek wrote: > > On Mon, Feb 03, 2014 at 09:51:01AM +0000, Bingfeng Mei wrote: > > > If it is just for C++ placement new, why don't implement it as a > > > lang_hook. > > > Now other languages such as C have to be made conservative and produce > > > worse > > > code. > > > > Even in C++ code you don't use placement new that often, so e.g. by having > > the placement new explicit through some special GIMPLE statement in the IL, > > you could e.g. just look if a particular function or loop contains any > > placement new stmts (cached in struct function and loop?) and use TBAA if > > it isn't there. > > I believe the convenience of TBAA lies in the fact that you don't have to > prove anything about actual program behavior if the types are sufficiently > distinct. If you allow local violations of that principle, the global > property inevitably breaks down as well. > > In any case, C code can call C++ code and vice versa, so it's difficult to > consider each language in isolation. As I said in other mail even C code can change the dynamic type of a storage location (via memcpy). And as soon as you require a look at stmts inbetween two refs that you ask the oracle to disambiguate you are doing sth wrong. Richard.