This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/64601] Missed PRE on std::vector move assignment
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 15 Jan 2015 19:53:48 +0000
- Subject: [Bug tree-optimization/64601] Missed PRE on std::vector move assignment
- Auto-submitted: auto-generated
- References: <bug-64601-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64601
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> It's indeed that GCC only sees int accesses based on w and v and thus has to
> consider they might alias.
>
> TBAA cannot be strengthened easily here because the stores change the
> dynamic type of the memory.
struct A { int i; };
inline void z(int*i){*i=0;}
void f(struct A *a){ a->i=0; }
void g(struct A *a){ z(&a->i); }
f uses a_2(D)->i
g uses MEM[(int *)a_1(D)] (folded from *_2 where _2 = &a_1(D)->i)
Is it really true that we can't treat g the same as f? That sounds quite bad to
me. Or a version without stores:
struct A { int i; };
inline int z(int*i){return*i;}
int f(struct A *a){ return a->i; }
int g(struct A *a){ return z(&a->i); }
still has a_2(D)->i in f and MEM[(int *)a_1(D)] in g.
I don't think Jonathan and Paolo will be happy if I send a patch hand-inlining
std::swap in various places in libstdc++ :-(