From 2c98421629483448297172c1fcdc9f6b6d62ade9 Mon Sep 17 00:00:00 2001 From: Maksim Panchenko 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 61845a7711c9b2..90803118091173 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); }