]> granicus.if.org Git - llvm/commit
[BDCE] Remove dead uses of arguments
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 4 Jan 2019 21:21:43 +0000 (21:21 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 4 Jan 2019 21:21:43 +0000 (21:21 +0000)
commitef0f0e1084e1305778ab918a3e8cfd59f1263c67
tree67310d5ab9ca61edce70ede6fd8bf1756ff08de7
parent8ffa038b3ef4448af8bf31f6c50281779939c774
[BDCE] Remove dead uses of arguments

In addition to finding dead uses of instructions, also find dead uses
of function arguments, and replace them with zero as well.

I'm changing the way the known bits are computed here to remove the
coupling between the transfer function and the algorithm. It previously
relied on the first op being visited first and computing known bits --
unless the first op is not an instruction, in which case they're computed
on the second op. I could have adjusted this to check for "instruction
or argument", but I think it's better to avoid the repeated calculation
with an explicit flag.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350435 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/DemandedBits.h
lib/Analysis/DemandedBits.cpp
lib/Transforms/Scalar/BDCE.cpp
test/Transforms/BDCE/dead-uses.ll