<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 - [Regression] Infinite loop in SoftenFloatOperand"
   href="https://bugs.llvm.org/show_bug.cgi?id=34866">34866</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Regression] Infinite loop in SoftenFloatOperand
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>bmakam@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>chh@google.com, Florian.Hahn@arm.com, llvm-bugs@lists.llvm.org, mcrosier@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>34492
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code no longer compiles:
$ cat test.c

typedef unsigned __int128 u128_t;
typedef __float128 f128_t;

typedef union
{
    f128_t f;
    u128_t i;
} union128_t;

int test(volatile f128_t *start_X_ptr, volatile f128_t *start_Y_ptr)
{
    for (unsigned iter_count = 1; iter_count <= 2; iter_count++)
    {
        union128_t read_valX = { .f = *start_X_ptr };
        union128_t read_valY = { .f = *start_Y_ptr };

        u128_t expected_val = ((iter_count - 1) * read_valY.i);
        if (read_valX.i != expected_val)
        {
            return -1;
        }

        union128_t write_valX = { .i = (iter_count * (read_valX.i + 1)) };
        union128_t write_valY = { .i = (read_valX.i + 1) };

        *start_X_ptr = write_valX.f;
        *start_Y_ptr = write_valY.f;
    }
    return 0;
}

because of an infinite loop in SoftenFloatOperand.

$ clang -O3 -c test.c -mllvm -debug-only=legalize-types
....
Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Soften float operand 0: t33: v16i8 = bitcast t20

Works with LLVM4.0.1: <a href="https://godbolt.org/g/W8cULV">https://godbolt.org/g/W8cULV</a>

I suspect this was introduced in r254653 and got exposed sometime between
03/14/2017 and 03/17/2017.</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] 5.0.1 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=34492">Bug 34492</a>] [meta] 5.0.1 Release Blockers
              </li>
          </ul>
        </div>
        <br>

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

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