mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
SCEV: Compress disposition pairs.
Composing DenseMaps and SmallVectors is still somewhat suboptimal, but this at least halves the size of the vector elements. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ff53b757ea
commit
0e0271af87
@ -372,14 +372,17 @@ namespace llvm {
|
||||
|
||||
/// LoopDispositions - Memoized computeLoopDisposition results.
|
||||
DenseMap<const SCEV *,
|
||||
SmallVector<std::pair<const Loop *, LoopDisposition>, 2> > LoopDispositions;
|
||||
SmallVector<PointerIntPair<const Loop *, 2, LoopDisposition>, 2>>
|
||||
LoopDispositions;
|
||||
|
||||
/// computeLoopDisposition - Compute a LoopDisposition value.
|
||||
LoopDisposition computeLoopDisposition(const SCEV *S, const Loop *L);
|
||||
|
||||
/// BlockDispositions - Memoized computeBlockDisposition results.
|
||||
DenseMap<const SCEV *,
|
||||
SmallVector<std::pair<const BasicBlock *, BlockDisposition>, 2> > BlockDispositions;
|
||||
DenseMap<
|
||||
const SCEV *,
|
||||
SmallVector<PointerIntPair<const BasicBlock *, 2, BlockDisposition>, 2>>
|
||||
BlockDispositions;
|
||||
|
||||
/// computeBlockDisposition - Compute a BlockDisposition value.
|
||||
BlockDisposition computeBlockDisposition(const SCEV *S, const BasicBlock *BB);
|
||||
|
@ -8000,17 +8000,17 @@ void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
|
||||
|
||||
ScalarEvolution::LoopDisposition
|
||||
ScalarEvolution::getLoopDisposition(const SCEV *S, const Loop *L) {
|
||||
SmallVector<std::pair<const Loop *, LoopDisposition>, 2> &Values = LoopDispositions[S];
|
||||
for (unsigned u = 0; u < Values.size(); u++) {
|
||||
if (Values[u].first == L)
|
||||
return Values[u].second;
|
||||
auto &Values = LoopDispositions[S];
|
||||
for (auto &V : Values) {
|
||||
if (V.getPointer() == L)
|
||||
return V.getInt();
|
||||
}
|
||||
Values.push_back(std::make_pair(L, LoopVariant));
|
||||
Values.emplace_back(L, LoopVariant);
|
||||
LoopDisposition D = computeLoopDisposition(S, L);
|
||||
SmallVector<std::pair<const Loop *, LoopDisposition>, 2> &Values2 = LoopDispositions[S];
|
||||
for (unsigned u = Values2.size(); u > 0; u--) {
|
||||
if (Values2[u - 1].first == L) {
|
||||
Values2[u - 1].second = D;
|
||||
auto &Values2 = LoopDispositions[S];
|
||||
for (auto &V : make_range(Values2.rbegin(), Values2.rend())) {
|
||||
if (V.getPointer() == L) {
|
||||
V.setInt(D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -8106,17 +8106,17 @@ bool ScalarEvolution::hasComputableLoopEvolution(const SCEV *S, const Loop *L) {
|
||||
|
||||
ScalarEvolution::BlockDisposition
|
||||
ScalarEvolution::getBlockDisposition(const SCEV *S, const BasicBlock *BB) {
|
||||
SmallVector<std::pair<const BasicBlock *, BlockDisposition>, 2> &Values = BlockDispositions[S];
|
||||
for (unsigned u = 0; u < Values.size(); u++) {
|
||||
if (Values[u].first == BB)
|
||||
return Values[u].second;
|
||||
auto &Values = BlockDispositions[S];
|
||||
for (auto &V : Values) {
|
||||
if (V.getPointer() == BB)
|
||||
return V.getInt();
|
||||
}
|
||||
Values.push_back(std::make_pair(BB, DoesNotDominateBlock));
|
||||
Values.emplace_back(BB, DoesNotDominateBlock);
|
||||
BlockDisposition D = computeBlockDisposition(S, BB);
|
||||
SmallVector<std::pair<const BasicBlock *, BlockDisposition>, 2> &Values2 = BlockDispositions[S];
|
||||
for (unsigned u = Values2.size(); u > 0; u--) {
|
||||
if (Values2[u - 1].first == BB) {
|
||||
Values2[u - 1].second = D;
|
||||
auto &Values2 = BlockDispositions[S];
|
||||
for (auto &V : make_range(Values2.rbegin(), Values2.rend())) {
|
||||
if (V.getPointer() == BB) {
|
||||
V.setInt(D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user