[llvm] [llvm] fix nullptr dereference in BasicBlock::getIrrLoopHeaderWeight (PR #116192)

Alexander Romanov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 22:41:19 PST 2024


arrv-sc 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. Although IMO there's nothing inherently wrong with creating a MachineBasicBlock for incomplete BasicBlock (but I may be mistaken). In any case,  returning `std::nullopt` from function that already returns `std::optional` sounds reasonable to me

https://github.com/llvm/llvm-project/pull/116192


More information about the llvm-commits mailing list