public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/41186]  New: VN doesn't look through non-aliasing by offset memcpy
@ 2009-08-29 12:43 rguenth at gcc dot gnu dot org
  2009-08-29 13:49 ` [Bug tree-optimization/41186] " rguenth at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-29 12:43 UTC (permalink / raw)
  To: gcc-bugs

The C++ FE now creates memcpy for class copies to avoid copying objects in
tail-padding.

struct Foo {
  Foo() {};
  int i;
  short f;
};
struct Bar : public Foo {
  Bar() {};
  short b;
};

extern "C" void abort(void);

int main()
{
  Bar b1, b2;
  b2.i = 0;
  b1.f = 0;
  b1.b = 1;
  b2.f = 1;
  b2.b = 2;
  static_cast<Foo&>(b1) = static_cast<Foo&>(b2);
  if (b1.i != 0 || b1.b != 1)
    abort ();
  if (b1.f != 1)
    abort ();
  return 0;
}

The alias-oracle does consider the memcpy to clobber b1.b and the
look-through doesn't find b1.f or b1.i either.

Note that with combining the tests like

  if (b1.i != 0 || b1.b != 1 || b1.f != 1)
    abort ();

fold creates a BIT_FIELD_REF covering both b and f which confuses us
even more.  But I have considered this a bad habit of fold earlier.


-- 
           Summary: VN doesn't look through non-aliasing by offset memcpy
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41186


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/41186] VN doesn't look through non-aliasing by offset memcpy
  2009-08-29 12:43 [Bug tree-optimization/41186] New: VN doesn't look through non-aliasing by offset memcpy rguenth at gcc dot gnu dot org
@ 2009-08-29 13:49 ` rguenth at gcc dot gnu dot org
  2009-08-30 11:52 ` rguenth at gcc dot gnu dot org
  2009-09-26 15:28 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-29 13:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-08-29 13:49 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-29 13:49:04
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41186


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/41186] VN doesn't look through non-aliasing by offset memcpy
  2009-08-29 12:43 [Bug tree-optimization/41186] New: VN doesn't look through non-aliasing by offset memcpy rguenth at gcc dot gnu dot org
  2009-08-29 13:49 ` [Bug tree-optimization/41186] " rguenth at gcc dot gnu dot org
@ 2009-08-30 11:52 ` rguenth at gcc dot gnu dot org
  2009-09-26 15:28 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-30 11:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-08-30 11:52 -------
Subject: Bug 41186

Author: rguenth
Date: Sun Aug 30 11:52:13 2009
New Revision: 151226

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151226
Log:
2009-08-30  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/41186
        * tree-ssa-alias.c (ptr_deref_may_alias_ref_p): Remove.
        (ao_ref_init_from_ptr_and_size): New function.
        (ref_maybe_used_by_call_p_1): Be more precise tracking
        used ranges for builtin functions.
        (ref_maybe_used_by_call_p): Adjust.
        (call_may_clobber_ref_p_1): Be more precise tracking clobbered
        ranges for builtin functions.
        * tree-ssa-alias.h (ao_ref_init_from_ptr_and_size): Declare.

        * g++.dg/torture/pr41186.C: New testcase.
        * g++.dg/tree-ssa/pr41186.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr41186.C
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr41186.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-alias.c
    trunk/gcc/tree-ssa-alias.h


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41186


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/41186] VN doesn't look through non-aliasing by offset memcpy
  2009-08-29 12:43 [Bug tree-optimization/41186] New: VN doesn't look through non-aliasing by offset memcpy rguenth at gcc dot gnu dot org
  2009-08-29 13:49 ` [Bug tree-optimization/41186] " rguenth at gcc dot gnu dot org
  2009-08-30 11:52 ` rguenth at gcc dot gnu dot org
@ 2009-09-26 15:28 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-26 15:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-09-26 15:27 -------
Fixed.  Related is PR13954 where VN does not look through (partial) struct
copies
using memcpy.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41186


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-26 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-29 12:43 [Bug tree-optimization/41186] New: VN doesn't look through non-aliasing by offset memcpy rguenth at gcc dot gnu dot org
2009-08-29 13:49 ` [Bug tree-optimization/41186] " rguenth at gcc dot gnu dot org
2009-08-30 11:52 ` rguenth at gcc dot gnu dot org
2009-09-26 15:28 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).