diff --git a/bolt/Passes/FrameAnalysis.cpp b/bolt/Passes/FrameAnalysis.cpp index a0fbff46b057..38362e21cc34 100644 --- a/bolt/Passes/FrameAnalysis.cpp +++ b/bolt/Passes/FrameAnalysis.cpp @@ -202,7 +202,7 @@ public: return true; } - if (BC.MIA->leaksStackAddress(Inst, *BC.MRI, SPT.HasFramePointer)) { + if (BC.MIA->escapesVariable(Inst, *BC.MRI, SPT.HasFramePointer)) { DEBUG(dbgs() << "Leaked stack address, giving up on this function.\n"); DEBUG(dbgs() << "Blame insn: "); DEBUG(Inst.dump()); @@ -286,6 +286,21 @@ void FrameAnalysis::traverseCG(BinaryFunctionCallGraph &CG) { }); CGWalker.walk(); + + DEBUG_WITH_TYPE("ra", + for (auto &MapEntry : ArgsTouchedMap) { + const auto *Func = MapEntry.first; + const auto &Set = MapEntry.second; + dbgs() << "Args accessed for " << Func->getPrintName() << ": "; + if (!Set.empty() && Set.count(std::make_pair(-1, 0))) { + dbgs() << "assume everything"; + } else { + for (auto &Entry : Set) { + dbgs() << "[" << Entry.first << ", " << (int)Entry.second << "] "; + } + } + dbgs() << "\n"; + }); } bool FrameAnalysis::updateArgsTouchedFor(const BinaryFunction &BF, MCInst &Inst, @@ -373,6 +388,8 @@ bool FrameAnalysis::computeArgsAccessed(BinaryFunction &BF) { return Updated; } + DEBUG(dbgs() << "Now computing args accessed for: " << BF.getPrintName() + << "\n"); bool UpdatedArgsTouched = false; FrameAccessAnalysis FAA(BC, BF); diff --git a/bolt/Passes/FrameOptimizer.cpp b/bolt/Passes/FrameOptimizer.cpp index 38d3968950e0..196dfe749951 100644 --- a/bolt/Passes/FrameOptimizer.cpp +++ b/bolt/Passes/FrameOptimizer.cpp @@ -197,6 +197,8 @@ void FrameOptimizerPass::removeUnusedStores(const FrameAnalysis &FA, DEBUG(dbgs() << "Unused store instruction: "); DEBUG(Inst.dump()); DEBUG(dbgs() << "@BB: " << BB.getName() << "\n"); + DEBUG(dbgs() << "FIE offset = " << FIEX->StackOffset + << " size = " << (int)FIEX->Size << "\n"); // Delete it! ToErase.push_back(std::make_pair(&BB, &Inst)); Prev = &Inst; diff --git a/bolt/Passes/RegAnalysis.cpp b/bolt/Passes/RegAnalysis.cpp index 570e09358132..d9ab2d625f1c 100644 --- a/bolt/Passes/RegAnalysis.cpp +++ b/bolt/Passes/RegAnalysis.cpp @@ -68,7 +68,7 @@ RegAnalysis::RegAnalysis(BinaryContext &BC, CountFunctionsAllClobber += Count; ++NumFunctionsAllClobber; } - DEBUG_WITH_TYPE("fa", + DEBUG_WITH_TYPE("ra", dbgs() << "Killed regs set for func: " << Func->getPrintName() << "\n"; const BitVector &RegsKilled = Iter->second; int RegIdx = RegsKilled.find_first(); diff --git a/bolt/Passes/StackPointerTracking.h b/bolt/Passes/StackPointerTracking.h index cfcf237a9380..ce0cd26bbc5e 100644 --- a/bolt/Passes/StackPointerTracking.h +++ b/bolt/Passes/StackPointerTracking.h @@ -159,7 +159,7 @@ protected: return SUPERPOSITION; if (!HasFramePointer) { - if (MIA->leaksStackAddress(Point, *this->BC.MRI, false)) { + if (MIA->escapesVariable(Point, *this->BC.MRI, false)) { HasFramePointer = true; } }