[llvm-commits] [llvm] r171345 - /llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp
Bob Wilson
bob.wilson at apple.com
Mon Jan 7 13:18:44 PST 2013
On Jan 1, 2013, at 8:05 AM, Michael Gottesman <mgottesman at apple.com> wrote:
> Author: mgottesman
> Date: Tue Jan 1 10:05:48 2013
> New Revision: 171345
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171345&view=rev
> Log:
> Added DEBUG messages to the top of several processing loops in ObjCARC.cpp that emit what instructions are being visited.
>
> This is a part of a larger effort of adding DEBUG messages to the ARC
> Optimizer Backend.
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp?rev=171345&r1=171344&r2=171345&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp Tue Jan 1 10:05:48 2013
> @@ -30,6 +30,7 @@
>
> #define DEBUG_TYPE "objc-arc"
> #include "llvm/ADT/DenseMap.h"
> +#include "llvm/Support/Debug.h"
> #include "llvm/Support/CommandLine.h"
> #include "llvm/Support/raw_ostream.h"
> using namespace llvm;
> @@ -885,7 +886,9 @@
>
> for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
> Instruction *Inst = &*I;
> -
> +
Please avoid whitespace at EOL, also in the next chunk.
> + DEBUG(dbgs() << "ObjCARCExpand: Visiting: " << *Inst << "\n");
> +
> switch (GetBasicInstructionClass(Inst)) {
> case IC_Retain:
> case IC_RetainRV:
> @@ -904,7 +907,9 @@
> break;
> }
> }
> -
> +
> + DEBUG(dbgs() << "ObjCARCExpand: Finished Queue.\n\n");
> +
> return Changed;
> }
>
> @@ -2273,6 +2278,10 @@
> // Visit all objc_* calls in F.
> for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ) {
> Instruction *Inst = &*I++;
> +
> + DEBUG(dbgs() << "ObjCARCOpt: OptimizeIndividualCalls: Visiting: " <<
> + *Inst << "\n");
> +
> InstructionClass Class = GetBasicInstructionClass(Inst);
>
> switch (Class) {
> @@ -2486,6 +2495,9 @@
> }
> }
> } while (!Worklist.empty());
> +
> + DEBUG(dbgs() << "ObjCARCOpt: Finished Individual Call Queue.\n\n");
> +
> }
> }
>
> @@ -3389,6 +3401,10 @@
> // queries instead.
> for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ) {
> Instruction *Inst = &*I++;
> +
> + DEBUG(dbgs() << "ObjCARCOpt: OptimizeWeakCalls: Visiting: " << *Inst <<
> + "\n");
> +
> InstructionClass Class = GetBasicInstructionClass(Inst);
> if (Class != IC_LoadWeak && Class != IC_LoadWeakRetained)
> continue;
> @@ -3534,6 +3550,9 @@
> done:;
> }
> }
> +
> + DEBUG(dbgs() << "ObjCARCOpt: Finished visiting weak calls.\n\n");
> +
> }
>
> /// OptimizeSequences - Identify program paths which execute sequences of
> @@ -3582,6 +3601,9 @@
> for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) {
> BasicBlock *BB = FI;
> ReturnInst *Ret = dyn_cast<ReturnInst>(&BB->back());
> +
> + DEBUG(dbgs() << "ObjCARCOpt: OptimizeReturns: Visiting: " << *Ret << "\n");
> +
> if (!Ret) continue;
>
> const Value *Arg = StripPointerCastsAndObjCCalls(Ret->getOperand(0));
> @@ -3665,6 +3687,9 @@
> DependingInstructions.clear();
> Visited.clear();
> }
> +
> + DEBUG(dbgs() << "ObjCARCOpt: OptimizeReturns: Finished visiting returns.\n\n");
> +
> }
>
> bool ObjCARCOpt::doInitialization(Module &M) {
> @@ -4078,7 +4103,9 @@
> SmallPtrSet<const BasicBlock *, 4> Visited;
> for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ) {
> Instruction *Inst = &*I++;
> -
> +
> + DEBUG(dbgs() << "ObjCARCContract: Visiting: " << *Inst << "\n");
> +
> // Only these library routines return their argument. In particular,
> // objc_retainBlock does not necessarily return its argument.
> InstructionClass Class = GetBasicInstructionClass(Inst);
> @@ -4154,6 +4181,8 @@
> continue;
> }
>
> + DEBUG(dbgs() << "ObjCARCContract: Finished Queue.\n\n");
> +
> // Don't use GetObjCArg because we don't want to look through bitcasts
> // and such; to do the replacement, the argument must have type i8*.
> const Value *Arg = cast<CallInst>(Inst)->getArgOperand(0);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list