1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/test
Vedant Kumar 55c3504da4 [LiveDebugValues] Encode register location within VarLoc IDs [3/3]
This is part 3 of a 3-part series to address a compile-time explosion
issue in LiveDebugValues.

---

Start encoding register locations within VarLoc IDs, and take advantage
of this encoding to speed up transferRegisterDef.

There is no fundamental algorithmic change: this patch simply swaps out
SparseBitVector in favor of CoalescingBitVector. That changes iteration
order (hence the test updates), but otherwise this patch is NFCI.

The only interesting change is in transferRegisterDef. Instead of doing:

```
KillSet = {}
for (ID : OpenRanges.getVarLocs())
  if (DeadRegs.count(ID))
    KillSet.add(ID)
```

We now do:

```
KillSet = {}
for (Reg : DeadRegs)
  for (ID : intervalsReservedForReg(Reg, OpenRanges.getVarLocs()))
    KillSet.add(ID)
```

By not visiting each open location every time we visit an instruction,
this eliminates some potentially quadratic behavior. The new
implementation basically does a constant amount of work per instruction
because the interval map lookups are very fast.

For a file in WebKit, this brings the time spent in LiveDebugValues down
from ~2.5 minutes to 4 seconds, reducing compile time spent in that pass
from 28% of the total to just over 1%.

Before:

```
2.49 min   27.8%	0 s	LiveDebugValues::process
2.41 min   27.0%	5.40 s	LiveDebugValues::transferRegisterDef
1.51 min   16.9%	1.51 min LiveDebugValues::VarLoc::isDescribedByReg() const
32.73 s    6.1%		8.70 s	 llvm::SparseBitVector<128u>::SparseBitVectorIterator::operator++()
```

After:

```
4.53 s	1.1%	0 s	LiveDebugValues::process
3.00 s	0.7%	107.00 ms		LiveDebugValues::transferRegisterCopy
892.00 ms	0.2%	406.00 ms	LiveDebugValues::transferSpillOrRestoreInst
404.00 ms	0.1%	32.00 ms	LiveDebugValues::transferRegisterDef
110.00 ms	0.0%	2.00 ms		  LiveDebugValues::getUsedRegs
57.00 ms	0.0%	1.00 ms		  std::__1::vector<>::push_back
40.00 ms	0.0%	1.00 ms		  llvm::CoalescingBitVector<>::find(unsigned long long)
```

FWIW, I tried the same approach using SparseBitVector, but got bad
results. To do that, I had to extend SparseBitVector to support 64-bit
indices and expose its lower bound operation. The problem with this is
that the performance is very hard to predict: SparseBitVector's lower
bound operation falls back to O(n) linear scans in a std::list if you're
not /very/ careful about managing iteration order. When I profiled this
the performance looked worse than the baseline.

You can see the full CoalescingBitVector-based implementation here:

  https://github.com/vedantk/llvm-project/commits/try-coalescing

You can see the full SparseBitVector-based implementation here:

  https://github.com/vedantk/llvm-project/commits/try-sparsebitvec-find

Depends on D74984 and D74985.

Differential Revision: https://reviews.llvm.org/D74986
2020-02-27 12:39:47 -08:00
..
Analysis [CostModel][X86] Improve extract/insert element costs (PR43605) 2020-02-27 15:54:13 +00:00
Assembler [Assembler] Allow assembling empty index with non-zero flags 2020-02-26 16:34:11 +03:00
Bindings Revert "Rework go bindings so that validation works fine" 2020-02-24 09:20:08 -08:00
Bitcode
BugPoint
CodeGen [x86] use instruction-level fast-math-flags to drive MachineCombiner 2020-02-27 15:19:37 -05:00
DebugInfo [LiveDebugValues] Encode register location within VarLoc IDs [3/3] 2020-02-27 12:39:47 -08:00
Demangle
Examples
ExecutionEngine Disable memory leak checking in a test to work around a bot failure 2020-02-26 14:51:50 -08:00
Feature Remove no un-necessary require for load_extension.ll 2020-02-26 08:29:09 +01:00
FileCheck
Instrumentation Reapply [IRBuilder] Always respect inserter/folder 2020-02-19 20:51:38 +01:00
Integer
JitListener
Linker
LTO
MachineVerifier
MC [MC][ARM] Resolve some pcrel fixups at assembly time (PR44929) 2020-02-27 12:43:29 +01:00
Object
ObjectYAML
Other Use temporary directory for tests in D74346 2020-02-24 12:19:07 +01:00
Reduce
SafepointIRVerifier
Support
SymbolRewriter
TableGen TableGen: Fix logic for default operands 2020-02-19 23:41:07 -05:00
ThinLTO/X86
tools [llvm-objcopy] Enable --discard-all for MachO 2020-02-26 12:51:15 -08:00
Transforms [InstCombine] DCE instructions earlier 2020-02-27 18:45:59 +01:00
Unit
Verifier Visit previously unreachable nodes in the debug info metadata verifier. 2020-02-26 14:48:08 -08:00
YAMLParser
.clang-format
CMakeLists.txt Fix buildbots after recent GSYM commit. 2020-02-26 10:30:04 -08:00
lit.cfg.py Revert "Rework go bindings so that validation works fine" 2020-02-24 09:20:08 -08:00
lit.site.cfg.py.in
TestRunner.sh