From d2e9532fe12dc2568f40c2648ff4bb3730141aed Mon Sep 17 00:00:00 2001 From: Eirik Byrkjeflot Anonsen Date: Sun, 27 Oct 2024 10:09:39 +0100 Subject: [PATCH] [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. --- llvm/lib/Transforms/Utils/DemoteRegToStack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp index 3a33b591d35582..6337913cdbbeb7 100644 --- a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -55,8 +55,8 @@ AllocaInst *llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads, for (unsigned i = 0; i < CBI->getNumSuccessors(); i++) { auto *Succ = CBI->getSuccessor(i); if (!Succ->getSinglePredecessor()) { - assert(isCriticalEdge(II, i) && "Expected a critical edge!"); - [[maybe_unused]] BasicBlock *BB = SplitCriticalEdge(II, i); + assert(isCriticalEdge(CBI, i) && "Expected a critical edge!"); + [[maybe_unused]] BasicBlock *BB = SplitCriticalEdge(CBI, i); assert(BB && "Unable to split critical edge."); } }