[WinEH] Fix inttoptr+phi optimization in presence of catchswitch
authorReid Kleckner <rnk@google.com>
Sun, 1 Mar 2020 15:47:55 +0000 (07:47 -0800)
committerReid Kleckner <rnk@google.com>
Sun, 1 Mar 2020 15:49:28 +0000 (07:49 -0800)
commit1adbe86d87bd4ecffc73ab17c7da56f44816f424
tree3371f07ae66d3588b2a5a537e130e6a536c7e790
parent619d7dc39a1bb875cca77fe06c7dc670c380c861
[WinEH] Fix inttoptr+phi optimization in presence of catchswitch

getFirstInsertionPt's return value must be checked for validity before
casting it to Instruction*. Don't attempt to insert casts after a phi in
a catchswitch block.

Fixes PR45033, introduced in D37832.

Reviewed By: davidxl, hfinkel

Differential Revision: https://reviews.llvm.org/D75381
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
llvm/test/Transforms/InstCombine/intptr8.ll [new file with mode: 0644]