Home | History | Annotate | Download | only in SimplifyCFG
      1 ; RUN: opt < %s -simplifycfg -S | grep {%outval = phi i32 .*mux}
      2 ; PR2540
      3 ; Outval should end up with a select from 0/2, not all constants.
      4 
      5 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
      6 target triple = "i386-pc-linux-gnu"
      7 @g_37 = common global i32 0		; <i32*> [#uses=1]
      8 @.str = internal constant [4 x i8] c"%d\0A\00"		; <[4 x i8]*> [#uses=1]
      9 
     10 define i32 @main() nounwind  {
     11 entry:
     12 	%l = load i32* @g_37, align 4		; <i32> [#uses=1]
     13 	%cmpa = icmp ne i32 %l, 0		; <i1> [#uses=3]
     14 	br i1 %cmpa, label %func_1.exit, label %mooseblock
     15 
     16 mooseblock:		; preds = %entry
     17 	%cmpb = icmp eq i1 %cmpa, false		; <i1> [#uses=2]
     18 	br i1 %cmpb, label %monkeyblock, label %beeblock
     19 
     20 monkeyblock:		; preds = %monkeyblock, %mooseblock
     21 	br i1 %cmpb, label %cowblock, label %monkeyblock
     22 
     23 beeblock:		; preds = %beeblock, %mooseblock
     24 	br i1 %cmpa, label %cowblock, label %beeblock
     25 
     26 cowblock:		; preds = %beeblock, %monkeyblock
     27 	%cowval = phi i32 [ 2, %beeblock ], [ 0, %monkeyblock ]		; <i32> [#uses=1]
     28 	br label %func_1.exit
     29 
     30 func_1.exit:		; preds = %cowblock, %entry
     31 	%outval = phi i32 [ %cowval, %cowblock ], [ 1, %entry ]		; <i32> [#uses=1]
     32 	%pout = tail call i32 (i8*, ...)* @printf( i8* noalias  getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %outval ) nounwind 		; <i32> [#uses=0]
     33 	ret i32 0
     34 }
     35 
     36 declare i32 @printf(i8*, ...) nounwind 
     37