[PATCH] D75011: [InstCombine] Remove trivially empty ranges from end

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 22 09:47:07 PST 2020


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri, xbolva00.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

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.

The highlighted test case drops from 4 to 2 iterations, because we can pick up all four start/end pairs in one pass, instead of doing one on each iteration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75011

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/test/Transforms/InstCombine/vararg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75011.246079.patch
Type: text/x-patch
Size: 4526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200222/248a6be8/attachment.bin>


More information about the llvm-commits mailing list