Replace old DEBUG macro with new LLVM_DEBUG

...using a sed command provided by Vedant:

$ find . -name \*.cpp -print -exec sed -i "" -E "s/ DEBUG\(/ LLVM_DEBUG(/g" {} \;
This commit is contained in:
Jordan Rose
2018-07-20 14:37:07 -07:00
parent d7c503d2ce
commit cefb0b62ba
114 changed files with 1018 additions and 1018 deletions

View File

@@ -105,7 +105,7 @@ static bool isIdentifiedSourceValue(SILValue Def) {
case SILArgumentConvention::Indirect_In_Guaranteed:
return true;
default:
DEBUG(llvm::dbgs() << " Skipping Def: Not an @in argument!\n");
LLVM_DEBUG(llvm::dbgs() << " Skipping Def: Not an @in argument!\n");
return false;
}
}
@@ -132,7 +132,7 @@ static bool isIdentifiedDestValue(SILValue Def) {
case SILArgumentConvention::Indirect_Out:
return true;
default:
DEBUG(llvm::dbgs() << " Skipping Def: Not an @in argument!\n");
LLVM_DEBUG(llvm::dbgs() << " Skipping Def: Not an @in argument!\n");
return false;
}
}
@@ -290,7 +290,7 @@ static bool visitAddressUsers(SILValue address, SILInstruction *ignoredUser,
//
// TODO: assert that this list is consistent with
// isTransitiveEscapeInst().
DEBUG(llvm::dbgs() << " Skipping copy: use exposes def" << *UserInst);
LLVM_DEBUG(llvm::dbgs() << " Skipping copy: use exposes def" << *UserInst);
return false;
}
}
@@ -684,7 +684,7 @@ propagateCopy(CopyAddrInst *CopyInst, bool hoistingDestroy) {
}
if (forwardPropagateCopy()) {
DEBUG(llvm::dbgs() << " Forwarding Copy:" << *CurrentCopy);
LLVM_DEBUG(llvm::dbgs() << " Forwarding Copy:" << *CurrentCopy);
if (!CurrentCopy->isInitializationOfDest()) {
// Replace the original copy with a destroy. We may be able to hoist it
// more in another pass but don't currently iterate.
@@ -698,7 +698,7 @@ propagateCopy(CopyAddrInst *CopyInst, bool hoistingDestroy) {
}
// Forward propagation failed. Attempt to backward propagate.
if (CurrentCopy->isInitializationOfDest() && backwardPropagateCopy()) {
DEBUG(llvm::dbgs() << " Reversing Copy:" << *CurrentCopy);
LLVM_DEBUG(llvm::dbgs() << " Reversing Copy:" << *CurrentCopy);
CurrentCopy->eraseFromParent();
HasChanged = true;
++NumCopyBackward;
@@ -775,7 +775,7 @@ CopyAddrInst *CopyForwarding::findCopyIntoDeadTemp(CopyAddrInst *destCopy) {
/// attempts to destroy this uninitialized value.
bool CopyForwarding::
forwardDeadTempCopy(CopyAddrInst *srcCopy, CopyAddrInst *destCopy) {
DEBUG(llvm::dbgs() << " Temp Copy:" << *srcCopy
LLVM_DEBUG(llvm::dbgs() << " Temp Copy:" << *srcCopy
<< " to " << *destCopy);
assert(srcCopy->getDest() == destCopy->getSrc());
@@ -876,7 +876,7 @@ bool CopyForwarding::markStoredValueUsers(SILValue storedValue) {
}
// Conservatively treat everything else as potentially transitively
// retaining the stored value.
DEBUG(llvm::dbgs() << " Cannot reduce lifetime. May retain " << storedValue
LLVM_DEBUG(llvm::dbgs() << " Cannot reduce lifetime. May retain " << storedValue
<< " at: " << *user << "\n");
return false;
}
@@ -979,7 +979,7 @@ bool CopyForwarding::forwardPropagateCopy() {
if (auto *ASI = dyn_cast<AllocStackInst>(CurrentDef)) {
DefDealloc = getSingleDealloc(ASI);
if (!DefDealloc) {
DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
LLVM_DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
<< " stack address has multiple uses.\n");
return false;
}
@@ -994,12 +994,12 @@ bool CopyForwarding::forwardPropagateCopy() {
// If we see another use of Src, then the source location is reinitialized
// before the Dest location is deinitialized. So we really need the copy.
if (SrcUserInsts.count(UserInst)) {
DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
LLVM_DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
<< " source used by" << *UserInst);
return false;
}
if (UserInst == DefDealloc) {
DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
LLVM_DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
<< " dealloc_stack before dest use.\n");
return false;
}
@@ -1125,7 +1125,7 @@ bool CopyForwarding::backwardPropagateCopy() {
DebugValueInstsToDelete.push_back(DVAI);
continue;
}
DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
LLVM_DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy
<< " dest used by " << *UserInst);
return false;
}
@@ -1217,7 +1217,7 @@ bool CopyForwarding::hoistDestroy(SILInstruction *DestroyPoint,
// ... // no access to CurrentDef
// retain StoredValue
// destroy_addr CurrentDef
DEBUG(llvm::dbgs() << " Cannot hoist above stored value use:" << *Inst);
LLVM_DEBUG(llvm::dbgs() << " Cannot hoist above stored value use:" << *Inst);
return false;
}
if (!IsWorthHoisting && isa<ApplyInst>(Inst))
@@ -1237,7 +1237,7 @@ bool CopyForwarding::hoistDestroy(SILInstruction *DestroyPoint,
if (!IsWorthHoisting)
return false;
DEBUG(llvm::dbgs() << " Hoisting to Use:" << *Inst);
LLVM_DEBUG(llvm::dbgs() << " Hoisting to Use:" << *Inst);
SILBuilderWithScope(std::next(SI), Inst)
.createDestroyAddr(DestroyLoc, CurrentDef);
HasChanged = true;
@@ -1253,7 +1253,7 @@ bool CopyForwarding::hoistDestroy(SILInstruction *DestroyPoint,
void CopyForwarding::forwardCopiesOf(SILValue Def, SILFunction *F) {
reset(F);
CurrentDef = Def;
DEBUG(llvm::dbgs() << "Analyzing copies of Def: " << Def);
LLVM_DEBUG(llvm::dbgs() << "Analyzing copies of Def: " << Def);
CopySrcUserVisitor visitor(*this);
if (!visitAddressUsers(Def, nullptr, visitor))
return;
@@ -1440,7 +1440,7 @@ static void replaceAllUsesExceptDealloc(AllocStackInst *ASI, ValueBase *RHS) {
/// Remove a copy for which canNRVO returned true.
static void performNRVO(CopyAddrInst *CopyInst) {
DEBUG(llvm::dbgs() << "NRVO eliminates copy" << *CopyInst);
LLVM_DEBUG(llvm::dbgs() << "NRVO eliminates copy" << *CopyInst);
++NumCopyNRVO;
replaceAllUsesExceptDealloc(cast<AllocStackInst>(CopyInst->getSrc()),
CopyInst->getDest());
@@ -1466,7 +1466,7 @@ class CopyForwardingPass : public SILFunctionTransform
if (!EnableCopyForwarding && !EnableDestroyHoisting)
return;
DEBUG(llvm::dbgs() << "Copy Forwarding in Func " << getFunction()->getName()
LLVM_DEBUG(llvm::dbgs() << "Copy Forwarding in Func " << getFunction()->getName()
<< "\n");
// Collect a set of identified objects (@in arg or alloc_stack) that are
@@ -1485,7 +1485,7 @@ class CopyForwardingPass : public SILFunctionTransform
if (isIdentifiedSourceValue(Def))
CopiedDefs.insert(Def);
else {
DEBUG(llvm::dbgs() << " Skipping Def: " << Def
LLVM_DEBUG(llvm::dbgs() << " Skipping Def: " << Def
<< " not an argument or local var!\n");
}
}
@@ -1561,7 +1561,7 @@ class TempRValueOptPass : public SILFunctionTransform {
/// The main entry point of the pass.
void TempRValueOptPass::run() {
DEBUG(llvm::dbgs() << "Copy Peephole in Func " << getFunction()->getName()
LLVM_DEBUG(llvm::dbgs() << "Copy Peephole in Func " << getFunction()->getName()
<< "\n");
AA = PM->getAnalysis<AliasAnalysis>();
@@ -1625,7 +1625,7 @@ bool TempRValueOptPass::collectLoads(
// (unchecked_take_enum_data_addr of Optional is nondestructive.)
switch (user->getKind()) {
default:
DEBUG(llvm::dbgs() << " Temp use may write/destroy its source" << *user);
LLVM_DEBUG(llvm::dbgs() << " Temp use may write/destroy its source" << *user);
return false;
case SILInstructionKind::ApplyInst: {
@@ -1635,7 +1635,7 @@ bool TempRValueOptPass::collectLoads(
loadInsts.insert(AI);
return true;
}
DEBUG(llvm::dbgs() << " Temp consuming use may write/destroy is source"
LLVM_DEBUG(llvm::dbgs() << " Temp consuming use may write/destroy is source"
<< *user);
return false;
}
@@ -1663,7 +1663,7 @@ bool TempRValueOptPass::collectLoads(
// TODO: Handle copy_addr [take]. But this doesn't seem to be important.
auto *copyFromTmp = cast<CopyAddrInst>(user);
if (copyFromTmp->getDest() == address || copyFromTmp->isTakeOfSrc()) {
DEBUG(llvm::dbgs() << " Temp written or taken" << *user);
LLVM_DEBUG(llvm::dbgs() << " Temp written or taken" << *user);
return false;
}
loadInsts.insert(copyFromTmp);
@@ -1698,7 +1698,7 @@ bool TempRValueOptPass::checkNoSourceModification(CopyAddrInst *copyInst,
return true;
if (AA->mayWriteToMemory(I, copyInst->getSrc())) {
DEBUG(llvm::dbgs() << " Source modified by" << *iter);
LLVM_DEBUG(llvm::dbgs() << " Source modified by" << *iter);
return false;
}
}
@@ -1742,7 +1742,7 @@ bool TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
if (!checkNoSourceModification(copyInst, loadInsts))
return false;
DEBUG(llvm::dbgs() << " Success: replace temp" << *tempObj);
LLVM_DEBUG(llvm::dbgs() << " Success: replace temp" << *tempObj);
// Do a "replaceAllUses" by either deleting the users or replacing them with
// the source address. Note: we must not delete the original copyInst because