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,10 +10,18 @@ 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
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]]
16
25
;
17
26
%v1 = load i8 , ptr %p
18
27
%obj = call ptr @malloc (i64 16 )
@@ -23,10 +32,18 @@ define i8 @test_malloc(ptr %p) {
23
32
}
24
33
25
34
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
35
+ ; MDEP-LABEL: @test_calloc(
36
+ ; MDEP-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
37
+ ; MDEP-NEXT: call void @escape(ptr [[OBJ]])
38
+ ; MDEP-NEXT: ret i8 0
39
+ ;
40
+ ; MSSA-LABEL: @test_calloc(
41
+ ; MSSA-NEXT: [[V1:%.*]] = load i8, ptr [[P:%.*]], align 1
42
+ ; MSSA-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
43
+ ; MSSA-NEXT: [[V2:%.*]] = load i8, ptr [[P]], align 1
44
+ ; MSSA-NEXT: [[SUB:%.*]] = sub i8 [[V1]], [[V2]]
45
+ ; MSSA-NEXT: call void @escape(ptr [[OBJ]])
46
+ ; MSSA-NEXT: ret i8 [[SUB]]
30
47
;
31
48
%v1 = load i8 , ptr %p
32
49
%obj = call ptr @calloc (i64 1 , i64 16 )
@@ -37,10 +54,18 @@ define i8 @test_calloc(ptr %p) {
37
54
}
38
55
39
56
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
57
+ ; MDEP-LABEL: @test_opnew(
58
+ ; MDEP-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
59
+ ; MDEP-NEXT: call void @escape(ptr [[OBJ]])
60
+ ; MDEP-NEXT: ret i8 0
61
+ ;
62
+ ; MSSA-LABEL: @test_opnew(
63
+ ; MSSA-NEXT: [[V1:%.*]] = load i8, ptr [[P:%.*]], align 1
64
+ ; MSSA-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
65
+ ; MSSA-NEXT: [[V2:%.*]] = load i8, ptr [[P]], align 1
66
+ ; MSSA-NEXT: [[SUB:%.*]] = sub i8 [[V1]], [[V2]]
67
+ ; MSSA-NEXT: call void @escape(ptr [[OBJ]])
68
+ ; MSSA-NEXT: ret i8 [[SUB]]
44
69
;
45
70
%v1 = load i8 , ptr %p
46
71
%obj = call ptr @_Znwm (i64 16 )
@@ -49,5 +74,5 @@ define i8 @test_opnew(ptr %p) {
49
74
call void @escape (ptr %obj )
50
75
ret i8 %sub
51
76
}
52
-
53
-
77
+ ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
78
+ ; CHECK: {{.*}}
0 commit comments