File: no-merge-block-address-other-function.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (61 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (20)
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
; RUN: opt -S -mergefunc < %s | FileCheck %s

; We should not merge these two functions, because the blocks are different.
; This tests the handling of block addresses from different functions.
; ModuleID = '<stdin>'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"


define internal i8* @Afunc(i32* %P) {
; CHECK-LABEL: @Afunc
; CHECK-NEXT: store
; CHECK-NEXT: store
; CHECK-NEXT: ret
  store i32 1, i32* %P
  store i32 3, i32* %P
  ret i8* blockaddress(@_Z1fi, %if.then)
}

define internal i8* @Bfunc(i32* %P) {
; CHECK-LABEL: @Bfunc
; CHECK-NEXT: store
; CHECK-NEXT: store
; CHECK-NEXT: ret
  store i32 1, i32* %P
  store i32 3, i32* %P
  ret i8* blockaddress(@_Z1fi, %if.then.2)
}


; Function Attrs: nounwind uwtable
define i32 @_Z1fi(i32 %i) #0 {
entry:
  %retval = alloca i32, align 4
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  %0 = load i32, i32* %i.addr, align 4
  %cmp = icmp eq i32 %0, 1
  br i1 %cmp, label %if.then, label %if.end

if.then:
  store i32 3, i32* %retval
  br label %return

if.end:
  %1 = load i32, i32* %i.addr, align 4
  %cmp1 = icmp eq i32 %1, 3
  br i1 %cmp1, label %if.then.2, label %if.end.3

if.then.2:
  store i32 56, i32* %retval
  br label %return

if.end.3:
  store i32 0, i32* %retval
  br label %return

return:
  %2 = load i32, i32* %retval
  ret i32 %2
}