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

            Bug ID: 27657
           Summary: [IfConverter/BranchFolding] An empty, non-reachable
                    MBB is not removed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedb...@nondot.org
          Reporter: pauls...@linux.vnet.ibm.com
                CC: dexonsm...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

Created attachment 16312
  --> https://llvm.org/bugs/attachment.cgi?id=16312&action=edit
llc input

The IfConverter should remove a block and its successor/predecessor edges from
MF because it is not reachable. BranchFolding fails to assist with this.
Interesting is to note that the probability of the edge to that block is 0,
which is another observation which means it could be removed.

Not having empty blocks is good generally for algorithms (I am experimenting
currently with something like global scheduler states to propagate processor
resources usage between regions.)

BB#0: derived from LLVM BB %entry
    Live Ins: %R2D
        CGHI %R2D, 0, %CC<imp-def>
        BRC 14, 6, <BB#2>, %CC<imp-use>
    Successors according to CFG: BB#1(0x30000000 / 0x80000000 = 37.50%)
BB#2(0x50000000 / 0x80000000 = 62.50%)

BB#1: derived from LLVM BB %return
    Predecessors according to CFG: BB#0
        %R2D<def> = LGHI 0
        Return %R2D<imp-use>

BB#2: derived from LLVM BB %if.end
    Live Ins: %R2D
    Predecessors according to CFG: BB#0
        CallJG <ga:@Perl_newSVsv>

=>

BB#0: derived from LLVM BB %entry
    Live Ins: %R2D
        CGHI %R2D, 0, %CC<imp-def>
        CallBRCL 14, 6, <ga:@Perl_newSVsv>
    Successors according to CFG: BB#1(0x80000000 / 0x80000000 = 100.00%)
BB#2(0x00000000 / 0x80000000 = 0.00%)

BB#1: derived from LLVM BB %return
    Predecessors according to CFG: BB#0
        %R2D<def> = LGHI 0
        Return %R2D<imp-use>

BB#2: derived from LLVM BB %if.end
    Live Ins: %R2D
    Predecessors according to CFG: BB#0

./bin/llc ./minperlio.ll -mtriple=s390x-linux-gnu -mcpu=z13

Could this be done in BranchFolder.cpp? I am not sure if there could be cases
lika a call to an empty block without successors to replace it..?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to