[PATCH] D97306: [SimplifyCFG] avoid creating unnecessary assume calls

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 09:38:34 PST 2021


spatel created this revision.
spatel added reviewers: aqjune, xbolva00, nikic, lebedev.ri.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

We are looking at improving analysis for undef in D97244 <https://reviews.llvm.org/D97244>, but there is concern that extra assumptions created can counteract the benefits.

While looking at the most basic examples, it seems clear that simplifycfg is creating assumes that have no possible benefit because no uses of the incoming values remain after we reduce the control-flow. The usual dead code elimination utils don't try hard to kill assumes, so this can lead to bloat that remains through the optimizer.

This patch tries to avoid creating assumes during branch elimination if there is likely no need for them. This reverses several of the test diffs that were added with D61409 <https://reviews.llvm.org/D61409>, but I added some test comments to show that we do still create assumes where it would be helpful.


https://reviews.llvm.org/D97306

Files:
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
  llvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
  llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
  llvm/test/Transforms/SimplifyCFG/simplifyUnreachable-degenerate-conditional-branch-with-matching-destinations.ll
  llvm/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll
  llvm/test/Transforms/SimplifyCFG/unreachable_assume.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97306.325816.patch
Type: text/x-patch
Size: 9995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210223/f3d47417/attachment.bin>


More information about the llvm-commits mailing list