2 ; RUN: opt < %s -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
5 ; RUN: opt < %s -passes=newgvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \
6 ; RUN: 2>&1 | FileCheck %s
7 ; RUN: cat %t | FileCheck -check-prefix=YAML %s
10 ; CHECK: remark: <unknown>:0:0: load of type i32 eliminated{{$}}
11 ; CHECK-NEXT: remark: <unknown>:0:0: load of type i32 eliminated{{$}}
12 ; CHECK-NEXT: remark: <unknown>:0:0: load of type i32 eliminated{{$}}
16 ; YAML-NEXT: Pass: gvn
17 ; YAML-NEXT: Name: LoadElim
18 ; YAML-NEXT: Function: arg
20 ; YAML-NEXT: - String: 'load of type '
21 ; YAML-NEXT: - Type: i32
22 ; YAML-NEXT: - String: ' eliminated'
23 ; YAML-NEXT: - String: ' in favor of '
24 ; YAML-NEXT: - InfavorOfValue: i
26 ; YAML-NEXT: --- !Passed
27 ; YAML-NEXT: Pass: gvn
28 ; YAML-NEXT: Name: LoadElim
29 ; YAML-NEXT: Function: const
31 ; YAML-NEXT: - String: 'load of type '
32 ; YAML-NEXT: - Type: i32
33 ; YAML-NEXT: - String: ' eliminated'
34 ; YAML-NEXT: - String: ' in favor of '
35 ; YAML-NEXT: - InfavorOfValue: '4'
37 ; YAML-NEXT: --- !Passed
38 ; YAML-NEXT: Pass: gvn
39 ; YAML-NEXT: Name: LoadElim
40 ; YAML-NEXT: Function: inst
42 ; YAML-NEXT: - String: 'load of type '
43 ; YAML-NEXT: - Type: i32
44 ; YAML-NEXT: - String: ' eliminated'
45 ; YAML-NEXT: - String: ' in favor of '
46 ; YAML-NEXT: - InfavorOfValue: load
48 ; YAML-NEXT: --- !Missed
49 ; YAML-NEXT: Pass: gvn
50 ; YAML-NEXT: Name: LoadClobbered
51 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 3 }
52 ; YAML-NEXT: Function: may_alias
54 ; YAML-NEXT: - String: 'load of type '
55 ; YAML-NEXT: - Type: i32
56 ; YAML-NEXT: - String: ' not eliminated'
57 ; YAML-NEXT: - String: ' in favor of '
58 ; YAML-NEXT: - OtherAccess: load
59 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 13 }
60 ; YAML-NEXT: - String: ' because it is clobbered by '
61 ; YAML-NEXT: - ClobberedBy: store
62 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 2, Column: 10 }
65 define i32 @arg(i32* %p, i32 %i) {
68 %load = load i32, i32* %p
72 define i32 @const(i32* %p) {
75 %load = load i32, i32* %p
79 define i32 @inst(i32* %p) {
81 %load1 = load i32, i32* %p
82 %load = load i32, i32* %p
83 %add = add i32 %load1, %load
87 define i32 @may_alias(i32* %p, i32* %r) !dbg !7 {
89 %load1 = load i32, i32* %p, !tbaa !13, !dbg !9
90 store i32 4, i32* %r, !tbaa !13, !dbg !10
91 %load = load i32, i32* %p, !tbaa !13, !dbg !11
92 %add = add i32 %load1, %load
96 !llvm.module.flags = !{!3, !4, !5}
99 !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)
100 !1 = !DIFile(filename: "/tmp/s.c", directory: "/tmp")
102 !3 = !{i32 2, !"Dwarf Version", i32 4}
103 !4 = !{i32 2, !"Debug Info Version", i32 3}
104 !5 = !{i32 1, !"PIC Level", i32 2}
105 !6 = !{!"clang version 4.0.0 (trunk 282540) (llvm/trunk 282542)"}
106 !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)
107 !8 = !DISubroutineType(types: !2)
108 !9 = !DILocation(line: 1, column: 13, scope: !7)
109 !10 = !DILocation(line: 2, column: 10, scope: !7)
110 !11 = !DILocation(line: 3, column: 3, scope: !7)
112 !12 = !{ !"tbaa root" }
113 !13 = !{ !"int", !12 }