Home | History | Annotate | Download | only in Hexagon
      1 ; Check that a callee-saved register will be saved correctly if
      2 ; the predicate-to-GPR spilling code uses it.
      3 ;
      4 ; RUN: llc -march=hexagon < %s | FileCheck %s
      5 ;
      6 ; We expect to spill p0 into a general-purpose register and keep it there,
      7 ; without adding an extra spill of that register.
      8 ;
      9 ; CHECK: PredSpill:
     10 ; CHECK: memd(r29{{.*}}) = r17:16
     11 ; CHECK-DAG: r{{[0-9]+}} = p0
     12 ; CHECK-DAG: p0 = r{{[0-9]+}}
     13 ; CHECK-NOT: = memw(r29
     14 ;
     15 
     16 define void @PredSpill() {
     17 entry:
     18   br i1 undef, label %if.then, label %if.else.14
     19 
     20 if.then:                                          ; preds = %entry
     21   br i1 undef, label %if.end.57, label %if.else
     22 
     23 if.else:                                          ; preds = %if.then
     24   unreachable
     25 
     26 if.else.14:                                       ; preds = %entry
     27   br i1 undef, label %if.then.17, label %if.end.57
     28 
     29 if.then.17:                                       ; preds = %if.else.14
     30   br i1 undef, label %if.end.57, label %if.then.20
     31 
     32 if.then.20:                                       ; preds = %if.then.17
     33   %call21 = tail call i32 @myfun()
     34   %tobool22 = icmp eq i32 %call21, 0
     35   %0 = tail call i32 @myfun()
     36   br i1 %tobool22, label %if.else.42, label %if.then.23
     37 
     38 if.then.23:                                       ; preds = %if.then.20
     39   unreachable
     40 
     41 if.else.42:                                       ; preds = %if.then.20
     42   ret void
     43 
     44 if.end.57:                                        ; preds = %if.then.17, %if.else.14, %if.then
     45   ret void
     46 }
     47 
     48 declare i32 @myfun()
     49 
     50