[PATCH] D15857: [InstCombine] Defend against worst-case exponential execution time

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 03:14:25 PST 2016


jmolloy updated this revision to Diff 44315.
jmolloy added a comment.

Hi Joerg, David,

I think this version should tick all the boxes. There are several requirements that ended up with this design;

1. Matching bitreversals is too heavyweight for InstCombine and doesn't really need to be done so early.
2. Bitreversals and byteswaps are very related in their matching logic.
3. We want to implement support for matching more advanced bswap/bitreverse patterns like partial bswaps/bitreverses.
4. Bswaps are best matched early in InstCombine.

The result of these is that a new utility function is created in Transforms/Utils/Local.h that can be configured to search for bswaps, bitreverses or both. InstCombine uses it to find only bswaps, CGP uses it to find only bitreversals.

We can then extend the matching logic in one place only.


Repository:
  rL LLVM

http://reviews.llvm.org/D15857

Files:
  include/llvm/Transforms/Utils/Local.h
  lib/CodeGen/CodeGenPrepare.cpp
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/Utils/Local.cpp
  test/Transforms/CodeGenPrepare/bitreverse-hang.ll
  test/Transforms/CodeGenPrepare/bitreverse-recognize.ll
  test/Transforms/InstCombine/bitreverse-hang.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15857.44315.patch
Type: text/x-patch
Size: 26393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160108/f3f6d945/attachment.bin>


More information about the llvm-commits mailing list