1RUN: llvm-opt-report -r %p %p/Inputs/or.yaml | FileCheck -strict-whitespace %s
2RUN: llvm-opt-report -s -r %p %p/Inputs/or.yaml | FileCheck -strict-whitespace -check-prefix=CHECK-SUCCINCT %s
3
4; CHECK: < {{.*[/\]}}or.c
5; CHECK-NEXT:  1          | void bar();
6; CHECK-NEXT:  2          | void foo() { bar(); }
7; CHECK-NEXT:  3          |
8; CHECK-NEXT:  4          | #include "or.h"
9; CHECK-NEXT:  5          |
10; CHECK-NEXT:  6          | void Test(int *res, int *c, int *d, int *p, int n) {
11; CHECK-NEXT:  7          |   int i;
12; CHECK-NEXT:  8          |
13; CHECK-NEXT:  9          | #pragma clang loop vectorize(assume_safety)
14; CHECK-NEXT: 10     V4,2 |   for (i = 0; i < 1600; i++) {
15; CHECK-NEXT: 11          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
16; CHECK-NEXT: 12          |   }
17; CHECK-NEXT: 13          |
18; CHECK-NEXT: 14  U16     |   for (i = 0; i < 16; i++) {
19; CHECK-NEXT: 15          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
20; CHECK-NEXT: 16          |   }
21; CHECK-NEXT: 17          |
22; CHECK-NEXT: 18 I        |   foo();
23; CHECK-NEXT: 19          |
24; CHECK-NEXT: 20          |   foo(); bar(); foo();
25; CHECK-NEXT:    I        |   ^
26; CHECK-NEXT:    I        |                 ^
27; CHECK-NEXT: 21          | }
28; CHECK-NEXT: 22          |
29
30; CHECK: < {{.*[/\]}}or.h
31; CHECK-NEXT:  1          | void TestH(int *res, int *c, int *d, int *p, int n) {
32; CHECK-NEXT:  2          |   int i;
33; CHECK-NEXT:  3          |
34; CHECK-NEXT:  4          | #pragma clang loop vectorize(assume_safety)
35; CHECK-NEXT:  5     V4,2 |   for (i = 0; i < 1600; i++) {
36; CHECK-NEXT:  6          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
37; CHECK-NEXT:  7          |   }
38; CHECK-NEXT:  8          |
39; CHECK-NEXT:  9  U16     |   for (i = 0; i < 16; i++) {
40; CHECK-NEXT: 10          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
41; CHECK-NEXT: 11          |   }
42; CHECK-NEXT: 12          |
43; CHECK-NEXT: 13 I        |   foo();
44; CHECK-NEXT: 14          |
45; CHECK-NEXT: 15          |   foo(); bar(); foo();
46; CHECK-NEXT:    I        |   ^
47; CHECK-NEXT:    I        |                 ^
48; CHECK-NEXT: 16          | }
49; CHECK-NEXT: 17          |
50
51; CHECK-SUCCINCT: < {{.*[/\]}}or.c
52; CHECK-SUCCINCT-NEXT:  1     | void bar();
53; CHECK-SUCCINCT-NEXT:  2     | void foo() { bar(); }
54; CHECK-SUCCINCT-NEXT:  3     |
55; CHECK-SUCCINCT-NEXT:  4     | #include "or.h"
56; CHECK-SUCCINCT-NEXT:  5     |
57; CHECK-SUCCINCT-NEXT:  6     | void Test(int *res, int *c, int *d, int *p, int n) {
58; CHECK-SUCCINCT-NEXT:  7     |   int i;
59; CHECK-SUCCINCT-NEXT:  8     |
60; CHECK-SUCCINCT-NEXT:  9     | #pragma clang loop vectorize(assume_safety)
61; CHECK-SUCCINCT-NEXT: 10   V |   for (i = 0; i < 1600; i++) {
62; CHECK-SUCCINCT-NEXT: 11     |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
63; CHECK-SUCCINCT-NEXT: 12     |   }
64; CHECK-SUCCINCT-NEXT: 13     |
65; CHECK-SUCCINCT-NEXT: 14  U  |   for (i = 0; i < 16; i++) {
66; CHECK-SUCCINCT-NEXT: 15     |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
67; CHECK-SUCCINCT-NEXT: 16     |   }
68; CHECK-SUCCINCT-NEXT: 17     |
69; CHECK-SUCCINCT-NEXT: 18 I   |   foo();
70; CHECK-SUCCINCT-NEXT: 19     |
71; CHECK-SUCCINCT-NEXT: 20     |   foo(); bar(); foo();
72; CHECK-SUCCINCT-NEXT:    I   |   ^
73; CHECK-SUCCINCT-NEXT:    I   |                 ^
74; CHECK-SUCCINCT-NEXT: 21     | }
75; CHECK-SUCCINCT-NEXT: 22     |
76
77CHECK-SUCCINCT: < {{.*[/\]}}or.h
78; CHECK-SUCCINCT-NEXT:  1     | void TestH(int *res, int *c, int *d, int *p, int n) {
79; CHECK-SUCCINCT-NEXT:  2     |   int i;
80; CHECK-SUCCINCT-NEXT:  3     |
81; CHECK-SUCCINCT-NEXT:  4     | #pragma clang loop vectorize(assume_safety)
82; CHECK-SUCCINCT-NEXT:  5   V |   for (i = 0; i < 1600; i++) {
83; CHECK-SUCCINCT-NEXT:  6     |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
84; CHECK-SUCCINCT-NEXT:  7     |   }
85; CHECK-SUCCINCT-NEXT:  8     |
86; CHECK-SUCCINCT-NEXT:  9  U  |   for (i = 0; i < 16; i++) {
87; CHECK-SUCCINCT-NEXT: 10     |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
88; CHECK-SUCCINCT-NEXT: 11     |   }
89; CHECK-SUCCINCT-NEXT: 12     |
90; CHECK-SUCCINCT-NEXT: 13 I   |   foo();
91; CHECK-SUCCINCT-NEXT: 14     |
92; CHECK-SUCCINCT-NEXT: 15     |   foo(); bar(); foo();
93; CHECK-SUCCINCT-NEXT:    I   |   ^
94; CHECK-SUCCINCT-NEXT:    I   |                 ^
95; CHECK-SUCCINCT-NEXT: 16     | }
96; CHECK-SUCCINCT-NEXT: 17     |
97
98