bcardosolopes wrote:

I have some (interesting) updates.

@erichkeane @cor3ntin it happens that CFG skips a lot of things it doesn't need 
 (functions from system headers, Implicitly defined special members, global 
variable initializers, etc). CIRGen currently emit everything needed for LLVM 
IR lowering, which means way more work. However, even though it does more, it 
also misses some, CFG analyze things not emitted by CIRGen too (unused inline 
functions, uncalled lambdas, etc), so this is a gap we need to fix (which means 
even more compile time).

Here's where it gets interesting. Let's assume the baseline is just the CFG, 
forget LLVM IR for now. Take these two new modes:
1.  `-fsyntax-only -fclangir (every body)`: this PR + support for unused inline 
functions, uncalled lambdas, etc.
2. `-fsyntax-only -fclangir (on demand)`: this PR + skips a lot of things 
needed only for LLVM IR + support for unused inline functions, uncalled 
lambdas, etc

I've implemented these two modes (followup 4 and 5). See how (1) increases even 
further compile time but (2) actually beats CFG, while covering things we don't 
currently CIRGen. This is probably the direction we want to: (a) if we are 
looking for analysis only, we do selective CIRGen, or (b) if are looking for 
analysis + llvm we pay the highest price, or (c) we only pay for what we need 
for LLVM IR if no analysis is needed. See table below for reference.

| TU | Pipeline | IR creation (CFG / CIRGen) | -Wreturn-type (N = num threads) |
  |---|---|---:|---|
  | CIRDialect.cpp | `-fsyntax-only` | 152 | 17.3 |
  | | `-fclangir -emit-cir=cirgen` | 1,405 | N=1: 2.7, N=96: 1.8 |
  | | `-fsyntax-only -fclangir (every body)` | 2,414 | N=1: 12.6, N=96: 9.0 |
  | | `-fsyntax-only -fclangir (on demand)` | 121 | N=1: 0.6, N=96: 1.2 |
  | OpenACC.cpp | `-fsyntax-only` | 260 | 21.2 |
  | | `-fclangir -emit-cir=cirgen` | 4,523 | N=1: 12.0, N=96: 6.6 |
  | | `-fsyntax-only -fclangir (every body)` | 3,737 | N=1: 14.6, N=96: 9.1 |
  | | `-fsyntax-only -fclangir (on demand)` | 110 | N=1: 0.4, N=96: 1.3 |
  | SLPVectorizer.cpp | `-fsyntax-only` | 254 | 21.6 |
  | | `-fclangir -emit-cir=cirgen` | 5,434 | N=1: 17.4, N=96: 10.1 |
  | | `-fsyntax-only -fclangir (every body)` | 3,709 | N=1: 17.0, N=96: 9.6 |
  | | `-fsyntax-only -fclangir (on demand)` | 228 | N=1: 1.7, N=96: 0.9 |
  | Disasm.cpp | `-fsyntax-only` | 79 | 8.8 |
  | | `-fclangir -emit-cir=cirgen` | 436 | N=1: 0.6, N=96: 1.1 |
  | | `-fsyntax-only -fclangir (every body)` | 1,273 | N=1: 6.2, N=96: 4.2 |
  | | `-fsyntax-only -fclangir (on demand)` | 88 | N=1: 0.4, N=96: 1.1 |
  | OpenMPDialect.cpp | `-fsyntax-only` | 268 | 24.6 |
  | | `-fclangir -emit-cir=cirgen` | 4,304 | N=1: 11.9, N=96: 4.5 |
  | | `-fsyntax-only -fclangir (every body)` | 3,957 | N=1: 18.5, N=96: 9.8 |
  | | `-fsyntax-only -fclangir (on demand)` | 123 | N=1: 0.5, N=96: 1.4 |

(p.s. @cor3ntin I'll share LLVM IR numbers with you tomorrow)

https://github.com/llvm/llvm-project/pull/239774
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to