The 'BB->getParent()' pointer was utilized before it was verified against nullptr. Check lines: 3567, 3581.
I'm not sure what patterns you have in mind? In this case it looks like we just need to cleanup the logic (and assert that we don't have orphan BBs), other cases its more about ensuring common code isn't prematurely pulled out (which you might be referring to with IsEntryBlock?).
The patch makes sense to me but @jyknight should confirm since he touched this code most recently.
Maybe BB && BB->getParent() ?
http://lab.llvm.org:8080/coverage/coverage-reports/llvm/coverage indicates this never gets called so the assert looks alright to me.
Oops, it was my fault that I put an access before the check.
I think it'd be better to keep the ability to print it if for some reason there's no parent. It should never be required in normal circumstances, but this function can also be used while debugging, where that would be convenient.
It should never be required in normal circumstances, but this function can also be used while debugging, where that would be convenient.
Not sure how it can be used currently, maybe with a big luck, since there is null pointer dereferencing.
I am gonna commit this.
It surely cannot currently. That's why I was saying it _would be nice_ for it to be fixed so that if you have a block which is unattached, you can actually print it in a debugging situation, rather than crashing. That was the original intent, and it's certainly not critical, but it still makes sense.