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

    <tr>
        <th>Summary</th>
        <td>
            The value range analysis results of Scalar Evolution Analysis seem to be incorrect
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          GINN-Imp
      </td>
    </tr>
</table>

<pre>
    Hello, for the following IR, the value range analysis results of Scalar Evolution Analysis seem to be incorrect.

```llvm
define i1 @f() {
BB:
  %B = sdiv i1 true, true
  ret i1 %B
}

```
Output of `opt -passes="print<scalar-evolution>"`:

```
Printing analysis 'Scalar Evolution Analysis' for function 'f':
Classifying expressions for: @f
  %B = sdiv i1 true, true
  -->  %B U: [0,-1) S: [0,-1)
```
**According to https://llvm.org/doxygen/ConstantRange_8h_source.html, Scalar Evolution Analysis seems to think `%B`'s range is {False}, but in fact it has a value of True.**

testcase: https://godbolt.org/z/eWEM6nPqv

In addition, opt-16 considers it to be full-set:
```
Printing analysis 'Scalar Evolution Analysis' for function 'f':
Classifying expressions for: @f
  %B = sdiv i1 true, true
  -->  %B U: full-set S: full-set
```
bisect to https://github.com/llvm/llvm-project/commit/124547eae
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVNGu4zQQ_ZrJi5UqmdRN85CHtvcW7gPLancRjyvHmTQG1w4ep-zl65HTdtEtAoHEC5IlR86c8TlnjqyYzckRtSD3IJ8yNcfRh_abl3fv8pfzlHW-f22_JWs94EEMPog4khi8tf5X407i5UM6T2cXZWcSQbkTCeWUfWXDIhDPNrLwg_iolVVBPF-8naPxTuzuRUx0FtGLjoRx2odAOq6g2KW1Ka7L2ssZil1Pg3EkTClgXQyAW8BGQL2HYrffQ5UgQgDKvYDqSXBvLqk2hpkWmmlPFYHi0gNlQkL99HAbFLvv5zjNMRGHTeGnKPJJMRND9QSIUzAuQnXgRVROd1FQPQNi6rBweej5PqGSa1_9Aaz_0hfAejF8mJ1efgDWA2B9bX2waXTDa2pHX6ZAzMY7Tgiodld7_pkZeQ7V863whwUr9wXgIS-TuR8fTx40Aaa109qHPnGJXowxTpxY4hHwmCa38uEEeOz9l9cTOcDjwTuOysUPKS6ft-Nn9nPQtBrj2SZyfx8WTrfE0bif03CWKaat5lv8krH1_qgsU5otHkQ3R2GcGJSOwkQxKhbqllg_iE9hptVVyHVokThqxZS0v1Vz8n3nbbwJ-g3wSD8-f7dx73-5XKEvTqi-N0sY8CD8FPNyI7R3bHoKnG6_Rn2Yrc2Z4i0p_7-Y3AVcI_JVzlstnWHS8c-pOJk4zt1K-_MtIrctn4L_iXQEPGp_Ppv0UeJarmtSlPVt1TdVozJqy3pdbKSsapmN7SAHNVRKbvumK3ssqqqRXa2Ketv1pW5kZlosUBaIdVkiSrmqdb3tdNU1Q4-yGjSsCzorY1f3uGaGeaa2xKaomsyqjizfH8nQLlS7-cSwLqzhyH_goomW2k__-YuYzcG2_9rERQUvJi5CLi3-HgAA___6otlC">