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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-04-12
                 CC|                            |jamborm at gcc dot gnu.org
          Component|c                           |tree-optimization
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
For GCC 6 stronger value-numbering might have fixed most cases.

Are the cases you still see indirect jumps to only one active case or
is it just that if()s with multiple cases would have avoided the dead
code?

I can see

  <bb 11>:
  _139 = &MEM[(void *)cmd_84(D) + 930B];
  _141 = conn_140(D)->sess;
  _142 = _141->se_sess;
  _143 = &cmd_84(D)->se_cmd;
  transport_init_se_cmd (_143, &iscsi_ops, _142, 0, 3, 32, _139);
  target_get_sess_cmd (_143, 1);
  switch (_58) <default: <L81>, case 1: <L205>, case 2: <L204>, case 3: <L240>,
case 4: <L77>, case 5: <L78>, case 6: <L79>, case 7: <L80>>

<L240>:
  goto <bb 19> (<L204>);

<L77>:
  goto <bb 19> (<L204>);

<L78>:
  goto <bb 19> (<L204>);

<L79>:
  goto <bb 19> (<L204>);

<L80>:
  goto <bb 19> (<L204>);

<L81>:
  _146 = (int) _58;
  printk ("\13Unknown iSCSI TMR Function: 0x%02x\n", _146);
  _351 = iscsit_add_reject_from_cmd (cmd_84(D), 10, 1, buf_55(D)); [tail call]
  goto <bb 54>;

<L205>:

  # prephitmp_14 = PHI <1(18), 2(11), 3(12), 4(13), 5(14), 6(15), 7(16)>
<L204>:


with the default case looping back.  switch conversion should probably handle
this but is run too early.  OTOH it seems to be confused by the default
case not falling thru, failing to see the "simple" transform to a

  if (... >= 1 && ... <= 7)
   ;
  else
   old default;

beginning to process the following SWITCH statement
(drivers/target/iscsi/iscsi_target.c:1807) : -------
switch (_74) <default: <L81>, case 1: <L204>, case 2: <L75>, case 3: <L76>,
case 4: <L77>, case 5: <L78>, case 6: <L79>, case 7: <L80>>

Bailing out - no common successor to all case label target blocks found
--------------------------------
beginning to process the following SWITCH statement
(drivers/target/iscsi/iscsi_target.c:1866) : -------
switch (_74) <default: <L127>, case 1: <L105>, case 2 ... 5: <L201>, case 6:
<L114>, case 7: <L117>, case 8: <L120>>

Bailing out - no common successor to all case label target blocks found
--------------------------------


Not sure what the other cases are.

Reply via email to