<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/69196>69196</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            LLVM ERROR: Broken module found, compilation aborted! Instruction does not dominate all uses.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:SLPVectorizer,
            llvm:crash
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            alexey-bataev
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          danilaml
      </td>
    </tr>
</table>

<pre>
    After https://github.com/llvm/llvm-project/commit/ea7f43ec14c5522cec7b787c5fc3c323f7459e89
the following IR:
```llvm
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"

define void @foo() {
bb:
 br label %bb1

bb1:                                              ; preds = %bb4, %bb
  %phi = phi i32 [ 0, %bb ], [ %or, %bb4 ]
  %phi2 = phi i32 [ 0, %bb ], [ %or3, %bb4 ]
  %and = and i32 0, 0
  %shl = shl i32 %phi, %and
  %or = or i32 %shl, 0
  %call = call i64 null(i32 %or)
  %or3 = or i32 %phi2, 0
  br label %bb4

bb4: ; preds = %bb1
  br i1 false, label %bb5, label %bb1

bb5:                                              ; preds = %bb4
  %phi6 = phi i32 [ %shl, %bb4 ]
  %phi7 = phi i32 [ %or3, %bb4 ]
  ret void
}
```
crashes with assertion above when run with `opt  -S -passes=slp-vectorizer -slp-threshold=-9999`.
Godbolt: https://godbolt.org/z/KW4bMx4qM
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVV-P4yYQ_zTkBTmywfjPgx-SS1OduqtWu9L1sQIzjukRcAHvn_v0FTjZTdLbh5W62sAM85vfwAweuPfqYAA6xLaIEK7hBV4zwQOHJ0QIYrsVn8NoXSe5UZof9UpY-dpthgAOjyFMHtENIntE9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