This is an archive of the discontinued LLVM Phabricator instance.

Fix segfault in FlattenCFG
AbandonedPublic

Authored by dfukalov on Sep 4 2017, 8:22 AM.

Details

Reviewers
tstellar
Summary

Got segfault on dereferencing nullptr since getTerminator() returned not a BranchInst but a SwitchInst.
Was found in our OpenCL compiler with HSAIL BE, was not able to create regression test for vanilla llvm (
Fixed other similar places in the file.

Diff Detail

Event Timeline

dfukalov created this revision.Sep 4 2017, 8:22 AM
jvesely edited edge metadata.
jvesely added subscribers: arsenm, jvesely.

adding Matt to cc.
the change looks OK to me, although I've never worked with flattencfg.

If the segfault was generated by legal LLVM IR, it should be easy to just add it to 'test/Transforms/Util/flattencfg.ll'

Running the standalone pass should be easy to add tests for this

dfukalov abandoned this revision.Aug 13 2020, 9:12 AM