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



             Bug #: 55846

           Summary: Cannot sink conditional code

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: missed-optimization

          Severity: enhancement

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: rgue...@gcc.gnu.org

            Blocks: 55802





Code sinking (tree-ssa-sink.c) cannot sink conditional code:



int foo (int b, int c)

{

  int res = 0;

  if (b)

    res = b * 2 + 4;

  if (c)

    return res;

  return 0;

}



here we want to sink the whole if (b) res = b * 2 + 4; block into

the if (c) block.



Profitable if the original conditional becomes dead after sinking

the PHI node for 'res' and its dependencies.



Happens in GCC itself - usually exposed via inlining.

Reply via email to