[reg2mem] Add special handling to CatchSwitchInst
authorHanSheng Zhang <admin@mayuyu.io>
Fri, 16 Dec 2022 15:04:35 +0000 (16:04 +0100)
committerNikita Popov <npopov@redhat.com>
Fri, 16 Dec 2022 15:04:35 +0000 (16:04 +0100)
commit6c5f3f62bdb29d1bffc11e8ad41c7e0fee9cb164
tree2e74a111ff45002284dbe62fc9e64cd8f05efb71
parent379de1239ee3eb17ca37035c069afcc1d5e04d27
[reg2mem] Add special handling to CatchSwitchInst

When promoting a phi in a catchswitch block to memory, we cannot
insert load/store instruction in that block, and need to insert
them inside all successors instead.

Fixes https://github.com/llvm/llvm-project/issues/59185.

Differential Revision: https://reviews.llvm.org/D138641
llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
llvm/test/Transforms/Reg2Mem/catchswitch-crash2.ll [new file with mode: 0644]