@@ -47,10 +47,6 @@ using namespace llvm::objcarc;
4747STATISTIC (NumPeeps, " Number of calls peephole-optimized" );
4848STATISTIC (NumStoreStrongs, " Number objc_storeStrong calls formed" );
4949
50- static cl::opt<unsigned > MaxBBSize (" arc-contract-max-bb-size" , cl::Hidden,
51- cl::desc (" Maximum basic block size to discover the dominance relation of "
52- " two instructions in the same basic block" ), cl::init(65535 ));
53-
5450// ===----------------------------------------------------------------------===//
5551// Declarations
5652// ===----------------------------------------------------------------------===//
@@ -580,23 +576,6 @@ bool ObjCARCContract::runOnFunction(Function &F) {
580576 SmallPtrSet<Instruction *, 4 > DependingInstructions;
581577 SmallPtrSet<const BasicBlock *, 4 > Visited;
582578
583- // Cache the basic block size.
584- DenseMap<const BasicBlock *, unsigned > BBSizeMap;
585-
586- // A lambda that lazily computes the size of a basic block and determines
587- // whether the size exceeds MaxBBSize.
588- auto IsLargeBB = [&](const BasicBlock *BB) {
589- unsigned BBSize;
590- auto I = BBSizeMap.find (BB);
591-
592- if (I != BBSizeMap.end ())
593- BBSize = I->second ;
594- else
595- BBSize = BBSizeMap[BB] = BB->size ();
596-
597- return BBSize > MaxBBSize;
598- };
599-
600579 for (inst_iterator I = inst_begin (&F), E = inst_end (&F); I != E;) {
601580 Instruction *Inst = &*I++;
602581
@@ -614,7 +593,7 @@ bool ObjCARCContract::runOnFunction(Function &F) {
614593 // and such; to do the replacement, the argument must have type i8*.
615594
616595 // Function for replacing uses of Arg dominated by Inst.
617- auto ReplaceArgUses = [Inst, IsLargeBB, this ](Value *Arg) {
596+ auto ReplaceArgUses = [Inst, this ](Value *Arg) {
618597 // If we're compiling bugpointed code, don't get in trouble.
619598 if (!isa<Instruction>(Arg) && !isa<Argument>(Arg))
620599 return ;
@@ -626,17 +605,6 @@ bool ObjCARCContract::runOnFunction(Function &F) {
626605 Use &U = *UI++;
627606 unsigned OperandNo = U.getOperandNo ();
628607
629- // Don't replace the uses if Inst and the user belong to the same basic
630- // block and the size of the basic block is large. We don't want to call
631- // DominatorTree::dominate in that case. We can remove this check if we
632- // can use OrderedBasicBlock to compute the dominance relation between
633- // two instructions, but that's not currently possible since it doesn't
634- // recompute the instruction ordering when new instructions are inserted
635- // to the basic block.
636- if (Inst->getParent () == cast<Instruction>(U.getUser ())->getParent () &&
637- IsLargeBB (Inst->getParent ()))
638- continue ;
639-
640608 // If the call's return value dominates a use of the call's argument
641609 // value, rewrite the use to use the return value. We check for
642610 // reachability here because an unreachable call is considered to
@@ -689,7 +657,6 @@ bool ObjCARCContract::runOnFunction(Function &F) {
689657 }
690658 };
691659
692-
693660 Value *Arg = cast<CallInst>(Inst)->getArgOperand (0 );
694661 Value *OrigArg = Arg;
695662
0 commit comments