[CVP] Process binary operations even when def is local
authorAnna Thomas <anna@azul.com>
Thu, 12 Oct 2017 22:39:52 +0000 (22:39 +0000)
committerAnna Thomas <anna@azul.com>
Thu, 12 Oct 2017 22:39:52 +0000 (22:39 +0000)
commit61aec18d467233bd229b7efbb69d12c339500553
treeb999bb2034345de4d4a5aaa4631ae7dea2f15db2
parent3a9c114b2418472b16276e95d3f657735926dddb
[CVP] Process binary operations even when def is local

Summary:
This patch adds processing of binary operations when the def of operands are in
the same block (i.e. local processing).

Earlier we bailed out in such cases (the bail out was introduced in rL252032)
because LVI at that time was more precise about context at the end of basic
blocks, which implied local def and use analysis didn't benefit CVP.

Since then we've added support for LVI in presence of assumes and guards. The
test cases added show how local def processing in CVP helps adding more
information to the ashr, sdiv, srem and add operators.

Note: processCmp which suffers from the same problem will
be handled in a later patch.

Reviewers: philip, apilipenko, SjoerdMeijer, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 315634
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
llvm/test/Transforms/CorrelatedValuePropagation/add.ll
llvm/test/Transforms/CorrelatedValuePropagation/ashr.ll
llvm/test/Transforms/CorrelatedValuePropagation/sdiv.ll
llvm/test/Transforms/CorrelatedValuePropagation/srem.ll