1
1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2
- ; RUN: opt < %s -S -passes=gvn 2>&1 | FileCheck %s
2
+ ; RUN: opt < %s -S -passes=gvn 2>&1 | FileCheck %s --check-prefixes=CHECK,MDEP
3
+ ; RUN: opt < %s -S -passes='gvn<memoryssa;no-memdep>' 2>&1 | FileCheck --check-prefixes=CHECK,MSSA %s
3
4
4
5
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
5
6
@@ -9,11 +10,23 @@ declare noalias ptr @_Znwm(i64)
9
10
declare void @escape (ptr )
10
11
11
12
define i8 @test_malloc (ptr %p ) {
12
- ; CHECK -LABEL: @test_malloc(
13
- ; CHECK -NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 16)
14
- ; CHECK -NEXT: call void @escape(ptr [[OBJ]])
15
- ; CHECK -NEXT: ret i8 0
13
+ ; MDEP -LABEL: @test_malloc(
14
+ ; MDEP -NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 16)
15
+ ; MDEP -NEXT: call void @escape(ptr [[OBJ]])
16
+ ; MDEP -NEXT: ret i8 0
16
17
;
18
+ ; MSSA-LABEL: @test_malloc(
19
+ ; MSSA-NEXT: [[V1:%.*]] = load i8, ptr [[P:%.*]], align 1
20
+ ; MSSA-NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 16)
21
+ ; MSSA-NEXT: [[V2:%.*]] = load i8, ptr [[P]], align 1
22
+ ; MSSA-NEXT: [[SUB:%.*]] = sub i8 [[V1]], [[V2]]
23
+ ; MSSA-NEXT: call void @escape(ptr [[OBJ]])
24
+ ; MSSA-NEXT: ret i8 [[SUB]]
25
+ ;
26
+ ; CHECK-MSSA-LABEL: @test_malloc(
27
+ ; CHECK-MSSA-NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 16)
28
+ ; CHECK-MSSA-NEXT: call void @escape(ptr [[OBJ]])
29
+ ; CHECK-MSSA-NEXT: ret i8 0
17
30
%v1 = load i8 , ptr %p
18
31
%obj = call ptr @malloc (i64 16 )
19
32
%v2 = load i8 , ptr %p
@@ -23,11 +36,23 @@ define i8 @test_malloc(ptr %p) {
23
36
}
24
37
25
38
define i8 @test_calloc (ptr %p ) {
26
- ; CHECK-LABEL: @test_calloc(
27
- ; CHECK-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
28
- ; CHECK-NEXT: call void @escape(ptr [[OBJ]])
29
- ; CHECK-NEXT: ret i8 0
39
+ ; MDEP-LABEL: @test_calloc(
40
+ ; MDEP-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
41
+ ; MDEP-NEXT: call void @escape(ptr [[OBJ]])
42
+ ; MDEP-NEXT: ret i8 0
43
+ ;
44
+ ; MSSA-LABEL: @test_calloc(
45
+ ; MSSA-NEXT: [[V1:%.*]] = load i8, ptr [[P:%.*]], align 1
46
+ ; MSSA-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
47
+ ; MSSA-NEXT: [[V2:%.*]] = load i8, ptr [[P]], align 1
48
+ ; MSSA-NEXT: [[SUB:%.*]] = sub i8 [[V1]], [[V2]]
49
+ ; MSSA-NEXT: call void @escape(ptr [[OBJ]])
50
+ ; MSSA-NEXT: ret i8 [[SUB]]
30
51
;
52
+ ; CHECK-MSSA-LABEL: @test_calloc(
53
+ ; CHECK-MSSA-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
54
+ ; CHECK-MSSA-NEXT: call void @escape(ptr [[OBJ]])
55
+ ; CHECK-MSSA-NEXT: ret i8 0
31
56
%v1 = load i8 , ptr %p
32
57
%obj = call ptr @calloc (i64 1 , i64 16 )
33
58
%v2 = load i8 , ptr %p
@@ -37,11 +62,23 @@ define i8 @test_calloc(ptr %p) {
37
62
}
38
63
39
64
define i8 @test_opnew (ptr %p ) {
40
- ; CHECK-LABEL: @test_opnew(
41
- ; CHECK-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
42
- ; CHECK-NEXT: call void @escape(ptr [[OBJ]])
43
- ; CHECK-NEXT: ret i8 0
65
+ ; MDEP-LABEL: @test_opnew(
66
+ ; MDEP-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
67
+ ; MDEP-NEXT: call void @escape(ptr [[OBJ]])
68
+ ; MDEP-NEXT: ret i8 0
69
+ ;
70
+ ; MSSA-LABEL: @test_opnew(
71
+ ; MSSA-NEXT: [[V1:%.*]] = load i8, ptr [[P:%.*]], align 1
72
+ ; MSSA-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
73
+ ; MSSA-NEXT: [[V2:%.*]] = load i8, ptr [[P]], align 1
74
+ ; MSSA-NEXT: [[SUB:%.*]] = sub i8 [[V1]], [[V2]]
75
+ ; MSSA-NEXT: call void @escape(ptr [[OBJ]])
76
+ ; MSSA-NEXT: ret i8 [[SUB]]
44
77
;
78
+ ; CHECK-MSSA-LABEL: @test_opnew(
79
+ ; CHECK-MSSA-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
80
+ ; CHECK-MSSA-NEXT: call void @escape(ptr [[OBJ]])
81
+ ; CHECK-MSSA-NEXT: ret i8 0
45
82
%v1 = load i8 , ptr %p
46
83
%obj = call ptr @_Znwm (i64 16 )
47
84
%v2 = load i8 , ptr %p
@@ -51,3 +88,5 @@ define i8 @test_opnew(ptr %p) {
51
88
}
52
89
53
90
91
+ ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
92
+ ; CHECK: {{.*}}
0 commit comments