[llvm] [llvm] fix nullptr dereference in BasicBlock::getIrrLoopHeaderWeight (PR #116192)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 15 02:31:49 PST 2024
nikic wrote:
> @nikic, thank you for taking a look. The main goal of this PR is to avoid UB. I don't necessarily mean that we should treat BBs with no terminators as any other blocks. But I do indeed think that causing UB in this case is not a good thing.
It would be fine to add an `assert(TI && "Block must have terminator");` to make the pre-condition explicit.
> Although IMO there's nothing inherently wrong with creating a MachineBasicBlock for incomplete BasicBlock (but I may be mistaken).
Creating a MachineBasicBlock for an incomplete basic block definitely doesn't make sense. Incomplete basic blocks exist temporarily during IR construction, they should never make it to the backend.
https://github.com/llvm/llvm-project/pull/116192
More information about the llvm-commits
mailing list