[LLVMbugs] [Bug 24220] New: Duplicate case blocks in switch can be merged

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 22 12:35:24 PDT 2015


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

            Bug ID: 24220
           Summary: Duplicate case blocks in switch can be merged
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: listmail at philipreames.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In the following example, many of the case blocks of the switch are identical
and could be merged into a single basic block.  This transformation should
likely live inside SimplifyCFG.  

declare void @foo()
declare void @bar()

define void @test(i16 %val1, i32 %local_2_) {
bci_84:                                           ; preds = %normal_return12
  switch i16 %val1, label %bci_149 [
    i16 45, label %bci_90
    i16 43, label %bci_103
    i16 58, label %bci_116
    i16 95, label %bci_129
    i16 46, label %bci_142
  ]

bci_149:
  call void @foo()
  ret void

bci_158:
  call void @bar()
  ret void

bci_142:                                          ; preds = %bci_84
  %.old = icmp eq i32 %local_2_, 0
  br i1 %.old, label %bci_149, label %bci_158

bci_129:                                          ; preds = %bci_84
  %_20 = icmp eq i32 %local_2_, 0
  br i1 %_20, label %bci_149, label %bci_158

bci_116:                                          ; preds = %bci_84
  %_21 = icmp eq i32 %local_2_, 0
  br i1 %_21, label %bci_149, label %bci_158

bci_103:                                          ; preds = %bci_84
  %_22 = icmp eq i32 %local_2_, 0
  br i1 %_22, label %bci_149, label %bci_158

bci_90:                                           ; preds = %bci_84
  %_23 = icmp eq i32 %local_2_, 0
  br i1 %_23, label %bci_149, label %bci_158
}

-- 
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/20150722/6d41063f/attachment.html>


More information about the llvm-bugs mailing list