Check for MainOp and AltOp for NULL before dereferencing or issue NULL.
Do you have any ideas how a test might look?
I did not mean test's shape when asked the question. This dump routine only called from dumpVectorizableTree routine which in turn is never called in the code. It exists to support debugging.
I can imagine adding "gdb --args opt ..." test with gdb script to call mentioned routine but think it is overkill for this sort of change.
It would be great if you could point an existing test case that intended to test similar issue.
Thank you Sir, but the test you pointed looks overcomplicated for the purpose of testing this debug printer. Why did not you request unit test for example here (https://reviews.llvm.org/D59059) when the dump routine was initially implemented?
As a LIT test it could look like this:
But it cannot be added this way.
Update: I have spent some time investigating unit tests infra and finally came to conclusion that it is not quite possible to create a unit test that calls BoUpSLP::dumpVectorizableTree() as we need to construct BoUpSLP object. We are unable to do that having class forward declaration only.