1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=newgvn -S < %s | FileCheck %s
4 define i32 @test1(ptr %p, ptr %q) {
5 ; CHECK-LABEL: define i32 @test1(
6 ; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
7 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !noalias [[META0:![0-9]+]]
8 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
9 ; CHECK-NEXT: ret i32 [[C]]
11 %a = load i32, ptr %p, !noalias !3
17 define i32 @test2(ptr %p, ptr %q) {
18 ; CHECK-LABEL: define i32 @test2(
19 ; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
20 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !alias.scope [[META0]]
21 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
22 ; CHECK-NEXT: ret i32 [[C]]
24 %a = load i32, ptr %p, !alias.scope !3
25 %b = load i32, ptr %p, !alias.scope !3
30 define i32 @test3(ptr %p, ptr %q) {
31 ; CHECK-LABEL: define i32 @test3(
32 ; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
33 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !alias.scope [[META3:![0-9]+]]
34 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
35 ; CHECK-NEXT: ret i32 [[C]]
37 %a = load i32, ptr %p, !alias.scope !4
38 %b = load i32, ptr %p, !alias.scope !5
43 declare i32 @foo(ptr) readonly
45 !0 = distinct !{!0, !2, !"callee0: %a"}
46 !1 = distinct !{!1, !2, !"callee0: %b"}
47 !2 = distinct !{!2, !"callee0"}
53 ; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
54 ; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]], !"callee0: %a"}
55 ; CHECK: [[META2]] = distinct !{[[META2]], !"callee0"}
56 ; CHECK: [[META3]] = !{[[META4:![0-9]+]]}
57 ; CHECK: [[META4]] = distinct !{[[META4]], [[META2]], !"callee0: %b"}