Skip to content

Commit a1c3767

Browse files
committed
---
yaml --- r: 349089 b: refs/heads/master c: 1c0dcc1 h: refs/heads/master i: 349087: b44ac4d
1 parent 16d192f commit a1c3767

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 33afd0eb2bb7825623cc3c66f90aed3438154390
2+
refs/heads/master: 1c0dcc16e567a0ae1ef3e67556310b228fa6ea5d
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "swift/SIL/Projection.h"
6161
#include "swift/SIL/SILArgument.h"
6262
#include "swift/SIL/SILBuilder.h"
63+
#include "swift/SIL/MemoryLifetime.h"
6364
#include "swift/SILOptimizer/Analysis/AliasAnalysis.h"
6465
#include "swift/SILOptimizer/Analysis/PostOrderAnalysis.h"
6566
#include "swift/SILOptimizer/PassManager/Passes.h"
@@ -269,6 +270,8 @@ class BlockState {
269270
init(LocationNum, Optimistic);
270271
}
271272

273+
void dump();
274+
272275
/// Initialize the bitvectors for the current basic block.
273276
void init(unsigned LocationNum, bool Optimistic);
274277

@@ -448,6 +451,8 @@ enum class ProcessKind {
448451
llvm::SpecificBumpPtrAllocator<BlockState> &BPA)
449452
: Mod(M), F(F), PM(PM), AA(AA), TE(TE), EAFI(EAFI), BPA(BPA) {}
450453

454+
void dump();
455+
451456
/// Entry point for dead store elimination.
452457
bool run();
453458

@@ -481,6 +486,12 @@ enum class ProcessKind {
481486

482487
} // end anonymous namespace
483488

489+
void BlockState::dump() {
490+
llvm::dbgs() << " block " << BB->getDebugID() << ": in=" << BBWriteSetIn
491+
<< ", out=" << BBWriteSetOut << ", mid=" << BBWriteSetMid
492+
<< ", gen=" << BBGenSet << ", kill=" << BBKillSet << '\n';
493+
}
494+
484495
void BlockState::init(unsigned LocationNum, bool Optimistic) {
485496
// For function that requires just 1 iteration of the data flow to converge
486497
// we set the initial state of BBWriteSetIn to 0.
@@ -513,6 +524,21 @@ void BlockState::init(unsigned LocationNum, bool Optimistic) {
513524
BBDeallocateLocation.resize(LocationNum, false);
514525
}
515526

527+
#if __has_attribute(used)
528+
__attribute((used))
529+
#endif
530+
void DSEContext::dump() {
531+
llvm::dbgs() << "Locations:\n";
532+
unsigned idx = 0;
533+
for (const LSLocation &loc : LocationVault) {
534+
llvm::dbgs() << " #" << idx << ": " << loc.getBase();
535+
++idx;
536+
}
537+
for (SILBasicBlock &BB : *F) {
538+
getBlockState(&BB)->dump();
539+
}
540+
}
541+
516542
unsigned DSEContext::getLocationBit(const LSLocation &Loc) {
517543
// Return the bit position of the given Loc in the LocationVault. The bit
518544
// position is then used to set/reset the bitvector kept by each BlockState.

0 commit comments

Comments
 (0)