[llvm-bugs] [Bug 32872] New: miscompilation involving vector shuffles between r301764 and r301770

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 1 17:16:59 PDT 2017


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

            Bug ID: 32872
           Summary: miscompilation involving vector shuffles between
                    r301764 and r301770
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew.b.adams at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18386
  --> https://bugs.llvm.org/attachment.cgi?id=18386&action=edit
.ll that reproduces the bug

The attached .ll started computing wrong values around the same time as some
vector-shuffle-simplification commits on Sunday. 

opt -O3 seems to optimize the following code, which just concatenates a bunch
of vectors:

  %836 = shufflevector <4 x i32> %814, <4 x i32> %817, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %837 = shufflevector <4 x i32> %820, <4 x i32> %823, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %838 = shufflevector <4 x i32> %826, <4 x i32> %829, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %839 = shufflevector <4 x i32> %832, <4 x i32> %835, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %840 = shufflevector <8 x i32> %836, <8 x i32> %837, <16 x i32> <i32 0, i32
1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32
12, i32 13, i32 14, i32 15>
  %841 = shufflevector <8 x i32> %838, <8 x i32> %839, <16 x i32> <i32 0, i32
1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32
12, i32 13, i32 14, i32 15>
  %842 = shufflevector <16 x i32> %840, <16 x i32> %841, <32 x i32> <i32 0, i32
1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32
12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32
22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>

into this:

  %444 = shufflevector <4 x i32> %438, <4 x i32> %439, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %445 = shufflevector <4 x i32> %440, <4 x i32> %441, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %446 = shufflevector <4 x i32> %442, <4 x i32> %443, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %447 = shufflevector <4 x i32> %442, <4 x i32> undef, <8 x i32> <i32 0, i32
1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %448 = shufflevector <8 x i32> %444, <8 x i32> %445, <16 x i32> <i32 0, i32
1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32
12, i32 13, i32 14, i32 15>
  %449 = shufflevector <8 x i32> %446, <8 x i32> %447, <16 x i32> <i32 0, i32
1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32
12, i32 13, i32 14, i32 15>
  %450 = shufflevector <16 x i32> %448, <16 x i32> %449, <32 x i32> <i32 0, i32
1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32
12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32
22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>

Looks almost identical, except for some reason the very last vector has been
replaced with undef, and the second-last vector is replicated into the last
four lanes.

-- 
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/20170502/a0c48e54/attachment.html>


More information about the llvm-bugs mailing list