OSDN Git Service

[NewGVN] Update use counts for SSA copies when replacing them by their operands.
authorFlorian Hahn <flo@fhahn.com>
Sat, 15 Dec 2018 00:32:38 +0000 (00:32 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 15 Dec 2018 00:32:38 +0000 (00:32 +0000)
commite4bfa17a91e880d396f4e0243508ec867acbcedd
treee5899c281f298553362714f55dc5eb0b52212c98
parent726751627e30a23f4e8611c89427d58781a3c4ed
[NewGVN] Update use counts for SSA copies when replacing them by their operands.

The current code relies on LeaderUseCount to determine if we can remove
an SSA copy, but in that the LeaderUseCount does not refer to the SSA
copy. If a SSA copy is a dominating leader, we use the operand as dominating
leader instead. This means we removed a user of a ssa copy and we should
decrement its use count, so we can remove the ssa copy once it becomes dead.

Fixes PR38804.

Reviewers: efriedma, davide

Reviewed By: davide

Differential Revision: https://reviews.llvm.org/D51595

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349217 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/NewGVN.cpp
test/Transforms/NewGVN/eliminate-ssacopy.ll [new file with mode: 0644]