[llvm-bugs] [Bug 51206] New: [RISCV] Infinite loop after D104581

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 24 11:28:58 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51206

            Bug ID: 51206
           Summary: [RISCV] Infinite loop after D104581
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: RISC-V
          Assignee: unassignedbugs at nondot.org
          Reporter: craig.topper at gmail.com
                CC: asb at lowrisc.org, llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210724/12fbf086/attachment.html>


More information about the llvm-bugs mailing list