File: unreachable.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (104 lines) | stat: -rw-r--r-- 3,888 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable=false \
; RUN:     | FileCheck %s --check-prefixes=CHECK,NO-TRAP-UNREACHABLE
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable=false \
; RUN:     | FileCheck %s --check-prefixes=CHECK,NO-TRAP-UNREACHABLE
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn \
; RUN:     | FileCheck %s --check-prefixes=CHECK,NO-TRAP-AFTER-NORETURN
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn \
; RUN:     | FileCheck %s --check-prefixes=CHECK,NO-TRAP-AFTER-NORETURN
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn=false \
; RUN:     | FileCheck %s --check-prefixes=CHECK,TRAP
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn=false \
; RUN:     | FileCheck %s --check-prefixes=CHECK,TRAP
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -mattr=+ptx83 \
; RUN:     | FileCheck %s --check-prefixes=BUG-FIXED
; RUN: %if ptxas && !ptxas-12.0 %{ llc < %s -mtriple=nvptx -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}

target triple = "nvptx-unknown-cuda"

declare void @throw() #0
declare void @llvm.trap() #0

define ptx_kernel void @kernel_func() {
; NO-TRAP-UNREACHABLE-LABEL: kernel_func(
; NO-TRAP-UNREACHABLE:       {
; NO-TRAP-UNREACHABLE-EMPTY:
; NO-TRAP-UNREACHABLE-EMPTY:
; NO-TRAP-UNREACHABLE-NEXT:  // %bb.0:
; NO-TRAP-UNREACHABLE-NEXT:    { // callseq 0, 0
; NO-TRAP-UNREACHABLE-NEXT:    call.uni
; NO-TRAP-UNREACHABLE-NEXT:    throw,
; NO-TRAP-UNREACHABLE-NEXT:    (
; NO-TRAP-UNREACHABLE-NEXT:    );
; NO-TRAP-UNREACHABLE-NEXT:    } // callseq 0
; NO-TRAP-UNREACHABLE-NEXT:    // begin inline asm
; NO-TRAP-UNREACHABLE-NEXT:    exit;
; NO-TRAP-UNREACHABLE-NEXT:    // end inline asm
;
; NO-TRAP-AFTER-NORETURN-LABEL: kernel_func(
; NO-TRAP-AFTER-NORETURN:       {
; NO-TRAP-AFTER-NORETURN-EMPTY:
; NO-TRAP-AFTER-NORETURN-EMPTY:
; NO-TRAP-AFTER-NORETURN-NEXT:  // %bb.0:
; NO-TRAP-AFTER-NORETURN-NEXT:    { // callseq 0, 0
; NO-TRAP-AFTER-NORETURN-NEXT:    call.uni
; NO-TRAP-AFTER-NORETURN-NEXT:    throw,
; NO-TRAP-AFTER-NORETURN-NEXT:    (
; NO-TRAP-AFTER-NORETURN-NEXT:    );
; NO-TRAP-AFTER-NORETURN-NEXT:    } // callseq 0
; NO-TRAP-AFTER-NORETURN-NEXT:    // begin inline asm
; NO-TRAP-AFTER-NORETURN-NEXT:    exit;
; NO-TRAP-AFTER-NORETURN-NEXT:    // end inline asm
; NO-TRAP-AFTER-NORETURN-NEXT:    trap; exit;
;
; TRAP-LABEL: kernel_func(
; TRAP:       {
; TRAP-EMPTY:
; TRAP-EMPTY:
; TRAP-NEXT:  // %bb.0:
; TRAP-NEXT:    { // callseq 0, 0
; TRAP-NEXT:    call.uni
; TRAP-NEXT:    throw,
; TRAP-NEXT:    (
; TRAP-NEXT:    );
; TRAP-NEXT:    } // callseq 0
; TRAP-NEXT:    trap; exit;
;
; BUG-FIXED-LABEL: kernel_func(
; BUG-FIXED:       {
; BUG-FIXED-EMPTY:
; BUG-FIXED-EMPTY:
; BUG-FIXED-NEXT:  // %bb.0:
; BUG-FIXED-NEXT:    { // callseq 0, 0
; BUG-FIXED-NEXT:    call.uni
; BUG-FIXED-NEXT:    throw,
; BUG-FIXED-NEXT:    (
; BUG-FIXED-NEXT:    );
; BUG-FIXED-NEXT:    } // callseq 0
; BUG-FIXED-NEXT:    trap;
  call void @throw()
  unreachable
}

define void @kernel_func_2() {
; CHECK-LABEL: kernel_func_2(
; CHECK:       {
; CHECK-EMPTY:
; CHECK-EMPTY:
; CHECK-NEXT:  // %bb.0:
; CHECK-NEXT:    trap; exit;
;
; BUG-FIXED-LABEL: kernel_func_2(
; BUG-FIXED:       {
; BUG-FIXED-EMPTY:
; BUG-FIXED-EMPTY:
; BUG-FIXED-NEXT:  // %bb.0:
; BUG-FIXED-NEXT:    trap;
  call void @llvm.trap()
; Make sure we avoid emitting two trap instructions.
  unreachable
}

attributes #0 = { noreturn }