Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
      2 
      3 ; CHECK-LABEL: @test1
      4 ; CHECK: -->  (zext
      5 ; CHECK: -->  (zext
      6 ; CHECK-NOT: -->  (zext
      7 
      8 define i32 @test1(i32 %x) {
      9   %n = and i32 %x, 255
     10   %y = xor i32 %n, 255
     11   ret i32 %y
     12 }
     13 
     14 ; ScalarEvolution shouldn't try to analyze %z into something like
     15 ;   -->  (zext i4 (-1 + (-1 * (trunc i64 (8 * %x) to i4))) to i64)
     16 ; or
     17 ;   -->  (8 * (zext i1 (trunc i64 ((8 * %x) /u 8) to i1) to i64))
     18 
     19 ; CHECK-LABEL: @test2
     20 ; CHECK: -->  (8 * (zext i1 (trunc i64 %x to i1) to i64))
     21 
     22 define i64 @test2(i64 %x) {
     23   %a = shl i64 %x, 3
     24   %t = and i64 %a, 8
     25   %z = xor i64 %t, 8
     26   ret i64 %z
     27 }
     28