Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
      2 
      3 define i32 @branch_true(i32 %x, i32 %y) {
      4 ; CHECK-LABEL: Classifying expressions for: @branch_true
      5  entry:
      6   br i1 true, label %add, label %merge
      7 
      8  add:
      9   %sum = add i32 %x, %y
     10   br label %merge
     11 
     12  merge:
     13   %v = phi i32 [ %sum, %add ], [ %x, %entry ]
     14 ; CHECK:  %v = phi i32 [ %sum, %add ], [ %x, %entry ]
     15 ; CHECK-NEXT:  -->  (%x + %y) U: full-set S: full-set
     16   ret i32 %v
     17 }
     18 
     19 define i32 @branch_false(i32 %x, i32 %y) {
     20 ; CHECK-LABEL: Classifying expressions for: @branch_false
     21  entry:
     22   br i1 false, label %add, label %merge
     23 
     24  add:
     25   %sum = add i32 %x, %y
     26   br label %merge
     27 
     28  merge:
     29   %v = phi i32 [ %sum, %add ], [ %x, %entry ]
     30 ; CHECK:  %v = phi i32 [ %sum, %add ], [ %x, %entry ]
     31 ; CHECK-NEXT:  -->  %x U: full-set S: full-set
     32   ret i32 %v
     33 }
     34 
     35 define i32 @select_true(i32 %x, i32 %y) {
     36 ; CHECK-LABEL: Classifying expressions for: @select_true
     37  entry:
     38  %v = select i1 true, i32 %x, i32 %y
     39 ; CHECK:  %v = select i1 true, i32 %x, i32 %y
     40 ; CHECK-NEXT:  -->  %x U: full-set S: full-set
     41   ret i32 %v
     42 }
     43 
     44 define i32 @select_false(i32 %x, i32 %y) {
     45 ; CHECK-LABEL: Classifying expressions for: @select_false
     46  entry:
     47  %v = select i1 false, i32 %x, i32 %y
     48 ; CHECK:  %v = select i1 false, i32 %x, i32 %y
     49 ; CHECK-NEXT:  -->  %y U: full-set S: full-set
     50   ret i32 %v
     51 }
     52