]> granicus.if.org Git - llvm/commit
[EarlyCSE] Remove guards with conditions known to be true
authorMax Kazantsev <max.kazantsev@azul.com>
Fri, 28 Apr 2017 06:05:48 +0000 (06:05 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Fri, 28 Apr 2017 06:05:48 +0000 (06:05 +0000)
commit49ccc8d7cbbf8543f6f51bc717e86dbe1534ff7e
tree269f18f3bc6abbb0ec5ce91f4b22215c456a8c92
parent8b430f87e6701a0513bba067a05f3db0dc8b33ad
[EarlyCSE] Remove guards with conditions known to be true

If a condition is calculated only once, and there are multiple guards on this condition, we should be able
to remove all guards dominated by the first of them. This patch allows EarlyCSE to try to find the condition
of a guard among the known values, and if it is true, remove the guard. Otherwise we keep the guard and
mark its condition as 'true' for future consideration.

Reviewers: sanjoy, reames, apilipenko, skatkov, anna, dberlin

Reviewed By: reames, sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301623 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/EarlyCSE.cpp
test/Transforms/EarlyCSE/guards.ll