File: unreachable.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,245,044 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,666; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (92 lines) | stat: -rw-r--r-- 3,578 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
; 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 throw, ();
; 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 throw, ();
; 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 throw, ();
; 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 throw, ();
; 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 }