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

    <tr>
        <th>Summary</th>
        <td>
            Cached disposition of (zext i16 %0 to i32) for block %for.body306.i.i is incorrect! with indvars and -verify-scev
        </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: 1e2976631420
Reproduce with:```opt -passes="indvars" bbi-74813.ll -o /dev/null -S -verify-scev```
Result:
```
Cached disposition of (zext i16 %0 to i32) for block %for.body306.i.i is incorrect! 
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=indvars bbi-74813.ll -o /dev/null -S -verify-scev
 #0 0x0000000002e73973 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../main-github/llvm/build-all/bin/opt+0x2e73973)
 #1 0x0000000002e7168e llvm::sys::RunSignalHandlers() (../../main-github/llvm/build-all/bin/opt+0x2e7168e)
 #2 0x0000000002e73cf6 SignalHandler(int) (../../main-github/llvm/build-all/bin/opt+0x2e73cf6)
 #3 0x00007f1c94b7c630 __restore_rt (/lib64/libpthread.so.0+0xf630)
 #4 0x00007f1c922c3387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007f1c922c4a78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x0000000001e99386 llvm::ScalarEvolution::verify() const (../../main-github/llvm/build-all/bin/opt+0x1e99386)
 #7 0x00000000038077fb llvm::FunctionToLoopPassAdaptor::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x38077fb)
 #8 0x00000000031e1c1d llvm::detail::PassModel<llvm::Function, llvm::FunctionToLoopPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x31e1c1d)
 #9 0x00000000026528ec llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x26528ec)
#10 0x0000000000aeb6dd 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>&) (../../main-github/llvm/build-all/bin/opt+0xaeb6dd)
#11 0x0000000002656bce llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x2656bce)
#12 0x0000000000aeb4bd llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0xaeb4bd)
#13 0x0000000002651b9c llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x2651b9c)
#14 0x0000000000720b49 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+0x720b49)
#15 0x0000000000731681 main (../../main-github/llvm/build-all/bin/opt+0x731681)
#16 0x00007f1c922af555 __libc_start_main (/lib64/libc.so.6+0x22555)
#17 0x00000000007197b0 _start (../../main-github/llvm/build-all/bin/opt+0x7197b0)
Abort
```
[bbi-74813.ll.gz](https://github.com/llvm/llvm-project/files/9810934/bbi-74813.ll.gz)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlWNtu2zgQ_Rr5hbAgkRJlPfjBTWNssS02aIJ9NUiJtrmlRYGk0qZfv0NJTkTH6TZNir0Zhm4cnTlzZkRpyHV9t1Tq9oAqfThIF5EVSgUuC0pJmuEkSt5GyeqjaI2uu0qgz9LtwSaiyfDXrUPzllkrbETeRhjLpr5lxsIR4lzOi2yRklgpNNcowuta3MK26fyFazS_FUZu7-a2gstHxKNH2ynPZjg9Gb1g1V7UqJa21VY6qRukt4C_-Cq-OCRTCsd5gpxGkuAIl2irDeJKV5_8AJzEHOImCY1lLJG0SDaVNkZULsIpGnxcvb9cXV8i23GQBTHEux0yotXGedy9c6319PAa_jtQpeMxSAgnXs1xNwfZ_uhR19LaDjTCa8Sa2vtTXS2Q2wtUGWb3iLPqkzOsEvHg_trBBVR3h_ZehASGyiujd4YdEDO77iAa50mgOAbgfnNgspkPdB6o8E6qes6U8seygW2YtjFnz0xYzwlsSIKSL8nxh0VByoKg3jUwJyt7Z4eDKyMb18d14wOFdD0YGfZ5o60zggFhGuELkMj5zIHVj0QX4TfJl5ELwDyQTU_IpnQhzpH92DXXctcw9QvkSwlf0YtX4OPdBXzwqXjVlqLAM3h8JS0AOvBNRt_FNq3KjBcVhVxuNkZYp43YQKX3Qa-V5DQb9q3bQ47q2Oo46XG3cE8Amk1BMa4IWRTIMGnFY7TK49Aeh1CwC4DyE6CMFQvEuD5HawpUgF0ARKcSp6IsyYJOUn5dMcXM5a1WnZ9JhotDoY85r3Rj3YvUH70GtIopLbJIimLLJ7TWXVN5Pjf6vdbtFTyrq5q1kJjxgema4AE6mo9Pz8PACirpzkr7gTVsB9VELs7cRC77-15WYmMMQZCLIMhUpFV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