Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | grep {and i32 %a, 1} | count 4
      2 ; RUN: opt < %s -instcombine -S | grep {or i32 %0, %b} | count 4
      3 
      4 
      5 define i32 @func1(i32 %a, i32 %b) nounwind readnone {
      6 entry:
      7 	%0 = or i32 %b, %a		; <i32> [#uses=1]
      8 	%1 = and i32 %0, 1		; <i32> [#uses=1]
      9 	%2 = and i32 %b, -2		; <i32> [#uses=1]
     10 	%3 = or i32 %1, %2		; <i32> [#uses=1]
     11 	ret i32 %3
     12 }
     13 
     14 define i32 @func2(i32 %a, i32 %b) nounwind readnone {
     15 entry:
     16 	%0 = or i32 %a, %b		; <i32> [#uses=1]
     17 	%1 = and i32 1, %0		; <i32> [#uses=1]
     18 	%2 = and i32 -2, %b		; <i32> [#uses=1]
     19 	%3 = or i32 %1, %2		; <i32> [#uses=1]
     20 	ret i32 %3
     21 }
     22 
     23 define i32 @func3(i32 %a, i32 %b) nounwind readnone {
     24 entry:
     25 	%0 = or i32 %b, %a		; <i32> [#uses=1]
     26 	%1 = and i32 %0, 1		; <i32> [#uses=1]
     27 	%2 = and i32 %b, -2		; <i32> [#uses=1]
     28 	%3 = or i32 %2, %1		; <i32> [#uses=1]
     29 	ret i32 %3
     30 }
     31 
     32 define i32 @func4(i32 %a, i32 %b) nounwind readnone {
     33 entry:
     34 	%0 = or i32 %a, %b		; <i32> [#uses=1]
     35 	%1 = and i32 1, %0		; <i32> [#uses=1]
     36 	%2 = and i32 -2, %b		; <i32> [#uses=1]
     37 	%3 = or i32 %2, %1		; <i32> [#uses=1]
     38 	ret i32 %3
     39 }
     40