[llvm-bugs] [Bug 38989] New: LICM behaves differently if multiple functions are present.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 18 17:01:01 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38989

            Bug ID: 38989
           Summary: LICM behaves differently if multiple functions are
                    present.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: alina.sbirlea at gmail.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180919/8b0cb4d1/attachment.html>


More information about the llvm-bugs mailing list