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

    <tr>
        <th>Summary</th>
        <td>
            "Instruction does not dominate all uses!" with loop-vectorize
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

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

<pre>
    llvm commit: d2a6e165e898
Reproduce with: ```opt "-passes=function(loop-vectorize<interleave-forced-only;no-vectorize-forced-only>)" bbi-73322.ll -o /dev/null```
Result:
```
Instruction does not dominate all uses!
  %arrayidx = getelementptr inbounds [2 x i16], ptr %a, i32 0, i32 1
  store i16 %5, ptr %arrayidx, align 2
opt: ../lib/Transforms/Vectorize/LoopVectorize.cpp:10469: bool llvm::LoopVectorizePass::processLoop(llvm::Loop *): Assertion `!verifyFunction(*L->getHeader()->getParent(), &dbgs())' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ../../main-github/llvm/build-all/bin/opt -passes=function(loop-vectorize<interleave-forced-only;no-vectorize-forced-only>) bbi-73322.ll -o /dev/null
 #0 0x0000000002d600e3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../main-github/llvm/build-all/bin/opt+0x2d600e3)
 #1 0x0000000002d5ddfe llvm::sys::RunSignalHandlers() (../../main-github/llvm/build-all/bin/opt+0x2d5ddfe)
 #2 0x0000000002d60466 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f35fb20b630 __restore_rt sigaction.c:0:0
 #4 0x00007f35f8952387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007f35f8953a78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00007f35f894b1a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #7 0x00007f35f894b252 (/lib64/libc.so.6+0x2f252)
 #8 0x0000000002f65c29 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (../../main-github/llvm/build-all/bin/opt+0x2f65c29)
 #9 0x0000000002f66ea2 llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&, std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (../../main-github/llvm/build-all/bin/opt+0x2f66ea2)
#10 0x0000000002f67986 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x2f67986)
#11 0x00000000030c470d llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) crtstuff.c:0:0
#12 0x000000000254d9a1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x254d9a1)
#13 0x0000000000ac195d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) crtstuff.c:0:0
#14 0x0000000002551daa llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x2551daa)
#15 0x0000000000ac173d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) crtstuff.c:0:0
#16 0x000000000254cb44 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x254cb44)
#17 0x000000000071b4c0 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) (../../main-github/llvm/build-all/bin/opt+0x71b4c0)
#18 0x000000000072d861 main (../../main-github/llvm/build-all/bin/opt+0x72d861)
#19 0x00007f35f893e555 __libc_start_main (/lib64/libc.so.6+0x22555)
#20 0x0000000000713ac0 _start (../../main-github/llvm/build-all/bin/opt+0x713ac0)
Abort
```
[bbi-73322.ll.gz](https://github.com/llvm/llvm-project/files/9493795/bbi-73322.ll.gz)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdWNtu2zgQ_Rr5hbAhUfcHPzgXo8WmaJAEfTUokZa5oUQvSaVJv36Hkm9UnEvrFF1s4PhCDmfOHB4ORRaSPk2FeKhRKeuaGy-cIYpJwoIkZlmeef6F589u2FpJ2pYMfedmZW28xO9fcm2Qh_F4TbRm2gsvlm1TGi4bD2dCyvX4gZVGKv6DeeE5bwxTgpEHNl5KVTI6lo148sKzRu7t3K5LD-fgHxUFH6dhiPFECDSWEHNO2QO8N60QOzRbuLoVNpX-56D3c6ONajuMiEqmUSMNfKl5QwxDBNy3NhMc9OYIQsVEKfLE6SOCBFHFDBOsZo1ZG4V4U8i2oRp58RlGj4gHiRdfePgc2V471n7nIUb-9svOs4aMmR1h7eLDMZt4tokIXjUI92OAbkv_ZAKZC17A-50ijQbKaoA8_7YjG8-vgP3d70m5XsPAwI-S3DoopBTI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