File: argument-promotion.ll

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (39 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (8)
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
; RUN: opt < %s -tbaa -basic-aa -argpromotion -mem2reg -S | FileCheck %s

target datalayout = "E-p:64:64:64"

; CHECK: test
; CHECK-NOT: alloca
define internal i32 @test(i32* %X, i32* %Y, i32* %Q) {
  store i32 77, i32* %Q, !tbaa !2
  %A = load i32, i32* %X, !tbaa !1
  %B = load i32, i32* %Y, !tbaa !1
  %C = add i32 %A, %B
  ret i32 %C
}

; CHECK: caller
; CHECK-NOT: alloca
define internal i32 @caller(i32* %B, i32* %Q) {
  %A = alloca i32
  store i32 78, i32* %Q, !tbaa !2
  store i32 1, i32* %A, !tbaa !1
  %C = call i32 @test(i32* %A, i32* %B, i32* %Q)
  ret i32 %C
}

; CHECK: callercaller
; CHECK-NOT: alloca
define i32 @callercaller(i32* %Q) {
  %B = alloca i32
  store i32 2, i32* %B, !tbaa !1
  store i32 79, i32* %Q, !tbaa !2
  %X = call i32 @caller(i32* %B, i32* %Q)
  ret i32 %X
}

!0 = !{!"test"}
!1 = !{!3, !3, i64 0}
!2 = !{!4, !4, i64 0}
!3 = !{!"green", !0}
!4 = !{!"blue", !0}