llvm.org GIT mirror llvm / 7b08fb4
[llvm-opt-report] Record VF, etc. correctly for multiple opts on one line When there are multiple optimizations on one line, record the vectorization factors, etc. correctly (instead of incorrectly substituting default values). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283443 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 2 years ago
4 changed file(s) with 106 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
0 /*
1 ** Write a 64-bit variable-length integer to memory starting at p[0].
2 ** The length of data write will be between 1 and 9 bytes. The number
3 ** of bytes written is returned.
4 **
5 ** A variable-length integer consists of the lower 7 bits of each byte
6 ** for all bytes that have the 8th bit set and one byte with the 8th
7 ** bit clear. Except, if we get to the 9th byte, it stores the full
8 ** 8 bits and is the last byte.
9 */
10 SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){
11 int i, j, n;
12 u8 buf[10];
13 if( v & (((u64)0xff000000)<<32) ){
14 p[8] = v;
15 v >>= 8;
16 for(i=7; i>=0; i--){
17 p[i] = (v & 0x7f) | 0x80;
18 v >>= 7;
19 }
20 return 9;
21 }
22 n = 0;
23 do{
24 buf[n++] = (v & 0x7f) | 0x80;
25 v >>= 7;
26 }while( v!=0 );
27 buf[0] &= 0x7f;
28 assert( n<=9 );
29 for(i=0, j=n-1; j>=0; j--, i++){
30 p[i] = buf[j];
31 }
32 return n;
33 }
34
0 --- !Passed
1 Pass: loop-vectorize
2 Name: Vectorized
3 DebugLoc: { File: Inputs/sr2.c,
4 Line: 30, Column: 3 }
5 Function: sqlite3VdbeExec
6 Args:
7 - String: 'vectorized loop (vectorization width: '
8 - VectorizationFactor: '16'
9 - String: ', interleaved count: '
10 - InterleaveCount: '2'
11 - String: ')'
12 ...
13 --- !Passed
14 Pass: loop-unroll
15 Name: PartialUnrolled
16 DebugLoc: { File: Inputs/sr2.c,
17 Line: 30, Column: 3 }
18 Function: sqlite3VdbeExec
19 Args:
20 - String: 'unrolled loop by a factor of '
21 - UnrollCount: '2'
22 - String: ' with run-time trip count'
23 ...
0 RUN: llvm-opt-report -r %p %p/Inputs/sr2.yaml | FileCheck -strict-whitespace %s
1
2 ; CHECK: < {{.*[/\]}}sr2.c
3 ; CHECK-NEXT: 1 | /*
4 ; CHECK-NEXT: 2 | ** Write a 64-bit variable-length integer to memory starting at p[0].
5 ; CHECK-NEXT: 3 | ** The length of data write will be between 1 and 9 bytes. The number
6 ; CHECK-NEXT: 4 | ** of bytes written is returned.
7 ; CHECK-NEXT: 5 | **
8 ; CHECK-NEXT: 6 | ** A variable-length integer consists of the lower 7 bits of each byte
9 ; CHECK-NEXT: 7 | ** for all bytes that have the 8th bit set and one byte with the 8th
10 ; CHECK-NEXT: 8 | ** bit clear. Except, if we get to the 9th byte, it stores the full
11 ; CHECK-NEXT: 9 | ** 8 bits and is the last byte.
12 ; CHECK-NEXT: 10 | */
13 ; CHECK-NEXT: 11 | SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){
14 ; CHECK-NEXT: 12 | int i, j, n;
15 ; CHECK-NEXT: 13 | u8 buf[10];
16 ; CHECK-NEXT: 14 | if( v & (((u64)0xff000000)<<32) ){
17 ; CHECK-NEXT: 15 | p[8] = v;
18 ; CHECK-NEXT: 16 | v >>= 8;
19 ; CHECK-NEXT: 17 | for(i=7; i>=0; i--){
20 ; CHECK-NEXT: 18 | p[i] = (v & 0x7f) | 0x80;
21 ; CHECK-NEXT: 19 | v >>= 7;
22 ; CHECK-NEXT: 20 | }
23 ; CHECK-NEXT: 21 | return 9;
24 ; CHECK-NEXT: 22 | }
25 ; CHECK-NEXT: 23 | n = 0;
26 ; CHECK-NEXT: 24 | do{
27 ; CHECK-NEXT: 25 | buf[n++] = (v & 0x7f) | 0x80;
28 ; CHECK-NEXT: 26 | v >>= 7;
29 ; CHECK-NEXT: 27 | }while( v!=0 );
30 ; CHECK-NEXT: 28 | buf[0] &= 0x7f;
31 ; CHECK-NEXT: 29 | assert( n<=9 );
32 ; CHECK-NEXT: 30 U2V16,2 | for(i=0, j=n-1; j>=0; j--, i++){
33 ; CHECK-NEXT: 31 | p[i] = buf[j];
34 ; CHECK-NEXT: 32 | }
35 ; CHECK-NEXT: 33 | return n;
36 ; CHECK-NEXT: 34 | }
37 ; CHECK-NEXT: 35 |
38
247247 // We track information on both actual and potential transformations. This
248248 // way, if there are multiple possible things on a line that are, or could
249249 // have been transformed, we can indicate that explicitly in the output.
250 auto UpdateLLII = [Transformed, VectorizationFactor,
251 InterleaveCount,
252 UnrollCount](OptReportLocationInfo &LI,
253 OptReportLocationItemInfo &LLII) {
250 auto UpdateLLII = [Transformed](OptReportLocationItemInfo &LLII) {
254251 LLII.Analyzed = true;
255 if (Transformed) {
252 if (Transformed)
256253 LLII.Transformed = true;
257
258 LI.VectorizationFactor = VectorizationFactor;
259 LI.InterleaveCount = InterleaveCount;
260 LI.UnrollCount = UnrollCount;
261 }
262254 };
263255
264256 if (Pass == "inline") {
265257 auto &LI = LocationInfo[File][Line][Function][Column];
266 UpdateLLII(LI, LI.Inlined);
258 UpdateLLII(LI.Inlined);
267259 } else if (Pass == "loop-unroll") {
268260 auto &LI = LocationInfo[File][Line][Function][Column];
269 UpdateLLII(LI, LI.Unrolled);
261 LI.UnrollCount = UnrollCount;
262 UpdateLLII(LI.Unrolled);
270263 } else if (Pass == "loop-vectorize") {
271264 auto &LI = LocationInfo[File][Line][Function][Column];
272 UpdateLLII(LI, LI.Vectorized);
265 LI.VectorizationFactor = VectorizationFactor;
266 LI.InterleaveCount = InterleaveCount;
267 UpdateLLII(LI.Vectorized);
273268 }
274269 }
275270 }