From e852d4cf3cafaabf907daf225ad32c3cc4d853f1 Mon Sep 17 00:00:00 2001 From: liyunfei Date: Thu, 28 Aug 2025 20:42:49 +0800 Subject: [PATCH] [Propeller] bugfix for MachineBasicBlock hush set In some testcases x86 codegen might gen MBB with no BBID. Set hash for these MBB will cause assertion fail. --- llvm/include/llvm/CodeGen/MachineBasicBlock.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h index 51660e4ded13..b8789cd5afd4 100644 --- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h +++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h @@ -667,12 +667,19 @@ public: std::optional getBBID() const { return BBID; } - uint64_t getHash() const { return BBID->Hash; } + uint64_t getHash() const { + if (BBID) + return BBID->Hash; + return 0; + } /// Returns the section ID of this basic block. MBBSectionID getSectionID() const { return SectionID; } - void setHash(uint64_t Hash) { BBID->Hash = Hash; } + void setHash(uint64_t Hash) { + if (BBID) + BBID->Hash = Hash; + } /// Sets the fixed BBID of this basic block. void setBBID(const UniqueBBID &V) { -- Gitee