2 ; RUN: opt < %s -passes=newgvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \
3 ; RUN: 2>&1 | FileCheck %s
4 ; RUN: cat %t | FileCheck -check-prefix=YAML %s
7 ; CHECK: remark: <unknown>:0:0: load of type i32 eliminated{{$}}
8 ; CHECK-NEXT: remark: <unknown>:0:0: load of type i32 eliminated{{$}}
9 ; CHECK-NEXT: remark: <unknown>:0:0: load of type i32 eliminated{{$}}
13 ; YAML-NEXT: Pass: gvn
14 ; YAML-NEXT: Name: LoadElim
15 ; YAML-NEXT: Function: arg
17 ; YAML-NEXT: - String: 'load of type '
18 ; YAML-NEXT: - Type: i32
19 ; YAML-NEXT: - String: ' eliminated'
20 ; YAML-NEXT: - String: ' in favor of '
21 ; YAML-NEXT: - InfavorOfValue: i
23 ; YAML-NEXT: --- !Passed
24 ; YAML-NEXT: Pass: gvn
25 ; YAML-NEXT: Name: LoadElim
26 ; YAML-NEXT: Function: const
28 ; YAML-NEXT: - String: 'load of type '
29 ; YAML-NEXT: - Type: i32
30 ; YAML-NEXT: - String: ' eliminated'
31 ; YAML-NEXT: - String: ' in favor of '
32 ; YAML-NEXT: - InfavorOfValue: '4'
34 ; YAML-NEXT: --- !Passed
35 ; YAML-NEXT: Pass: gvn
36 ; YAML-NEXT: Name: LoadElim
37 ; YAML-NEXT: Function: inst
39 ; YAML-NEXT: - String: 'load of type '
40 ; YAML-NEXT: - Type: i32
41 ; YAML-NEXT: - String: ' eliminated'
42 ; YAML-NEXT: - String: ' in favor of '
43 ; YAML-NEXT: - InfavorOfValue: load
45 ; YAML-NEXT: --- !Missed
46 ; YAML-NEXT: Pass: gvn
47 ; YAML-NEXT: Name: LoadClobbered
48 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 3 }
49 ; YAML-NEXT: Function: may_alias
51 ; YAML-NEXT: - String: 'load of type '
52 ; YAML-NEXT: - Type: i32
53 ; YAML-NEXT: - String: ' not eliminated'
54 ; YAML-NEXT: - String: ' in favor of '
55 ; YAML-NEXT: - OtherAccess: load
56 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 13 }
57 ; YAML-NEXT: - String: ' because it is clobbered by '
58 ; YAML-NEXT: - ClobberedBy: store
59 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 2, Column: 10 }
62 define i32 @arg(ptr %p, i32 %i) {
65 %load = load i32, ptr %p
69 define i32 @const(ptr %p) {
72 %load = load i32, ptr %p
76 define i32 @inst(ptr %p) {
78 %load1 = load i32, ptr %p
79 %load = load i32, ptr %p
80 %add = add i32 %load1, %load
84 define i32 @may_alias(ptr %p, ptr %r) !dbg !7 {
86 %load1 = load i32, ptr %p, !tbaa !13, !dbg !9
87 store i32 4, ptr %r, !tbaa !13, !dbg !10
88 %load = load i32, ptr %p, !tbaa !13, !dbg !11
89 %add = add i32 %load1, %load
93 !llvm.module.flags = !{!3, !4, !5}
96 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 282540) (llvm/trunk 282542)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
97 !1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")
99 !3 = !{i32 2, !"Dwarf Version", i32 4}
100 !4 = !{i32 2, !"Debug Info Version", i32 3}
101 !5 = !{i32 1, !"PIC Level", i32 2}
102 !6 = !{!"clang version 4.0.0 (trunk 282540) (llvm/trunk 282542)"}
103 !7 = distinct !DISubprogram(name: "may_alias", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
104 !8 = !DISubroutineType(types: !2)
105 !9 = !DILocation(line: 1, column: 13, scope: !7)
106 !10 = !DILocation(line: 2, column: 10, scope: !7)
107 !11 = !DILocation(line: 3, column: 3, scope: !7)
109 !12 = !{ !"tbaa root" }
110 !13 = !{ !"int", !12 }