[llvm] Use correct variable for branch instructions in DemoteRegToStack (PR #113798)
Eirik Byrkjeflot Anonsen via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 27 00:58:42 PDT 2024
https://github.com/eirikba created https://github.com/llvm/llvm-project/pull/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.
>From 685c6e391268bbdd24e90357f3e05f67150c2438 Mon Sep 17 00:00:00 2001
From: Eirik Byrkjeflot Anonsen <eirik at eirikba.org>
Date: Sun, 27 Oct 2024 08:47:59 +0100
Subject: [PATCH] Use correct variable for branch instructions in
DemoteRegToStack
---
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.");
}
}
More information about the llvm-commits
mailing list