| Submitter | Kai Tietz |
|---|---|
| Date | June 27, 2011, 5:33 p.m. |
| Message ID | <644943966.795848.1309196024947.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/102229/ |
| State | New |
| Headers | show |
Comments
On Mon, Jun 27, 2011 at 7:33 PM, Kai Tietz <ktietz@redhat.com> wrote: > Hello, > > this is the separated patch for issues noticed by doing type-sinking on bitwise-operations. The tests exposed that bswap pattern-matching searches from top to down for each BB. As it replaces the found match for a bswap in tree, but doesn't know about handling its inserted builtin-swap on pattern-matching for wider-mode bswap, search failed. > By reversing search order within BB from last to first, this issue can be fixed. > > ChangeLog > > 2011-06-27 Kai Tietz <ktietz@redhat.com> > > * tree-ssa-math-opts.c (execute_optimize_bswap): Search > within BB from last to first. > > Bootstrapped and regression-tested for x86_64-pc-linux-gnu. Ok for apply? > > Regards, > Kai > > Index: gcc-head/gcc/tree-ssa-math-opts.c > =================================================================== > --- gcc-head.orig/gcc/tree-ssa-math-opts.c > +++ gcc-head/gcc/tree-ssa-math-opts.c > @@ -1820,8 +1820,10 @@ execute_optimize_bswap (void) > FOR_EACH_BB (bb) > { > gimple_stmt_iterator gsi; > - > +/* > for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) > + */ > + for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) > { Err ... please 1) don't comment out stuff this way, 2) add a comment why we loop backwards Richard. > gimple stmt = gsi_stmt (gsi); > tree bswap_src, bswap_type; >
Patch
Index: gcc-head/gcc/tree-ssa-math-opts.c =================================================================== --- gcc-head.orig/gcc/tree-ssa-math-opts.c +++ gcc-head/gcc/tree-ssa-math-opts.c @@ -1820,8 +1820,10 @@ execute_optimize_bswap (void) FOR_EACH_BB (bb) { gimple_stmt_iterator gsi; - +/* for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + */ + for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) { gimple stmt = gsi_stmt (gsi); tree bswap_src, bswap_type;
Hello, this is the separated patch for issues noticed by doing type-sinking on bitwise-operations. The tests exposed that bswap pattern-matching searches from top to down for each BB. As it replaces the found match for a bswap in tree, but doesn't know about handling its inserted builtin-swap on pattern-matching for wider-mode bswap, search failed. By reversing search order within BB from last to first, this issue can be fixed. ChangeLog 2011-06-27 Kai Tietz <ktietz@redhat.com> * tree-ssa-math-opts.c (execute_optimize_bswap): Search within BB from last to first. Bootstrapped and regression-tested for x86_64-pc-linux-gnu. Ok for apply? Regards, Kai