Home | History | Annotate | Download | only in SimplifyCFG
      1 ; RUN: opt < %s -simplifycfg -S | \
      2 ; RUN:   not grep "icmp eq"
      3 
      4 ; Check that simplifycfg deletes a dead 'seteq' instruction when it
      5 ; folds a conditional branch into a switch instruction.
      6 
      7 declare void @foo()
      8 
      9 declare void @bar()
     10 
     11 define void @testcfg(i32 %V) {
     12         %C = icmp eq i32 %V, 18         ; <i1> [#uses=1]
     13         %D = icmp eq i32 %V, 180                ; <i1> [#uses=1]
     14         %E = or i1 %C, %D               ; <i1> [#uses=1]
     15         br i1 %E, label %L1, label %Sw
     16 Sw:             ; preds = %0
     17         switch i32 %V, label %L1 [
     18                  i32 15, label %L2
     19                  i32 16, label %L2
     20         ]
     21 L1:             ; preds = %Sw, %0
     22         call void @foo( )
     23         ret void
     24 L2:             ; preds = %Sw, %Sw
     25         call void @bar( )
     26         ret void
     27 }
     28 
     29