<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 - LICM behaves differently if multiple functions are present."
   href="https://bugs.llvm.org/show_bug.cgi?id=38989">38989</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LICM behaves differently if multiple functions are present.
          </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>enhancement
          </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>alina.sbirlea@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Pulling test12 out of sinking.ll into a separate file makes it behave
differently. The store is hoisted all the way out.

The test in question:
; RUN: opt < %s -basicaa -licm -S | FileCheck %s

; Can't sink stores out of exit blocks containing indirectbr instructions
; because loop simplify does not create dedicated exits for such blocks. Test
; that by sinking the store from lab21 to lab22, but not further.
define void @test12() {
; CHECK-LABEL: @test12
  br label %lab4

lab4:
  br label %lab20

lab5:
  br label %lab20

lab6:
  br label %lab4

lab7:                                                                           
  br i1 undef, label %lab8, label %lab13                                        

lab8:                                                                           
  br i1 undef, label %lab13, label %lab10                                       

lab10:                                                                          
  br label %lab7

lab13:                                                                          
  ret void 

lab20:                                                                          
  br label %lab21                                                               

lab21:                                                                          
; CHECK: lab21:
; CHECK-NOT: store                                                              
; CHECK: br i1 false, label %lab21, label %lab22                                
  store i32 36127957, i32* undef, align 4                                       
  br i1 undef, label %lab21, label %lab22                                       

lab22:
; CHECK: lab22:
; CHECK: store                                                                  
; CHECK-NEXT: indirectbr i8* undef                                              
  indirectbr i8* undef, [label %lab5, label %lab6, label %lab7]                 
}

More strange is that if I paste the test twice (change method name), it behaves
like before (i.e. store sunk to lab22 only).
So there is some info/analysis that's not reset properly and leaks between the
processing of two separate functions.

Cause is between r340927-r341031.</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>