File: noreturn-call-linux.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (59 lines) | stat: -rw-r--r-- 2,049 bytes parent folder | download | duplicates (13)
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
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s

; PR43155, we used to emit dead stack adjustments for noreturn calls with stack
; arguments.

; Original source code:
; __attribute__((noreturn)) void exit_manyarg(int, int, int, int, int, int, int, int, int, int);
; struct ByVal {
;   int vals[10];
; };
; struct ByVal getbyval();
; void make_push_unprofitable(struct ByVal);
; int foo(int c) {
;   if (c)
;     exit_manyarg(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
;   make_push_unprofitable(getbyval());
;   make_push_unprofitable(getbyval());
;   make_push_unprofitable(getbyval());
;   return 0;
; }

%struct.ByVal = type { [10 x i32] }

define dso_local i32 @foo(i32 %c) {
entry:
  %agg.tmp = alloca %struct.ByVal, align 8
  %agg.tmp1 = alloca %struct.ByVal, align 8
  %agg.tmp2 = alloca %struct.ByVal, align 8
  %tobool = icmp eq i32 %c, 0
  br i1 %tobool, label %if.end, label %if.then

if.then:                                          ; preds = %entry
  tail call void @exit_manyarg(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10) #3
  unreachable

if.end:                                           ; preds = %entry
  call void @getbyval(ptr nonnull sret(%struct.ByVal) %agg.tmp) #4
  call void @make_push_unprofitable(ptr nonnull byval(%struct.ByVal) align 8 %agg.tmp) #4
  call void @getbyval(ptr nonnull sret(%struct.ByVal) %agg.tmp1) #4
  call void @make_push_unprofitable(ptr nonnull byval(%struct.ByVal) align 8 %agg.tmp1) #4
  call void @getbyval(ptr nonnull sret(%struct.ByVal) %agg.tmp2) #4
  call void @make_push_unprofitable(ptr nonnull byval(%struct.ByVal) align 8 %agg.tmp2) #4
  ret i32 0
}

; CHECK-LABEL: foo:
;   The main body is not important.
; CHECK: callq exit_manyarg
; CHECK-NOT: sub
; CHECK-NOT: add
; CHECK: # -- End function

; Function Attrs: noreturn
declare dso_local void @exit_manyarg(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) noreturn

declare dso_local void @make_push_unprofitable(ptr byval(%struct.ByVal) align 8)

declare dso_local void @getbyval(ptr sret(%struct.ByVal))