summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Hexagon/hwloop-noreturn-call.ll
blob: accf6fd83c6e6f9319b04dc96c58c8cb8c09794b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; RUN: llc -march=hexagon < %s | FileCheck %s

target triple = "hexagon"

; CHECK-LABEL: danny:
; CHECK-DAG: loop0
; CHECK-DAG: call trap
define void @danny(i32* %p, i32 %n, i32 %k) #0 {
entry:
  br label %for.body

for.body:                                         ; preds = %entry
  %t0 = phi i32 [ 0, %entry ], [ %t1, %for.cont ]
  %t1 = add i32 %t0, 1
  %t2 = getelementptr i32, i32* %p, i32 %t0
  store i32 %t1, i32* %t2, align 4
  %c = icmp sgt i32 %t1, %k
  br i1 %c, label %noret, label %for.cont

for.cont:
  %cmp = icmp slt i32 %t0, %n
  br i1 %cmp, label %for.body, label %for.end

for.end:                                          ; preds = %for.cond
  ret void

noret:
  call void @trap() #1
  br label %for.cont
}

; CHECK-LABEL: sammy:
; CHECK-DAG: loop0
; CHECK-DAG: callr
define void @sammy(i32* %p, i32 %n, i32 %k, void (...)* %f) #0 {
entry:
  br label %for.body

for.body:                                         ; preds = %entry
  %t0 = phi i32 [ 0, %entry ], [ %t1, %for.cont ]
  %t1 = add i32 %t0, 1
  %t2 = getelementptr i32, i32* %p, i32 %t0
  store i32 %t1, i32* %t2, align 4
  %c = icmp sgt i32 %t1, %k
  br i1 %c, label %noret, label %for.cont

for.cont:
  %cmp = icmp slt i32 %t0, %n
  br i1 %cmp, label %for.body, label %for.end

for.end:                                          ; preds = %for.cond
  ret void

noret:
  call void (...) %f() #1
  br label %for.cont
}

declare void @trap() #1

attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" }
attributes #1 = { nounwind noreturn }

OpenPOWER on IntegriCloud