[NewGVN] Mark function as changed if we erase instructions.
authorFlorian Hahn <florian.hahn@arm.com>
Fri, 7 Sep 2018 11:41:34 +0000 (11:41 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Fri, 7 Sep 2018 11:41:34 +0000 (11:41 +0000)
commitb30f7aeeeb2ead53ce8f52abd98dcd61916863ba
tree8ceda9fc20a789fb8929820dc995b639d3669759
parenta2aef22a7283156d00d218c1da90ba197906f734
[NewGVN] Mark function as changed if we erase instructions.

Currently eliminateInstructions only returns true if any instruction got
replaced. In the test case for this patch, we eliminate the trivially
dead calls, for which eliminateInstructions not do a replacement and the
function is not marked as changed, which is why the inliner crashes
while traversing the call graph.

Alternatively we could also change eliminateInstructions to return true
in case we mark instructions for deletion, but that's slightly more code
and doing it at the place where the replacement happens seems safer.

Fixes PR37517.

Reviewers: davide, mcrosier, efriedma, bjope

Reviewed By: bjope

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

llvm-svn: 341651
llvm/lib/Transforms/Scalar/NewGVN.cpp
llvm/test/Transforms/NewGVN/eliminate-callsite-inline.ll [new file with mode: 0644]