Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon < %s
      2 ; REQUIRES: asserts
      3 
      4 ; This code causes multiple endloop instructions to be generated for the
      5 ; same loop. The findLoopInstr would encounter for one endloop would encounter
      6 ; the other endloop, and return null in response. This resulted in a crash.
      7 ;
      8 ; Check that with the fix we are able to compile this code successfully.
      9 
     10 target triple = "hexagon"
     11 
     12 ; Function Attrs: norecurse
     13 define void @fred() local_unnamed_addr #0 align 2 {
     14 b0:
     15   br label %b7
     16 
     17 b1:                                               ; preds = %b9
     18   br i1 undef, label %b4, label %b2
     19 
     20 b2:                                               ; preds = %b1
     21   %v3 = sub i32 undef, undef
     22   br label %b4
     23 
     24 b4:                                               ; preds = %b2, %b1
     25   %v5 = phi i32 [ undef, %b1 ], [ %v3, %b2 ]
     26   br i1 undef, label %b14, label %b6
     27 
     28 b6:                                               ; preds = %b4
     29   br label %b10
     30 
     31 b7:                                               ; preds = %b0
     32   br i1 undef, label %b9, label %b8
     33 
     34 b8:                                               ; preds = %b7
     35   unreachable
     36 
     37 b9:                                               ; preds = %b7
     38   br label %b1
     39 
     40 b10:                                              ; preds = %b21, %b6
     41   %v11 = phi i32 [ %v22, %b21 ], [ %v5, %b6 ]
     42   br i1 undef, label %b21, label %b12
     43 
     44 b12:                                              ; preds = %b10
     45   br label %b15
     46 
     47 b13:                                              ; preds = %b21
     48   br label %b14
     49 
     50 b14:                                              ; preds = %b13, %b4
     51   ret void
     52 
     53 b15:                                              ; preds = %b12
     54   br i1 undef, label %b16, label %b17
     55 
     56 b16:                                              ; preds = %b15
     57   store i32 0, i32* undef, align 4
     58   br label %b21
     59 
     60 b17:                                              ; preds = %b15
     61   br label %b18
     62 
     63 b18:                                              ; preds = %b17
     64   br i1 undef, label %b19, label %b20
     65 
     66 b19:                                              ; preds = %b18
     67   br label %b21
     68 
     69 b20:                                              ; preds = %b18
     70   store i32 0, i32* undef, align 4
     71   br label %b21
     72 
     73 b21:                                              ; preds = %b20, %b19, %b16, %b10
     74   %v22 = add i32 %v11, -8
     75   %v23 = icmp eq i32 %v22, 0
     76   br i1 %v23, label %b13, label %b10
     77 }
     78 
     79 attributes #0 = { norecurse "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" }
     80