Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -verify-coalescing
      2 ; PR14732
      3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
      4 target triple = "x86_64-apple-macosx10"
      5 
      6 @c = common global i32 0, align 4
      7 @b = common global i32 0, align 4
      8 @a = common global i32 0, align 4
      9 @d = common global i32 0, align 4
     10 
     11 ; This function creates an IMPLICIT_DEF with a long live range, even after
     12 ; ProcessImplicitDefs.
     13 ;
     14 ; The coalescer should be able to deal with all kinds of IMPLICIT_DEF live
     15 ; ranges, even if they are not common.
     16 
     17 define void @f() nounwind uwtable ssp {
     18 entry:
     19   %i = alloca i32, align 4
     20   br label %for.cond
     21 
     22 for.cond:                                         ; preds = %for.inc34, %entry
     23   %i.0.load44 = phi i32 [ %inc35, %for.inc34 ], [ undef, %entry ]
     24   %pi.0 = phi i32* [ %pi.4, %for.inc34 ], [ undef, %entry ]
     25   %tobool = icmp eq i32 %i.0.load44, 0
     26   br i1 %tobool, label %for.end36, label %for.body
     27 
     28 for.body:                                         ; preds = %for.cond
     29   store i32 0, i32* @c, align 4
     30   br label %for.body2
     31 
     32 for.body2:                                        ; preds = %for.body, %for.inc
     33   %i.0.load45 = phi i32 [ %i.0.load44, %for.body ], [ 0, %for.inc ]
     34   %tobool3 = icmp eq i32 %i.0.load45, 0
     35   br i1 %tobool3, label %if.then10, label %if.then
     36 
     37 if.then:                                          ; preds = %for.body2
     38   store i32 0, i32* %i, align 4
     39   br label %for.body6
     40 
     41 for.body6:                                        ; preds = %if.then, %for.body6
     42   store i32 0, i32* %i, align 4
     43   br i1 true, label %for.body6, label %for.inc
     44 
     45 if.then10:                                        ; preds = %for.body2
     46   store i32 1, i32* @b, align 4
     47   ret void
     48 
     49 for.inc:                                          ; preds = %for.body6
     50   br i1 undef, label %for.body2, label %if.end30
     51 
     52 while.condthread-pre-split:                       ; preds = %label.loopexit, %while.condthread-pre-split.lr.ph.lr.ph, %for.inc27.backedge
     53   %0 = phi i32 [ %inc28, %for.inc27.backedge ], [ %inc285863, %while.condthread-pre-split.lr.ph.lr.ph ], [ %inc2858, %label.loopexit ]
     54   %inc2060 = phi i32 [ %inc20, %for.inc27.backedge ], [ %a.promoted.pre, %while.condthread-pre-split.lr.ph.lr.ph ], [ %inc20, %label.loopexit ]
     55   br label %while.cond
     56 
     57 while.cond:                                       ; preds = %while.condthread-pre-split, %while.cond
     58   %p2.1.in = phi i32* [ %pi.3.ph, %while.cond ], [ %i, %while.condthread-pre-split ]
     59   %p2.1 = bitcast i32* %p2.1.in to i16*
     60   br i1 %tobool19, label %while.end, label %while.cond
     61 
     62 while.end:                                        ; preds = %while.cond
     63   %inc20 = add nsw i32 %inc2060, 1
     64   %tobool21 = icmp eq i32 %inc2060, 0
     65   br i1 %tobool21, label %for.inc27.backedge, label %if.then22
     66 
     67 for.inc27.backedge:                               ; preds = %while.end, %if.then22
     68   %inc28 = add nsw i32 %0, 1
     69   store i32 %inc28, i32* @b, align 4
     70   %tobool17 = icmp eq i32 %inc28, 0
     71   br i1 %tobool17, label %for.inc27.if.end30.loopexit56_crit_edge, label %while.condthread-pre-split
     72 
     73 if.then22:                                        ; preds = %while.end
     74   %1 = load i16, i16* %p2.1, align 2
     75   %tobool23 = icmp eq i16 %1, 0
     76   br i1 %tobool23, label %for.inc27.backedge, label %label.loopexit
     77 
     78 label.loopexit:                                   ; preds = %if.then22
     79   store i32 %inc20, i32* @a, align 4
     80   %inc2858 = add nsw i32 %0, 1
     81   store i32 %inc2858, i32* @b, align 4
     82   %tobool1759 = icmp eq i32 %inc2858, 0
     83   br i1 %tobool1759, label %if.end30, label %while.condthread-pre-split
     84 
     85 for.inc27.if.end30.loopexit56_crit_edge:          ; preds = %for.inc27.backedge
     86   store i32 %inc20, i32* @a, align 4
     87   br label %if.end30
     88 
     89 if.end30:                                         ; preds = %for.inc27.if.end30.loopexit56_crit_edge, %label.loopexit, %label.preheader, %for.inc
     90   %i.0.load46 = phi i32 [ 0, %for.inc ], [ %i.0.load4669, %label.preheader ], [ %i.0.load4669, %label.loopexit ], [ %i.0.load4669, %for.inc27.if.end30.loopexit56_crit_edge ]
     91   %pi.4 = phi i32* [ %i, %for.inc ], [ %pi.3.ph, %label.preheader ], [ %pi.3.ph, %label.loopexit ], [ %pi.3.ph, %for.inc27.if.end30.loopexit56_crit_edge ]
     92   %2 = load i32, i32* %pi.4, align 4
     93   %tobool31 = icmp eq i32 %2, 0
     94   br i1 %tobool31, label %for.inc34, label %label.preheader
     95 
     96 for.inc34:                                        ; preds = %if.end30
     97   %inc35 = add nsw i32 %i.0.load46, 1
     98   store i32 %inc35, i32* %i, align 4
     99   br label %for.cond
    100 
    101 for.end36:                                        ; preds = %for.cond
    102   store i32 1, i32* %i, align 4
    103   %3 = load i32, i32* @c, align 4
    104   %tobool37 = icmp eq i32 %3, 0
    105   br i1 %tobool37, label %label.preheader, label %land.rhs
    106 
    107 land.rhs:                                         ; preds = %for.end36
    108   store i32 0, i32* @a, align 4
    109   br label %label.preheader
    110 
    111 label.preheader:                                  ; preds = %for.end36, %if.end30, %land.rhs
    112   %i.0.load4669 = phi i32 [ 1, %land.rhs ], [ %i.0.load46, %if.end30 ], [ 1, %for.end36 ]
    113   %pi.3.ph = phi i32* [ %pi.0, %land.rhs ], [ %pi.4, %if.end30 ], [ %pi.0, %for.end36 ]
    114   %4 = load i32, i32* @b, align 4
    115   %inc285863 = add nsw i32 %4, 1
    116   store i32 %inc285863, i32* @b, align 4
    117   %tobool175964 = icmp eq i32 %inc285863, 0
    118   br i1 %tobool175964, label %if.end30, label %while.condthread-pre-split.lr.ph.lr.ph
    119 
    120 while.condthread-pre-split.lr.ph.lr.ph:           ; preds = %label.preheader
    121   %.pr50 = load i32, i32* @d, align 4
    122   %tobool19 = icmp eq i32 %.pr50, 0
    123   %a.promoted.pre = load i32, i32* @a, align 4
    124   br label %while.condthread-pre-split
    125 }
    126