Fix dereference of possibly nullptr
authorAlan Baker <alanbaker@google.com>
Tue, 30 Jan 2018 15:15:43 +0000 (10:15 -0500)
committerAlan Baker <alanbaker@google.com>
Tue, 30 Jan 2018 15:15:43 +0000 (10:15 -0500)
commit6704233d399be6b9547fd5635348589d1a20ff8d
treed885f3ef9ad3f8b0692fbdb8a6693f7b0226dbd5
parentf28b1061736a7034f66389f74408ce4955767a43
Fix dereference of possibly nullptr

* If the dead branch elim is performed on a module without structured
control flow, the OpSelectionMerge may not be present
 * Add a check for pointer validity before dereferencing
* Added a test to catch the bug
source/opt/dead_branch_elim_pass.cpp
test/opt/dead_branch_elim_test.cpp