Skip to content

Commit d2e9532

Browse files
authored
[DemoteRegToStack] Use correct variable for branch instructions in DemoteRegToStack (#113798)
I happened to see this code, and it seems "obviously" wrong to me. So here's what I think this code is supposed to look like.
1 parent 60d2fed commit d2e9532

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Utils/DemoteRegToStack.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ AllocaInst *llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
5555
for (unsigned i = 0; i < CBI->getNumSuccessors(); i++) {
5656
auto *Succ = CBI->getSuccessor(i);
5757
if (!Succ->getSinglePredecessor()) {
58-
assert(isCriticalEdge(II, i) && "Expected a critical edge!");
59-
[[maybe_unused]] BasicBlock *BB = SplitCriticalEdge(II, i);
58+
assert(isCriticalEdge(CBI, i) && "Expected a critical edge!");
59+
[[maybe_unused]] BasicBlock *BB = SplitCriticalEdge(CBI, i);
6060
assert(BB && "Unable to split critical edge.");
6161
}
6262
}

0 commit comments

Comments
 (0)