diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-01-13 07:47:32 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-01-13 07:47:32 +0000 |
commit | 981308cffbfd1f77750452015f6e6f0f053e11d4 (patch) | |
tree | c990dabc1942776d48a3be22734e7f0cd950b560 | |
parent | cf14005185778d823631a2367401e65b5e4802d8 (diff) | |
download | external_llvm-981308cffbfd1f77750452015f6e6f0f053e11d4.zip external_llvm-981308cffbfd1f77750452015f6e6f0f053e11d4.tar.gz external_llvm-981308cffbfd1f77750452015f6e6f0f053e11d4.tar.bz2 |
[ObjCARC] Even more debug messages!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172347 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/ObjCARC.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp index 37af1f5..794d354 100644 --- a/lib/Transforms/Scalar/ObjCARC.cpp +++ b/lib/Transforms/Scalar/ObjCARC.cpp @@ -619,14 +619,23 @@ static bool ModuleHasARC(const Module &M) { /// escape analysis in that a use as an argument to a call is not considered /// an escape. static bool DoesObjCBlockEscape(const Value *BlockPtr) { + + DEBUG(dbgs() << "DoesObjCBlockEscape: Target: " << *BlockPtr << "\n"); + // Walk the def-use chains. SmallVector<const Value *, 4> Worklist; Worklist.push_back(BlockPtr); do { const Value *V = Worklist.pop_back_val(); + + DEBUG(dbgs() << "DoesObjCBlockEscape: Visiting: " << *V << "\n"); + for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end(); UI != UE; ++UI) { const User *UUser = *UI; + + DEBUG(dbgs() << "DoesObjCBlockEscape: User: " << *UUser << "\n"); + // Special - Use by a call (callee or argument) is not considered // to be an escape. switch (GetBasicInstructionClass(UUser)) { @@ -634,15 +643,20 @@ static bool DoesObjCBlockEscape(const Value *BlockPtr) { case IC_InitWeak: case IC_StoreStrong: case IC_Autorelease: - case IC_AutoreleaseRV: + case IC_AutoreleaseRV: { + DEBUG(dbgs() << "DoesObjCBlockEscape: User copies pointer arguments. " + "Block Escapes!\n"); // These special functions make copies of their pointer arguments. return true; + } case IC_User: case IC_None: // Use by an instruction which copies the value is an escape if the // result is an escape. if (isa<BitCastInst>(UUser) || isa<GetElementPtrInst>(UUser) || isa<PHINode>(UUser) || isa<SelectInst>(UUser)) { + DEBUG(dbgs() << "DoesObjCBlockEscape: User copies value. Escapes if " + "result escapes. Adding to list.\n"); Worklist.push_back(UUser); continue; } @@ -659,11 +673,13 @@ static bool DoesObjCBlockEscape(const Value *BlockPtr) { continue; } // Otherwise, conservatively assume an escape. + DEBUG(dbgs() << "DoesObjCBlockEscape: Assuming block escapes.\n"); return true; } } while (!Worklist.empty()); // No escapes found. + DEBUG(dbgs() << "DoesObjCBlockEscape: Block does not escape.\n"); return false; } |