diff options
author | Hal Finkel <hfinkel@anl.gov> | 2016-10-06 11:58:52 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2016-10-06 11:58:52 +0000 |
commit | 4d6f3088c328c19e6ed122cc02f92f23fbe5e52d (patch) | |
tree | 66116aeaace3a4044bc0dd49c30ecb03954ecdc6 | |
parent | 6341e46cd1a0383a4511f541b2ae62949aaf5c31 (diff) | |
download | bcm5719-llvm-4d6f3088c328c19e6ed122cc02f92f23fbe5e52d.tar.gz bcm5719-llvm-4d6f3088c328c19e6ed122cc02f92f23fbe5e52d.zip |
[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).
llvm-svn: 283443
-rw-r--r-- | llvm/test/tools/llvm-opt-report/Inputs/sr2.c | 35 | ||||
-rw-r--r-- | llvm/test/tools/llvm-opt-report/Inputs/sr2.yaml | 24 | ||||
-rw-r--r-- | llvm/test/tools/llvm-opt-report/mlineopt.test | 39 | ||||
-rw-r--r-- | llvm/tools/llvm-opt-report/OptReport.cpp | 21 |
4 files changed, 106 insertions, 13 deletions
diff --git a/llvm/test/tools/llvm-opt-report/Inputs/sr2.c b/llvm/test/tools/llvm-opt-report/Inputs/sr2.c new file mode 100644 index 00000000000..79ee519e67f --- /dev/null +++ b/llvm/test/tools/llvm-opt-report/Inputs/sr2.c @@ -0,0 +1,35 @@ +/* +** Write a 64-bit variable-length integer to memory starting at p[0]. +** The length of data write will be between 1 and 9 bytes. The number +** of bytes written is returned. +** +** A variable-length integer consists of the lower 7 bits of each byte +** for all bytes that have the 8th bit set and one byte with the 8th +** bit clear. Except, if we get to the 9th byte, it stores the full +** 8 bits and is the last byte. +*/ +SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){ + int i, j, n; + u8 buf[10]; + if( v & (((u64)0xff000000)<<32) ){ + p[8] = v; + v >>= 8; + for(i=7; i>=0; i--){ + p[i] = (v & 0x7f) | 0x80; + v >>= 7; + } + return 9; + } + n = 0; + do{ + buf[n++] = (v & 0x7f) | 0x80; + v >>= 7; + }while( v!=0 ); + buf[0] &= 0x7f; + assert( n<=9 ); + for(i=0, j=n-1; j>=0; j--, i++){ + p[i] = buf[j]; + } + return n; +} + diff --git a/llvm/test/tools/llvm-opt-report/Inputs/sr2.yaml b/llvm/test/tools/llvm-opt-report/Inputs/sr2.yaml new file mode 100644 index 00000000000..9adac4daead --- /dev/null +++ b/llvm/test/tools/llvm-opt-report/Inputs/sr2.yaml @@ -0,0 +1,24 @@ +--- !Passed +Pass: loop-vectorize +Name: Vectorized +DebugLoc: { File: Inputs/sr2.c, + Line: 30, Column: 3 } +Function: sqlite3VdbeExec +Args: + - String: 'vectorized loop (vectorization width: ' + - VectorizationFactor: '16' + - String: ', interleaved count: ' + - InterleaveCount: '2' + - String: ')' +... +--- !Passed +Pass: loop-unroll +Name: PartialUnrolled +DebugLoc: { File: Inputs/sr2.c, + Line: 30, Column: 3 } +Function: sqlite3VdbeExec +Args: + - String: 'unrolled loop by a factor of ' + - UnrollCount: '2' + - String: ' with run-time trip count' +... diff --git a/llvm/test/tools/llvm-opt-report/mlineopt.test b/llvm/test/tools/llvm-opt-report/mlineopt.test new file mode 100644 index 00000000000..808380dead5 --- /dev/null +++ b/llvm/test/tools/llvm-opt-report/mlineopt.test @@ -0,0 +1,39 @@ +RUN: llvm-opt-report -r %p %p/Inputs/sr2.yaml | FileCheck -strict-whitespace %s + +; CHECK: < {{.*[/\]}}sr2.c +; CHECK-NEXT: 1 | /* +; CHECK-NEXT: 2 | ** Write a 64-bit variable-length integer to memory starting at p[0]. +; CHECK-NEXT: 3 | ** The length of data write will be between 1 and 9 bytes. The number +; CHECK-NEXT: 4 | ** of bytes written is returned. +; CHECK-NEXT: 5 | ** +; CHECK-NEXT: 6 | ** A variable-length integer consists of the lower 7 bits of each byte +; CHECK-NEXT: 7 | ** for all bytes that have the 8th bit set and one byte with the 8th +; CHECK-NEXT: 8 | ** bit clear. Except, if we get to the 9th byte, it stores the full +; CHECK-NEXT: 9 | ** 8 bits and is the last byte. +; CHECK-NEXT: 10 | */ +; CHECK-NEXT: 11 | SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){ +; CHECK-NEXT: 12 | int i, j, n; +; CHECK-NEXT: 13 | u8 buf[10]; +; CHECK-NEXT: 14 | if( v & (((u64)0xff000000)<<32) ){ +; CHECK-NEXT: 15 | p[8] = v; +; CHECK-NEXT: 16 | v >>= 8; +; CHECK-NEXT: 17 | for(i=7; i>=0; i--){ +; CHECK-NEXT: 18 | p[i] = (v & 0x7f) | 0x80; +; CHECK-NEXT: 19 | v >>= 7; +; CHECK-NEXT: 20 | } +; CHECK-NEXT: 21 | return 9; +; CHECK-NEXT: 22 | } +; CHECK-NEXT: 23 | n = 0; +; CHECK-NEXT: 24 | do{ +; CHECK-NEXT: 25 | buf[n++] = (v & 0x7f) | 0x80; +; CHECK-NEXT: 26 | v >>= 7; +; CHECK-NEXT: 27 | }while( v!=0 ); +; CHECK-NEXT: 28 | buf[0] &= 0x7f; +; CHECK-NEXT: 29 | assert( n<=9 ); +; CHECK-NEXT: 30 U2V16,2 | for(i=0, j=n-1; j>=0; j--, i++){ +; CHECK-NEXT: 31 | p[i] = buf[j]; +; CHECK-NEXT: 32 | } +; CHECK-NEXT: 33 | return n; +; CHECK-NEXT: 34 | } +; CHECK-NEXT: 35 | + diff --git a/llvm/tools/llvm-opt-report/OptReport.cpp b/llvm/tools/llvm-opt-report/OptReport.cpp index 49fbbd17bec..e9ab3fa2984 100644 --- a/llvm/tools/llvm-opt-report/OptReport.cpp +++ b/llvm/tools/llvm-opt-report/OptReport.cpp @@ -248,29 +248,24 @@ static void collectLocationInfo(yaml::Stream &Stream, // We track information on both actual and potential transformations. This // way, if there are multiple possible things on a line that are, or could // have been transformed, we can indicate that explicitly in the output. - auto UpdateLLII = [Transformed, VectorizationFactor, - InterleaveCount, - UnrollCount](OptReportLocationInfo &LI, - OptReportLocationItemInfo &LLII) { + auto UpdateLLII = [Transformed](OptReportLocationItemInfo &LLII) { LLII.Analyzed = true; - if (Transformed) { + if (Transformed) LLII.Transformed = true; - - LI.VectorizationFactor = VectorizationFactor; - LI.InterleaveCount = InterleaveCount; - LI.UnrollCount = UnrollCount; - } }; if (Pass == "inline") { auto &LI = LocationInfo[File][Line][Function][Column]; - UpdateLLII(LI, LI.Inlined); + UpdateLLII(LI.Inlined); } else if (Pass == "loop-unroll") { auto &LI = LocationInfo[File][Line][Function][Column]; - UpdateLLII(LI, LI.Unrolled); + LI.UnrollCount = UnrollCount; + UpdateLLII(LI.Unrolled); } else if (Pass == "loop-vectorize") { auto &LI = LocationInfo[File][Line][Function][Column]; - UpdateLLII(LI, LI.Vectorized); + LI.VectorizationFactor = VectorizationFactor; + LI.InterleaveCount = InterleaveCount; + UpdateLLII(LI.Vectorized); } } } |