<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - IPSCCP produces wrong code when passing structs"
   href="https://bugs.llvm.org/show_bug.cgi?id=42738">42738</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IPSCCP produces wrong code when passing structs
          </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>Windows NT
          </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>jeroen.dobbelaere@synopsys.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22279" name="attach_22279" title="test_works.ll">attachment 22279</a> <a href="attachment.cgi?id=22279&action=edit" title="test_works.ll">[details]</a></span>
test_works.ll

IPSCCP produces wrong code when passing structs (with constants). 

(For the complete files, see the attachments; The only difference is the
absence of 'i32 %dummy0, i32 %dummmy1' arguments for '@f') 

test_works.ll:
  define internal i32 @f((i32 %dummy0, i32 %dummy1, %struct.S %s.coerce) #0 {
     ....
     ret i32 123
  }

  define dso_local i32 @main() #0 {
    %call = call i32 @f(%struct.S { i64 100 })
    call void @do_report(i32 undef, i32 undef, i32 %call)
    ret i32 0
  }

'opt -S -o - --ipsccp test_works.ll' results in:
  define dso_local i32 @main() #0 {
    %call = call i32 @f(i32 undef, i32 undef, %struct.S { i64 100 })
    call void @do_report(i32 123)
    ret i32 0
  }

  define internal i32 @f(i32 %dummy0, i32 %dummy1, %struct.S %s.coerce) #0 {
    ...
    ret i32 undef
  }

test_fails.ll:
  define internal i32 @f(%struct.S %s.coerce) #0 {
     ....
     ret i32 123
  }

  define dso_local i32 @main() #0 {
    %call = call i32 @f(%struct.S { i64 100 })
    call void @do_report(i32 %call)
    ret i32 0
  }


'opt -S -o - --ipsccp test_fails.ll' results in:
  define dso_local i32 @main() #0 {
    %call = call i32 @f(%struct.S { i64 100 })
    call void @do_report(i32 %call)   ; NOTE THE DIFFERENCE HERE
    ret i32 0
  }

  define internal i32 @f(i32 %dummy0, i32 %dummy1, %struct.S %s.coerce) #0 {
    ...
    ret i32 undef
  }</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>