<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LowerSwitch should remove all dead blocks introduced by switch processing"
   href="https://bugs.llvm.org/show_bug.cgi?id=52383">52383</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LowerSwitch should remove all dead blocks introduced by switch processing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Transformation Utilities
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yilong.guo@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following ll:

```
define i32 @f(i32 %c) {
chk65:
  %cmp = icmp sgt i32 %c, 65
  br i1 %cmp, label %return, label %chk0

chk0:
  %cmp1 = icmp slt i32 %c, 0
  br i1 %cmp, label %return, label %bb_if

bb_if:
  %ashr.val = ashr exact i32 %c, 2
  %cmp2 = icmp sgt i32 %ashr.val, 14
  br i1 %cmp2, label %bb_switch, label %return

bb_switch:
; %ashr.val must be 15 or 16 here (analyzed by LazyValueInfo)
  switch i32 %ashr.val, label %out_of_switch_range [
    i32 15, label %return
    i32 16, label %another_ret
  ]

; unreachable default case
out_of_switch_range:
  br label %successor_of_unreachable

; unreachable successors
successor_of_unreachable:
  br label %return

another_ret:
  br label %return

return:
  %retval = phi i32 [-1, %chk0], [-1, %chk65], [-1, %bb_if], [42, %bb_switch],
[42, %another_ret], [-42, %successor_of_unreachable]
  ret i32 %retval
}
```

Both "out_of_switch_range" and "successor_of_unreachable" should be deleted as
they become dead after switch lowering.

But LowerSwitch only deletes the "out_of_switch_range" -- it didn't delete dead
block's dominatees which also become unreachable.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>