<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 - [RISCV] Infinite loop after D104581"
   href="https://bugs.llvm.org/show_bug.cgi?id=51206">51206</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[RISCV] Infinite loop after D104581
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>Backend: RISC-V
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>craig.topper@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>asb@lowrisc.org, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>As reported in D104581 this test causes an infinite loop when compiled with -O2

 char aspeed_set_pwm_port_fan_ctrl_priv_0_0,
      aspeed_set_pwm_port_fan_ctrl_fan_ctrl;
  pwm_store_period, pwm_store_dc_time_on;
  pwm_store() {
    pwm_store_period = aspeed_set_pwm_port_fan_ctrl_priv_0_0;
    pwm_store_period += 1;
    pwm_store_dc_time_on =
        aspeed_set_pwm_port_fan_ctrl_fan_ctrl * pwm_store_period / 5;
    if (pwm_store_dc_time_on)
      aspeed_set_pwm_port_duty_rising_falling();
  }


The combine from D104581 turns an any_extend into a sign_extend. This gets
converted to a zero_extend as the sign bit of input is known to be 0. Then a
setcc combine shrinks the setcc inputs back to the pre zero extended value.
This allows the zero extend to become an any_extend again. Then the whole
process starts over.</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>