Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86-64 | FileCheck %s
      2 
      3 ; With optimization at O2 we actually get the legalized function optimized
      4 ; away through legalization and stack coloring, but check that we do all of
      5 ; that here and don't crash during legalization.
      6 
      7 ; Original program:
      8 ; typedef enum { A, B, C, D } P;
      9 ; struct { P x[2]; } a;
     10 
     11 ; void fn2();
     12 ; void fn1() {
     13 ;   int b;
     14 ;   unsigned c;
     15 ;   for (;; c++) {
     16 ;     fn2();
     17 ;     unsigned n;
     18 ;     for (; c; c++) {
     19 ;       b = a.x[c] == A || a.x[c] == B || a.x[c] == D;
     20 ;       if (b) n++;
     21 ;     }
     22 ;     if (n)
     23 ;	for (;;)
     24 ;	  ;
     25 ;   }
     26 ; }
     27 
     28 define void @fn1() {
     29 ; CHECK-LABEL: fn1
     30 ; CHECK: movb	$0, {{.*}}(%rsp)
     31 ; CHECK: cmpq	$8, %rax
     32 for.cond:
     33   br label %vector.body
     34 
     35 vector.body:                                      ; preds = %vector.body, %for.cond
     36   %x42 = bitcast <4 x i4> zeroinitializer to i16
     37   %x43 = icmp ne i16 %x42, 0
     38   %x44 = select i1 %x43, i32 undef, i32 0
     39   %x72 = bitcast <4 x i1> zeroinitializer to i4
     40   %x73 = icmp ne i4 %x72, 0
     41   %x74 = select i1 %x73, i32 %x44, i32 undef
     42   %x84 = select i1 undef, i32 undef, i32 %x74
     43   %x88 = icmp eq i64 undef, 8
     44   br i1 %x88, label %middle.block, label %vector.body
     45 
     46 middle.block:                                     ; preds = %vector.body
     47   %0 = select i1 undef, i32 undef, i32 %x84
     48   ret void
     49 }
     50