[llvm] [BOLT] Follow-up to "Fix incorrect basic block output addresses" (PR #71630)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 22:06:27 PST 2023
https://github.com/maksfb created https://github.com/llvm/llvm-project/pull/71630
In 8244ff6739a09cb75e6e7fd1c24b85e2b1397266, I've introduced an assertion that incorrectly used BasicBlock::empty(). Some basic blocks may contain only pseudo instructions and thus BB->empty() will evaluate to false, while the actual code size will be zero.
>From 2c98421629483448297172c1fcdc9f6b6d62ade9 Mon Sep 17 00:00:00 2001
From: Maksim Panchenko <maks at fb.com>
Date: Tue, 7 Nov 2023 20:20:04 -0800
Subject: [PATCH] [BOLT] Follow-up to "Fix incorrect basic block output
addresses"
In 8244ff6, I've introduced an assertion that incorrectly used
BasicBlock::empty(). Some basic blocks may have only pseudo instructions
and thus BB->empty() will evaluate to false, but actual code size will
be zero.
---
bolt/lib/Core/BinaryFunction.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index 61845a7711c9b2c..90803118091173d 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -4176,7 +4176,7 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
assert(PrevBB->getOutputAddressRange().first <= BBAddress &&
"Bad output address for basic block.");
assert((PrevBB->getOutputAddressRange().first != BBAddress ||
- !hasInstructions() || PrevBB->empty()) &&
+ !hasInstructions() || !PrevBB->getNumNonPseudos()) &&
"Bad output address for basic block.");
PrevBB->setOutputEndAddress(BBAddress);
}
More information about the llvm-commits
mailing list