<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 - [LoopVectorizer] bad vectorized loop: "Instruction does not dominate all uses!""
   href="https://bugs.llvm.org/show_bug.cgi?id=44026">44026</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LoopVectorizer]   bad vectorized loop: "Instruction does not dominate all uses!"
          </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>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22819" name="attach_22819" title="reduced testcase">attachment 22819</a> <a href="attachment.cgi?id=22819&action=edit" title="reduced testcase">[details]</a></span>
reduced testcase

clang -cc1 -triple s390x-ibm-linux -S -target-cpu z13 -O3 -w -vectorize-loops
-mllvm -force-target-instruction-cost=1 -mllvm -unroll-full-max-count=1
-faddrsig -x ir tc_insdoesnotdom.ll

Instruction does not dominate all uses!
  %27 = phi <4 x i32> [ %21, %pred.load.continue10 ], [ %26, %pred.load.if11 ]
  %0 = shufflevector <4 x i32> %vector.recur, <4 x i32> %27, <4 x i32> <i32 3,
i32 4, i32 5, i32 6>
in function func_21
fatal error: error in backend: Broken function found, compilation aborted!


Loop vectorizer seems to build a loop where the use comes before the definition
(%29):

vector.body:
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue18 ]
  %vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %29,
%pred.store.continue18 ]
  %0 = shufflevector <4 x i32> %vector.recur, <4 x i32> %29, <4 x i32> <i32 3,
i32 4, i32 5, i32 6>

...
pred.load.continue12:
  %29 = phi <4 x i32> [ %23, %pred.load.continue10 ], [ %28, %pred.load.if11 ]

...
pred.store.continue18:
  %index.next = add i64 %index, 4
  %43 = icmp eq i64 %index.next, 8
  br i1 %43, label %middle.block, label %vector.body, !llvm.loop !0</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>