[PATCH] D70521: [InstCombine] Canonicalize widenable.conditions for ease of pattern matching (and cases)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 18:17:07 PST 2019


reames created this revision.
reames added reviewers: apilipenko, fedor.sergeev, ebrevnov, skatkov.
Herald added subscribers: bollu, hiraditya, mcrosier.
Herald added a project: LLVM.

Canonicalize and expressions involving widenable.conditions in two ways:

1. Treat widenable.conditions are more complex (and thus placed on the LHS) as compared to other instructions
2. Sink widenable.conditions to the outermost and in any and-tree.
3. Remove redundant widenable.conditions within a single and-tree.

The net effect is that we merge two widenable branches (say via SimplifyCFG realizing they share a slowpath branch), we can canonicalize back to a simple widenable branch with some set of conditions and a single WC call.

Note that this needs to land after D70502 <https://reviews.llvm.org/D70502> as it swaps the current right operand preference for the WC.  The current choice is problematic as instcombine will happily swap operands such that e.g. an argument is on the right instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70521

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/InstCombine/widenable-conditions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70521.230358.patch
Type: text/x-patch
Size: 8305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191121/9decb752/attachment.bin>


More information about the llvm-commits mailing list