llvm-project/clang/test
Kito Cheng 7a5cb15ea6 [RISCV] Lazily add RVV C intrinsics.
Leverage the method OpenCL uses that adds C intrinsics when the lookup
failed. There is no need to define C intrinsics in the header file any
more. It could help to avoid the large header file to speed up the
compilation of RVV source code. Besides that, only the C intrinsics used
by the users will be added into the declaration table.

This patch is based on https://reviews.llvm.org/D103228 and inspired by
OpenCL implementation.

### Experimental Results

#### TL;DR:

- Binary size of clang increase ~200k, which is +0.07%  for debug build and +0.13% for release build.
- Single file compilation speed up ~33x for debug build and ~8.5x for release build
- Regression time reduce ~10% (`ninja check-all`, enable all targets)

#### Header size change
```
       |      size |     LoC |
------------------------------
Before | 4,434,725 |  69,749 |
After  |     6,140 |     162 |
```

#### Single File Compilation Time
Testcase:
```
#include <riscv_vector.h>

vint32m1_t test_vadd_vv_vfloat32m1_t(vint32m1_t op1, vint32m1_t op2, size_t vl) {
  return vadd(op1, op2, vl);
}
```
##### Debug build:
Before:
```
real    0m19.352s
user    0m19.252s
sys     0m0.092s
```

After:
```
real    0m0.576s
user    0m0.552s
sys     0m0.024s
```

~33x speed up for debug build

##### Release build:
Before:
```
real    0m0.773s
user    0m0.741s
sys     0m0.032s
```

After:
```
real    0m0.092s
user    0m0.080s
sys     0m0.012s
```

~8.5x speed up for release build

#### Regression time
Note: the failed case is `tools/llvm-debuginfod-find/debuginfod.test` which is unrelated to this patch.

##### Debug build
Before:
```
Testing Time: 1358.38s
  Skipped          :    11
  Unsupported      :   446
  Passed           : 75767
  Expectedly Failed:   190
  Failed           :     1
```
After
```
Testing Time: 1220.29s
  Skipped          :    11
  Unsupported      :   446
  Passed           : 75767
  Expectedly Failed:   190
  Failed           :     1
```
##### Release build
Before:
```
Testing Time: 381.98s
  Skipped          :    12
  Unsupported      :  1407
  Passed           : 74765
  Expectedly Failed:   176
  Failed           :     1
```
After:
```
Testing Time: 346.25s
  Skipped          :    12
  Unsupported      :  1407
  Passed           : 74765
  Expectedly Failed:   176
  Failed           :     1
```

#### Binary size of clang

##### Debug build
Before
```
   text    data     bss     dec     hex filename
335261851       12726004         552812 348540667       14c64efb        bin/clang
```
After
```
   text    data     bss     dec     hex filename
335442803       12798708         552940 348794451       14ca2e53        bin/clang
```
+253K, +0.07% code size

##### Release build
Before
```
   text    data     bss     dec     hex filename
144123975       8374648  483140 152981763       91e5103 bin/clang
```
After
```
   text    data     bss     dec     hex filename
144255762       8447296  483268 153186326       9217016 bin/clang
```
+204K, +0.13%

Authored-by: Kito Cheng <kito.cheng@sifive.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Reviewed By: khchen, aaron.ballman

Differential Revision: https://reviews.llvm.org/D111617
2022-07-26 15:47:47 +08:00
..
APINotes
ARCMT
AST re-land [C++20][Modules] Update handling of implicit inlines [P1779R3] 2022-07-21 09:17:01 +01:00
ASTMerge
Analysis [analyzer] Lambda capture non-POD type array 2022-07-26 09:40:25 +02:00
C/drs Rewording "static_assert" diagnostics 2022-07-25 07:22:54 -04:00
CXX [C++20][Modules] Update ADL to handle basic.lookup.argdep p4 [P1815R2 part 1] 2022-07-25 14:28:59 +01:00
ClangScanDeps [clang][deps] Fix handling of -MT in module command-line 2022-07-13 13:36:15 -07:00
CodeCompletion
CodeGen [Passes] add a tail-call-elim pass near the end of the opt pipeline 2022-07-25 15:25:47 -04:00
CodeGenCUDA [CUDA][FIX] Make shfl[_sync] for unsigned long long non-recursive 2022-07-21 12:36:54 -05:00
CodeGenCUDASPIRV [CUDA/SPIR-V] Force passing aggregate type byval 2022-07-22 20:30:15 +00:00
CodeGenCXX [Clang] Fix how we set the NumPositiveBits on an EnumDecl to cover the case of single enumerator with value zero or an empty enum 2022-07-25 16:01:01 -07:00
CodeGenCoroutines [coroutine] add nomerge function attribute to `llvm.coro.save` 2022-07-12 10:39:38 -07:00
CodeGenHIP
CodeGenHLSL [HLSL] Enable half type for hlsl. 2022-06-23 12:56:26 -07:00
CodeGenObjC Fix crash in ObjC codegen introduced with 5ab6ee7599 2022-07-24 13:59:45 +01:00
CodeGenObjCXX Revert "[SimplifyCFG] Thread branches on same condition in more cases (PR54980)" 2022-07-05 16:57:46 +02:00
CodeGenOpenCL Strengthen -Wint-conversion to default to an error 2022-07-22 15:24:54 -04:00
CodeGenOpenCLCXX
CodeGenSYCL
Coverage
CoverageMapping [clang][NFC] Cleanup some coroutine tests 2022-05-16 05:15:12 -07:00
Driver [Driver] Error for -gsplit-dwarf with RISC-V linker relaxation 2022-07-22 17:16:41 -07:00
ExtractAPI [clang][extract-api] Don't emit symbols prefixed with an underscore 2022-05-25 19:02:18 +01:00
FixIt Strengthen -Wint-conversion to default to an error 2022-07-22 15:24:54 -04:00
Format [clang-format] Fix an assertion failure on -lines=0:n 2022-07-08 23:41:16 -07:00
Frontend [AMDGPU] Add remarks to output some resource usage 2022-07-15 11:01:53 -07:00
Headers Inliner: don't mark call sites as 'nounwind' if that would be redundant 2022-07-20 14:17:23 +02:00
Import
Index [libclang][ObjC] Inherit availability attribute from containing decls or 2022-07-19 09:17:39 -07:00
Integration
InterfaceStubs
Interpreter [CodeGen] Consider MangleCtx when move lazy emission States 2022-07-26 12:34:03 +08:00
Layout Revert "[clang] Implement ElaboratedType sugaring for types written bare" 2022-07-14 21:17:48 -07:00
Lexer [Clang] Add support for Unicode identifiers (UAX31) in C2x mode. 2022-07-23 14:08:08 +02:00
LibClang
Misc Strengthen -Wint-conversion to default to an error 2022-07-22 15:24:54 -04:00
Modules [Sema] Merge C++20 concept definitions from different modules in same TU 2022-07-25 14:43:38 +02:00
OpenMP [clang][OpenMP] Add IRBuilder support for taskgroup 2022-07-21 11:13:57 +05:30
PCH Rewording "static_assert" diagnostics 2022-07-25 07:22:54 -04:00
Parser Rewording "static_assert" diagnostics 2022-07-25 07:22:54 -04:00
ParserHLSL
ParserSYCL
Preprocessor [Clang] Adjust extension warnings for #warning 2022-07-23 14:10:11 +02:00
Profile
Refactor
Rewriter
Sema [RISCV] Lazily add RVV C intrinsics. 2022-07-26 15:47:47 +08:00
SemaCUDA Fix test; we now expect a pedantic warning 2022-05-11 06:52:21 -04:00
SemaCXX Rewording "static_assert" diagnostics 2022-07-25 07:22:54 -04:00
SemaHLSL Revert "[clang] Implement ElaboratedType sugaring for types written bare" 2022-07-14 21:17:48 -07:00
SemaObjC Strengthen -Wint-conversion to default to an error 2022-07-22 15:24:54 -04:00
SemaObjCXX Revert "[clang] Implement ElaboratedType sugaring for types written bare" 2022-07-14 21:17:48 -07:00
SemaOpenCL Strengthen -Wint-conversion to default to an error 2022-07-22 15:24:54 -04:00
SemaOpenCLCXX
SemaSYCL Revert "[clang] Implement ElaboratedType sugaring for types written bare" 2022-07-14 21:17:48 -07:00
SemaTemplate Rewording "static_assert" diagnostics 2022-07-25 07:22:54 -04:00
TableGen
Templight
Tooling Revert "[clang-diff] Fix assertion error when dealing with wide strings" 2022-06-07 14:58:10 -07:00
Unit [lit] Fix setup of sanitizer environment 2022-05-19 19:24:16 -07:00
VFS Strengthen -Wint-conversion to default to an error 2022-07-22 15:24:54 -04:00
clang-rename
utils/update_cc_test_checks update-test-checks: safely handle tests with #if's 2022-07-20 11:23:49 +02:00
.clang-format Disable clang-format entirely for test directories 2022-07-08 07:34:18 -04:00
CMakeLists.txt Revert "[llvm] cmake config groundwork to have ZSTD in LLVM" 2022-07-08 13:48:05 -07:00
TestRunner.sh
lit.cfg.py [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX 2022-07-08 18:33:16 -04:00
lit.site.cfg.py.in Revert "[llvm] cmake config groundwork to have ZSTD in LLVM" 2022-07-08 13:48:05 -07:00