Home | History | Annotate | Download | only in SimplifyLibCalls
      1 ; Test that the IsDigitOptimizer works correctly
      2 ; RUN: opt < %s -simplify-libcalls -S | \
      3 ; RUN:   not grep call
      4 
      5 declare i32 @isdigit(i32)
      6 
      7 declare i32 @isascii(i32)
      8 
      9 define i32 @main() {
     10 	%val1 = call i32 @isdigit( i32 47 )		; <i32> [#uses=1]
     11 	%val2 = call i32 @isdigit( i32 48 )		; <i32> [#uses=1]
     12 	%val3 = call i32 @isdigit( i32 57 )		; <i32> [#uses=1]
     13 	%val4 = call i32 @isdigit( i32 58 )		; <i32> [#uses=1]
     14 	%rslt1 = add i32 %val1, %val2		; <i32> [#uses=1]
     15 	%rslt2 = add i32 %val3, %val4		; <i32> [#uses=1]
     16 	%sum = add i32 %rslt1, %rslt2		; <i32> [#uses=1]
     17 	%rslt = call i32 @isdigit( i32 %sum )		; <i32> [#uses=1]
     18 	%tmp = call i32 @isascii( i32 %rslt )		; <i32> [#uses=1]
     19 	ret i32 %tmp
     20 }
     21 
     22