[llvm] [TailDuplicator] Do not restrict the computed gotos (PR #114990)

Alexander Kornienko via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 10:24:19 PDT 2025


alexfh wrote:

The test case for compilation time regression. This is only reproducible with `-fPIE` for some reason. It also looks like the time grows superlinearly from the size, so sufficiently large protobuf-generated .cc file can actually compile for hours.

```
$ ./clang-good -O3 -fPIE -c reduced.ll -o /dev/null -ftime-report
...
===-------------------------------------------------------------------------===
                               Clang time report
===-------------------------------------------------------------------------===
  Total Execution Time: 0.8198 seconds (0.8198 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   0.7694 ( 96.3%)   0.0204 ( 99.2%)   0.7898 ( 96.3%)   0.7898 ( 96.3%)  Machine code generation
   0.0181 (  2.3%)   0.0002 (  0.8%)   0.0183 (  2.2%)   0.0183 (  2.2%)  Optimizer
   0.0117 (  1.5%)   0.0000 (  0.0%)   0.0117 (  1.4%)   0.0117 (  1.4%)  Front end
   0.7992 (100.0%)   0.0206 (100.0%)   0.8198 (100.0%)   0.8198 (100.0%)  Total
```
```
$ ./clang-bad -O3 -fPIE -c reduced.ll -o /dev/null -ftime-report
...
===-------------------------------------------------------------------------===
                          Pass execution timing report
===-------------------------------------------------------------------------===
  Total Execution Time: 18.7632 seconds (18.7641 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   6.3520 ( 34.0%)   0.0007 (  0.7%)   6.3527 ( 33.9%)   6.3529 ( 33.9%)  Machine Cycle Info Analysis
   3.5076 ( 18.8%)   0.0000 (  0.0%)   3.5076 ( 18.7%)   3.5078 ( 18.7%)  Control Flow Optimizer
   2.3329 ( 12.5%)   0.0000 (  0.0%)   2.3329 ( 12.4%)   2.3330 ( 12.4%)  Branch Probability Basic Block Placement
   1.7856 (  9.6%)   0.0000 (  0.0%)   1.7856 (  9.5%)   1.7857 (  9.5%)  Check CFA info and insert CFI instructions if needed
   0.9386 (  5.0%)   0.0000 (  0.0%)   0.9386 (  5.0%)   0.9386 (  5.0%)  Machine code sinking
   0.8447 (  4.5%)   0.0000 (  0.0%)   0.8447 (  4.5%)   0.8448 (  4.5%)  ReachingDefAnalysis
   0.3791 (  2.0%)   0.0106 ( 10.4%)   0.3897 (  2.1%)   0.3897 (  2.1%)  Early Tail Duplication
   0.2533 (  1.4%)   0.0000 (  0.0%)   0.2533 (  1.4%)   0.2534 (  1.4%)  Machine Block Frequency Analysis #5
   0.2513 (  1.3%)   0.0000 (  0.0%)   0.2513 (  1.3%)   0.2513 (  1.3%)  Machine Block Frequency Analysis #2
   0.2470 (  1.3%)   0.0000 (  0.0%)   0.2470 (  1.3%)   0.2470 (  1.3%)  Machine Block Frequency Analysis #3
   0.2465 (  1.3%)   0.0000 (  0.0%)   0.2465 (  1.3%)   0.2465 (  1.3%)  Machine Block Frequency Analysis #4
   0.2359 (  1.3%)   0.0079 (  7.7%)   0.2439 (  1.3%)   0.2439 (  1.3%)  Machine Block Frequency Analysis
   0.1544 (  0.8%)   0.0120 ( 11.7%)   0.1664 (  0.9%)   0.1664 (  0.9%)  MachinePostDominator Tree Construction #3
   0.1488 (  0.8%)   0.0120 ( 11.7%)   0.1608 (  0.9%)   0.1608 (  0.9%)  MachinePostDominator Tree Construction
   0.1513 (  0.8%)   0.0040 (  3.9%)   0.1553 (  0.8%)   0.1553 (  0.8%)  MachinePostDominator Tree Construction #2
[test.tar.gz](https://github.com/user-attachments/files/19394304/test.tar.gz)

...
===-------------------------------------------------------------------------===
                               Clang time report
===-------------------------------------------------------------------------===
  Total Execution Time: 18.7990 seconds (18.8000 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
  18.6630 ( 99.8%)   0.1024 ( 99.7%)  18.7653 ( 99.8%)  18.7663 ( 99.8%)  Machine code generation
   0.0227 (  0.1%)   0.0003 (  0.3%)   0.0230 (  0.1%)   0.0230 (  0.1%)  Optimizer
   0.0106 (  0.1%)   0.0000 (  0.0%)   0.0106 (  0.1%)   0.0106 (  0.1%)  Front end
  18.6963 (100.0%)   0.1027 (100.0%)  18.7990 (100.0%)  18.8000 (100.0%)  Total
```

https://github.com/llvm/llvm-project/pull/114990


More information about the llvm-commits mailing list