[llvm-bugs] [Bug 34866] New: [Regression] Infinite loop in SoftenFloatOperand

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 6 15:19:22 PDT 2017


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

            Bug ID: 34866
           Summary: [Regression] Infinite loop in SoftenFloatOperand
           Product: libraries
           Version: 5.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: bmakam at codeaurora.org
                CC: chh at google.com, Florian.Hahn at arm.com,
                    llvm-bugs at lists.llvm.org, mcrosier at codeaurora.org
            Blocks: 34492

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: https://godbolt.org/g/W8cULV

I suspect this was introduced in r254653 and got exposed sometime between
03/14/2017 and 03/17/2017.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=34492
[Bug 34492] [meta] 5.0.1 Release Blockers
-- 
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/20171006/8af5025c/attachment-0001.html>


More information about the llvm-bugs mailing list