On Thu, May 02, 2019 at 02:17:51PM +0200, Richard Biener wrote:
> On Tue, Apr 30, 2019 at 9:53 PM Jeff Law <l...@redhat.com> wrote:
> > This is loop unswitching.  It's a standard GCC optimization.  If it's
> > not working as well as it should, we're far better off determining why
> > and fixing the automatic transformation rather than relying on
> > attributes to drive the transformation.
> 
> It's currently not implemented for switch () stmts, just for conditionals.
> This also hurts SPEC cactusADM.  There might be a missed-optimization
> bug about this.  A simple recursive implementation might be possible;
> unswitch one case at a time - maybe order by profile probability.  We
> already recurse on the unswitched bodies (in case multiple conditions
> can be unswitched)

Well, if for some case value we can prove the controlling expression is
constant in the loop, we can almost always prove it is constant without
looking at the case value?  So we can pull the whole switch statement
outside just as easily?


Segher

Reply via email to