-
Notifications
You must be signed in to change notification settings - Fork 10.8k
/
alignment.ll
88 lines (82 loc) · 3.37 KB
/
alignment.ll
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
define void @f() {
; IS__TUNIT____-LABEL: define {{[^@]+}}@f() {
; IS__TUNIT____-NEXT: entry:
; IS__TUNIT____-NEXT: call void @g()
; IS__TUNIT____-NEXT: ret void
;
; IS__CGSCC____-LABEL: define {{[^@]+}}@f() {
; IS__CGSCC____-NEXT: entry:
; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i32, align 1
; IS__CGSCC____-NEXT: call void @g()
; IS__CGSCC____-NEXT: ret void
;
entry:
%a = alloca i32, align 1
call void @g(i32* %a)
ret void
}
define internal void @g(i32* %a) {
; CHECK-LABEL: define {{[^@]+}}@g() {
; CHECK-NEXT: call void @z(i32 undef)
; CHECK-NEXT: ret void
;
%aa = load i32, i32* %a, align 1
call void @z(i32 %aa)
ret void
}
declare void @z(i32)
; Test2
; Different alignemnt privatizable arguments
define internal i32 @test(i32* %X, i64* %Y) {
; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@test
; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] {
; IS__CGSCC____-NEXT: br label [[RETURN1:%.*]]
; IS__CGSCC____: Return1:
; IS__CGSCC____-NEXT: ret i32 undef
; IS__CGSCC____: Return2:
; IS__CGSCC____-NEXT: unreachable
;
%A = load i32, i32* %X
%B = load i64, i64* %Y
%C = add i32 %A, 1
%D = add i64 %B, 1
%cond = icmp sgt i64 %D, -1
br i1 %cond, label %Return1, label %Return2
Return1:
ret i32 %C
Return2:
ret i32 %A
}
define internal i32 @caller(i32* %A) {
; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@caller
; IS__CGSCC____-SAME: () #[[ATTR0]] {
; IS__CGSCC____-NEXT: [[B:%.*]] = alloca i64, align 8
; IS__CGSCC____-NEXT: ret i32 undef
;
%B = alloca i64
store i64 1, i64* %B
%C = call i32 @test(i32* %A, i64* %B)
ret i32 %C
}
define i32 @callercaller() {
; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; CHECK-LABEL: define {{[^@]+}}@callercaller
; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
; CHECK-NEXT: ret i32 3
;
%B = alloca i32
store i32 2, i32* %B
%X = call i32 @caller(i32* %B)
ret i32 %X
}
;.
; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
;.