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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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, llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>RESOLVED
          </td>
        </tr>

        <tr>
          <th>Resolution</th>
          <td>DUPLICATE
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - [LoopVectorizer] bad vectorized loop: "Instruction does not dominate all uses!""
   href="https://bugs.llvm.org/show_bug.cgi?id=44021#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - [LoopVectorizer] bad vectorized loop: "Instruction does not dominate all uses!""
   href="https://bugs.llvm.org/show_bug.cgi?id=44021">bug 44021</a>
              from <span class="vcard"><a class="email" href="mailto:llvm-dev@redking.me.uk" title="Simon Pilgrim <llvm-dev@redking.me.uk>"> <span class="fn">Simon Pilgrim</span></a>
</span></b>
        <pre>

*** This bug has been marked as a duplicate of <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [LoopVectorizer] bad vectorized loop: "Instruction does not dominate all uses!""
   href="show_bug.cgi?id=44020">bug 44020</a> ***</pre>
        </div>
        <div>
        <pre>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>