[PATCH] D103316: Hoist llvm.assume into single predecessor if block otherwise empty

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 06:38:10 PDT 2021


markus created this revision.
markus added reviewers: thejh, reames, bjope, jdoerfert.
Herald added a subscriber: hiraditya.
markus requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Here is a first go at what was discussed in the thread of https://lists.llvm.org/pipermail/llvm-dev/2021-May/150739.html

It does have some obvious limitations like

- This kind of transformation should probably eventually reside in `lib/Transforms/Utils/SimplifyCFG.cpp` but for now it seemed easier and a smaller change to just leave it in CodeGenPrepare.

- Currently only blocks with a single predecessor are considered (and that predecessor needs to have a conditional branch otherwise it is believed that the trivial block merging would have been handled elsewhere already).

- Additional tests need to be added.

- Needs to be better documented.

But besides all that, does it seem like a step in the right direction?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103316

Files:
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/test/Transforms/CodeGenPrepare/X86/delete-assume-dead-code.ll
  llvm/test/Transforms/CodeGenPrepare/X86/recursively-delete-dead-instructions.ll
  llvm/test/Transforms/CodeGenPrepare/X86/remove-assume-block.ll
  llvm/test/Transforms/CodeGenPrepare/X86/tailcall-assume-xbb.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103316.348507.patch
Type: text/x-patch
Size: 11703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210528/a6669cd8/attachment.bin>


More information about the llvm-commits mailing list