[Bug rtl-optimization/11832] Optimization of common stores in switch statements

2020-05-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11832
Bug 11832 depends on bug 33315, which changed state.

Bug 33315 Summary: stores not commoned by sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug rtl-optimization/11832] Optimization of common stores in switch statements

2017-01-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11832
Bug 11832 depends on bug 33315, which changed state.

Bug 33315 Summary: stores not commoned by sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315

   What|Removed |Added

 Status|RESOLVED|NEW
 Resolution|FIXED   |---

[Bug rtl-optimization/11832] Optimization of common stores in switch statements

2017-01-13 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11832
Bug 11832 depends on bug 33315, which changed state.

Bug 33315 Summary: stores not commoned by sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug rtl-optimization/11832] Optimization of common stores in switch statements

2016-07-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11832

--- Comment #11 from Richard Biener  ---
Note the testcase is flawed because c might point to b and thus the stores to
c[b] might clobber b itself.  Similar c might point to c itself and thus
clobber the pointer value.  This causes us to re-load both b and c after
each store.

Making b local and c a parameter avoids these issues:

int a, e;
void foo(unsigned char *c)
{
  int d = 13;
  int b = -1;
  switch (e) {
case 1:
b++; c[b] = (unsigned char)d;
break;
case 2:
b++; c[b] = (unsigned char)d;
b++; c[b] = (unsigned char)d;
break;
case 3:
b++; c[b] = (unsigned char)d;
b++; c[b] = (unsigned char)d;
b++; c[b] = (unsigned char)d;
break;
default:
a = 1;
b++; c[b] = (unsigned char)d;
b++; c[b] = (unsigned char)d;
b++; c[b] = (unsigned char)d;
b++; c[b] = (unsigned char)d;
  }
}

I have a patch to do some store merging during SSA code sinking but it doesn't
handle this case because the 1) the stores are ordered in the wrong way,
2) the CFG is not in proper form (I only handle common stores appearing in
all predecessors)

[Bug rtl-optimization/11832] Optimization of common stores in switch statements

2016-07-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11832

Richard Biener  changed:

   What|Removed |Added

 Depends on||33315
Summary|Optimization of common code |Optimization of common
   |in switch statements|stores in switch statements

--- Comment #10 from Richard Biener  ---
Similar to PR33315 this requests handling of stores (though this time really
hoisting).  The PRE hoisting doesn't do anything to stores.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33315
[Bug 33315] stores not commoned by sinking