This is an archive of the discontinued LLVM Phabricator instance.

[NewGVN] Update use counts for SSA copies when replacing them by their operands.
ClosedPublic

Authored by fhahn on Sep 3 2018, 6:49 AM.

Details

Summary

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.

Diff Detail

Event Timeline

fhahn created this revision.Sep 3 2018, 6:49 AM
xbolva00 added inline comments.
lib/Transforms/Scalar/NewGVN.cpp
4100

auto -> unsigned?

fhahn updated this revision to Diff 172980.Nov 7 2018, 10:16 AM
fhahn marked an inline comment as done.

use unsigned instead of auto

davide accepted this revision.Dec 14 2018, 3:57 PM

LGTM

test/Transforms/NewGVN/eliminate-ssacopy.ll
5–6

Please change this to not be a CHECK-NOT.

This revision is now accepted and ready to land.Dec 14 2018, 3:57 PM
This revision was automatically updated to reflect the committed changes.