[IR] Clean up dead instructions after simplifying a conditional branch
authorJay Foad <jay.foad@amd.com>
Mon, 18 May 2020 18:12:29 +0000 (19:12 +0100)
committerJay Foad <jay.foad@amd.com>
Thu, 11 Jun 2020 12:28:10 +0000 (13:28 +0100)
commit4494e45316a0bfaabb6bb1450fb0f49a0e6832af
treedfd0e986f9e2a788312e7b42fdb67ae761d11fba
parent40ea01f6543d0d4aa2701d1b27a6c5413340e7d5
[IR] Clean up dead instructions after simplifying a conditional branch

Change BasicBlock::removePredecessor to optionally return a vector of
instructions which might be dead. Use this in ConstantFoldTerminator to
delete them if they are dead.

Differential Revision: https://reviews.llvm.org/D80206
llvm/include/llvm/IR/BasicBlock.h
llvm/lib/IR/BasicBlock.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/Transforms/PGOProfile/chr.ll