https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65658

            Bug ID: 65658
           Summary: Jump threading too pessimistic when optimizing for
                    size
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at redhat dot com

Created attachment 35209
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35209&action=edit
testcase, compile with -O2 -Wall note uninitialized warnings for SRA's
variables and trivially threadable block in setup()

The jump threader will cancel jump threads when optimizing for size and the
block will need to be duplicated.  But that heuristic fails for something a
block like this:

  # _36 = PHI <1(2), 1(4), 0(7)>
  # problem$l3_101 = PHI <problem$l3_8(D)(2), problem$l3_8(D)(4),
problem$l3_35(7)>
  # problem$l4_100 = PHI <problem$l4_124(D)(2), problem$l4_124(D)(4),
problem$l4_34(7)>
  amt ={v} {CLOBBER};
  if (_36 != 0)
    goto <bb 25>;
  else
    goto <bb 9>;


All incoming edges are threadable and the block produces no code.  It's really
just a redirection block that's not recognized as such -- probably due to the
clobber statement.  

The net result is we cancel the jump thread, get worse code and issue false
positive warnings for uninitialized variables.  All around a lose.

Reply via email to