<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 --- - cmp should be known true (via CVP?)"
   href="https://llvm.org/bugs/show_bug.cgi?id=30773">30773</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cmp should be known true (via CVP?)
          </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>All
          </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>spatel+llvm@rotateright.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>$ cat cvp.c
void g(int * __attribute((aligned(256))) a, int * __attribute((aligned(256)))
b, int * __attribute((aligned(256))) c, int n) {
  for (int i = 0; i < n * 16; ++i)
    c[i] = a[i] + b[i];
}

$ ./clang -O2 cvp.c -S -emit-llvm -o -
define void @g(i32* nocapture readonly %a, i32* nocapture readonly %b, i32*
nocapture %c, i32 %n) local_unnamed_addr #0 {
entry:
  %cmp10 = icmp sgt i32 %n, 0
  br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup

for.body.preheader:                        
  %mul = shl nsw i32 %n, 4  <--- %n is positive; %mul must be positive (nsw)
  %0 = sext i32 %mul to i64 
  %1 = icmp sgt i64 %0, 1   <--- so this must be true
  %smax = select i1 %1, i64 %0, i64 1 <--- and this shouldn't be needed
...

Is this a deficiency of correlated value propagation?</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>