<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - An odd number can never be zero"
   href="https://llvm.org/bugs/show_bug.cgi?id=25115">25115</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>An odd number can never be zero
          </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>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>listmail@philipreames.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In the example below, we have a loop with an induction variable which
repeatedly wraps around in the <0,17> iteration space.  On each iteration, we
have two clamped decrements which reset the value to if 16 if need.  Given we
know the loop starts at an even number, we could prove away the second clamp
since a decrement of an even number can not be zero. 

declare i1 @unknown(i32)

define void @test() {
bci_21.preheader:
  br label %bci_21.us

bci_21.us:
  %v33 = phi i32 [ %storemerge.3.us, %bci_21.us ], [ 16, %bci_21.preheader ]
  %v46 = icmp eq i32 %v33, 0
  %v47 = add nsw i32 %v33, -1
  %storemerge.1.us = select i1 %v46, i32 16, i32 %v47 
  %v62 = icmp eq i32 %storemerge.1.us, 0 ;; <-- Always false
  %v63 = add nsw i32 %storemerge.1.us, -1
  %storemerge.3.us = select i1 %v62, i32 16, i32 %v63 ;; <-- Always %v63

  %cnd = call i1 @unknown(i32 %v33)
  br i1 %cnd, label %bci_21.us, label %loopexit

loopexit:
  ret void
}</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>