File: noreturncall.ll

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (45 lines) | stat: -rw-r--r-- 1,305 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
; RUN: llvm-profdata merge %S/Inputs/noreturncall.proftext -o %t.profdata
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
; REQUIRES: asserts

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare i32 @bar0(i32)

define i32 @bar2(i32 %i) {
entry:
  unreachable
}

define i32 @foo(i32 %i, i32 %j, i32 %k) {
entry:
  %cmp = icmp slt i32 %i, 999
  br i1 %cmp, label %if.then, label %if.end
; USE: br i1 %cmp, label %if.then, label %if.end
; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]]

if.then:
  %call = call i32 @bar0(i32 %i)
  br label %if.end

if.end:
  %ret.0 = phi i32 [ %call, %if.then ], [ 0, %entry ]
  %cmp1 = icmp sgt i32 %j, 1000
  %cmp3 = icmp sgt i32 %k, 99
  %or.cond = and i1 %cmp1, %cmp3
  br i1 %or.cond, label %if.then4, label %if.end7
; USE: br i1 %or.cond, label %if.then4, label %if.end7
; USE-SAME: !prof ![[BW_IF:[0-9]+]]

if.then4:
  %call5 = call i32 @bar2(i32 undef)
  br label %if.end7

if.end7:
  %mul = mul nsw i32 %ret.0, %ret.0
  ret i32 %mul
}
; USE: ![[BW_ENTRY]] = !{!"branch_weights", i32 21, i32 0}
; USE: ![[BW_IF]] = !{!"branch_weights", i32 0, i32 21}