[StackNesting] NFC: Added helper.

Just pull the notion that the alloc corresponds to operand 0 into a
helper method.
This commit is contained in:
Nate Chandler
2023-05-25 07:31:27 -07:00
parent 8c8f5dfc2a
commit 389fb97b44
2 changed files with 10 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ void StackNesting::setup() {
BI.StackInsts.push_back(Alloc);
} else if (I.isDeallocatingStack()) {
auto *AllocInst = cast<SingleValueInstruction>(I.getOperand(0));
auto *AllocInst = getAllocForDealloc(&I);
if (!BI.StackInsts.empty() && BI.StackInsts.back() == AllocInst) {
// As an optimization, we ignore perfectly nested alloc-dealloc pairs
// inside a basic block.
@@ -374,7 +374,7 @@ void StackNesting::dump() const {
dumpBits(StackLocs[BitNr].AliveLocs);
llvm::dbgs() << ", " << *StackInst;
} else if (StackInst->isDeallocatingStack()) {
auto *AllocInst = cast<SingleValueInstruction>(StackInst->getOperand(0));
auto *AllocInst = getAllocForDealloc(StackInst);
int BitNr = StackLoc2BitNumbers.lookup(AllocInst);
llvm::dbgs() << " dealloc for #" << BitNr << "\n"
" " << *StackInst;