Skip to content

Commit

Permalink
[NFC] Add some debug printouts to CaptureTracking
Browse files Browse the repository at this point in the history
  • Loading branch information
xortator committed Mar 15, 2023
1 parent 9d0e5e7 commit 564ed0b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions llvm/lib/Analysis/CaptureTracking.cpp
Expand Up @@ -80,7 +80,10 @@ namespace {
const SmallPtrSetImpl<const Value *> &EphValues, bool ReturnCaptures)
: EphValues(EphValues), ReturnCaptures(ReturnCaptures) {}

void tooManyUses() override { Captured = true; }
void tooManyUses() override {
LLVM_DEBUG(dbgs() << "Captured due to too many uses\n");
Captured = true;
}

bool captured(const Use *U) override {
if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
Expand All @@ -89,6 +92,8 @@ namespace {
if (EphValues.contains(U->getUser()))
return false;

LLVM_DEBUG(dbgs() << "Captured by: " << *U->getUser() << "\n");

Captured = true;
return true;
}
Expand Down Expand Up @@ -233,12 +238,16 @@ bool llvm::PointerMayBeCaptured(const Value *V, bool ReturnCaptures,
// take advantage of this.
(void)StoreCaptures;

LLVM_DEBUG(dbgs() << "Captured?: " << *V << " = ");

SimpleCaptureTracker SCT(EphValues, ReturnCaptures);
PointerMayBeCaptured(V, &SCT, MaxUsesToExplore);
if (SCT.Captured)
++NumCaptured;
else
else {
++NumNotCaptured;
LLVM_DEBUG(dbgs() << "not captured\n");
}
return SCT.Captured;
}

Expand Down

0 comments on commit 564ed0b

Please sign in to comment.