InstrProf: Don't emit counter increments in dead code
authorJustin Bogner <mail@justinbogner.com>
Fri, 9 Jan 2015 01:46:40 +0000 (01:46 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 9 Jan 2015 01:46:40 +0000 (01:46 +0000)
commit203f91e311f860a8d621ad2dfb1da22b6bc03fb9
tree8f20f555806dfefe6b835869732624e259496a6e
parent4f217684c78f398c956bbe889b9c6165df1a3a77
InstrProf: Don't emit counter increments in dead code

We were previously emitting counter increments even if we didn't have
an insertion point, which would result in a CallInst with no
parent. This leads to a crash, as in pr22166, if we try to do
GlobalDCE.

llvm-svn: 225495
clang/lib/CodeGen/CodeGenPGO.cpp
clang/test/Profile/c-unreachable-after-switch.c [new file with mode: 0644]