[InstCombine] Remove trivially empty ranges from end
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 22 Feb 2020 17:37:10 +0000 (18:37 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 26 Feb 2020 19:04:11 +0000 (20:04 +0100)
commit56f7de5baae3ae9a746ac8f5a8e32cfcaf7b4a6b
tree15f6fc3038d0c939f05fc3786da773f11b9b8912
parent30dae38349cbe293bee0705b313dc747e53afd49
[InstCombine] Remove trivially empty ranges from end

InstCombine removes pairs of start+end intrinsics that don't
have anything in between them. Currently this is done by starting
at the start intrinsic and scanning forwards. This patch changes
it to start at the end intrinsic and scan backwards.

The motivation here is as follows: When we process the start
intrinsic, we have not yet looked at the following instructions,
which may still get folded/removed. If they do, we will only be
able to remove the start/end pair on the next iteration. When we
process the end intrinsic, all the instructions before it have
already been visited, and we don't run into this problem.

Differential Revision: https://reviews.llvm.org/D75011
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/test/Transforms/InstCombine/lifetime.ll
llvm/test/Transforms/InstCombine/vararg.ll