<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 --- - "More than one parameter has attribute returned!" after gvn/functionattrs interaction."
   href="https://llvm.org/bugs/show_bug.cgi?id=30350">30350</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"More than one parameter has attribute returned!" after gvn/functionattrs interaction.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mikael.holmen@ericsson.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>Created <span class=""><a href="attachment.cgi?id=17243" name="attach_17243" title="Small reproducer">attachment 17243</a> <a href="attachment.cgi?id=17243&action=edit" title="Small reproducer">[details]</a></span>
Small reproducer

Can be reproduced with

opt -S -functionattrs -gvn -functionattrs red.ll

The input code looks like:

define i32 @f1(i32 %p1, i32 %p2) local_unnamed_addr {
  %_tmp4 = icmp eq i32 %p1, %p2
  br i1 %_tmp4, label %bb2, label %bb1

bb2:                                              ; preds = %0
  ret i32 %p2

bb1:                                              ; preds = %0, %bb1
  br label %bb1
}


The first functionattrs pass adds the "returned" attribute to %p2. Then gvn
comes and change the

ret i32 %p2


to

ret i32 %p1


but still leaves "returned" on %p2, and finally when functionattrs runs again
it now adds
"returned" to "%p1" (while it's still on %p2), leaving "returned" on both %p1
and %p2, and
then the verifier pukes on it.</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>