[llvm] [NFC]Add assert to avoid possibly deref nullptr (PR #65564)

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 08:56:07 PDT 2023


JDevlieghere wrote:

+1 to what Adrian said. This commit doesn't improve anything: it just changes the type of crash from a segmentation fault to an abort, *if* you have asserts enabled. If the internal-consistency guarantee is that `MMI` is never null because `MMIWP` is never null, then you should assert that. But looking at the code (`auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();`) it very much looks intentional. So it looks like these asserts are enforcing something that's not guaranteed. I think this should be reverted. 

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


More information about the llvm-commits mailing list