<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 --- - Wrong code bug in ipsccp"
   href="https://llvm.org/bugs/show_bug.cgi?id=31897">31897</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong code bug in ipsccp
          </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=17948" name="attach_17948" title="reproducer">attachment 17948</a> <a href="attachment.cgi?id=17948&action=edit" title="reproducer">[details]</a></span>
reproducer

If doing

opt -S -o - foo.ll -ipsccp

on

%rec = type { i32 }

@g1 = global %rec zeroinitializer
@g2 = global %rec* null

define internal %rec* @foo(%rec %par)  {
  br i1 undef, label %bar, label %bar
bar:
  ret %rec* @g1
}

define void @gaz() {
  %1 = call %rec* @foo(%rec undef)
  store %rec* %1, %rec** @g2

  ret void
}

we get

%rec = type { i32 }

@g1 = global %rec zeroinitializer
@g2 = global %rec* null

define internal %rec* @foo(%rec %par) {
  br i1 false, label %bar, label %bar

bar:                                              ; preds = %0, %0
  ret %rec* undef
}

define void @gaz() {
  %1 = call %rec* @foo(%rec zeroinitializer)
  store %rec* %1, %rec** @g2
  ret void
}

So the return value of foo has been changed to "undef", but
the callsite in gaz has not been changed so %1 will get the
value undef instead of @g1.

If changing foo so it doesn't take a struct argument, or if
changing the br i1 undef into e.g. br i1 false then the
callsite is updated.

(The br i1 undef was originally introduced by instcombine,
supposedly since it saw that the true and false branches were
the same, and thus it changed the condition into undef and removed the
computation leading to the original condition.)</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>