DeadArgElim: assess uses of entire return value aggregate.
authorTim Northover <tnorthover@apple.com>
Mon, 9 Feb 2015 01:20:53 +0000 (01:20 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 9 Feb 2015 01:20:53 +0000 (01:20 +0000)
commitc4af8c94675626aac3e1ed3fa1809df753273d28
tree2d9eabfe51c4c93a994d1beabb06e2fc8ff21b88
parent7d5ae5bc1f7e5291ba0376ca3160a0e8813593d0
DeadArgElim: assess uses of entire return value aggregate.

Previously, a non-extractvalue use of an aggregate return value meant
the entire return was considered live (the algorithm gave up
entirely). This was correct, but conservative. It's better to actually
look at that Use, making the analysis results apply to all sub-values
under consideration.

E.g.

  %val = call { i32, i32 } @whatever()
  [...]
  ret { i32, i32 } %val

The return is using the entire aggregate (sub-values 0 and 1). We can
still simplify @whatever if we can prove that this return is itself
unused.

Also unifies the logic slightly between aggregate and non-aggregate
cases..

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228558 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/DeadArgumentElimination.cpp
test/Transforms/DeadArgElim/aggregates.ll [new file with mode: 0644]