File: outline-inner-region-stacktoocomplex.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (71 lines) | stat: -rw-r--r-- 2,538 bytes parent folder | download | duplicates (6)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S --passes=hotcoldsplit --hotcoldsplit-max-params=1 < %s | FileCheck %s

target datalayout = "E-m:a-p:32:32-i64:64-n32"

define void @foo(i32 %cond) {
; CHECK-LABEL: define void @foo(
; CHECK-SAME: i32 [[COND:%.*]]) {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[COND_ADDR:%.*]] = alloca i32, align 4
; CHECK-NEXT:    store i32 [[COND]], ptr [[COND_ADDR]], align 4
; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[COND_ADDR]], align 4
; CHECK-NEXT:    [[STKS:%.*]] = tail call ptr @llvm.stacksave.p0()
; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i32 [[TMP0]], 0
; CHECK-NEXT:    br i1 [[TOBOOL]], label %[[IF_THEN:.*]], label %[[IF_END2:.*]]
; CHECK:       [[IF_THEN]]:
; CHECK-NEXT:    [[TMP1:%.*]] = load i32, ptr [[COND_ADDR]], align 4
; CHECK-NEXT:    call void @sink(i32 [[TMP0]])
; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[TMP1]], 10
; CHECK-NEXT:    br i1 [[CMP]], label %[[IF_THEN1:.*]], label %[[IF_ELSE:.*]]
; CHECK:       [[IF_THEN1]]:
; CHECK-NEXT:    call void @sideeffect(i32 2)
; CHECK-NEXT:    br label %[[IF_END:.*]]
; CHECK:       [[IF_ELSE]]:
; CHECK-NEXT:    call void @sink(i32 0)
; CHECK-NEXT:    call void @sideeffect(i32 0)
; CHECK-NEXT:    call void @llvm.stackrestore.p0(ptr [[STKS]])
; CHECK-NEXT:    br label %[[IF_END]]
; CHECK:       [[IF_END]]:
; CHECK-NEXT:    br label %[[IF_END2]]
; CHECK:       [[IF_END2]]:
; CHECK-NEXT:    call void @sideeffect(i32 1)
; CHECK-NEXT:    ret void
;
entry:
  %cond.addr = alloca i32
  store i32 %cond, ptr %cond.addr
  %0 = load i32, ptr %cond.addr
  %stks =  tail call ptr @llvm.stacksave.p0()
  %tobool = icmp ne i32 %0, 0
  br i1 %tobool, label %if.then, label %if.end2

if.then:                                          ; preds = %entry
  %1 = load i32, ptr %cond.addr
  call void @sink(i32 %0)
  %cmp = icmp sgt i32 %1, 10
  br i1 %cmp, label %if.then1, label %if.else

if.then1:                                         ; preds = %if.then
  call void @sideeffect(i32 2)
  br label %if.end

if.else:                                          ; preds = %if.then
  call void @sink(i32 0)
  call void @sideeffect(i32 0)
  call void @llvm.stackrestore.p0(ptr %stks)
  br label %if.end


if.end:                                           ; preds = %if.else, %if.then1
  br label %if.end2

if.end2:                                          ; preds = %entry
  call void @sideeffect(i32 1)
  ret void
}


declare void @sideeffect(i32)

declare void @sink(i32) cold