[llvm] Use correct variable for branch instructions in DemoteRegToStack (PR #113798)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 27 00:59:32 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Eirik Byrkjeflot Anonsen (eirikba)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/113798.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Utils/DemoteRegToStack.cpp (+2-2)
``````````diff
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.");
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/113798
More information about the llvm-commits
mailing list