[PATCH] D20204: [VectorUtils] Attempt to truncate icmps

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 07:15:28 PDT 2016


jmolloy created this revision.
jmolloy added a reviewer: hfinkel.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.
Herald added a subscriber: mzolotukhin.

Hi Hal,

This is a toned-down version of r268921, which was reverted due to PR27690.

The intent is the same, which is to allow loops containing icmps to be vectorized at smaller bitwidths. DemandedBits doesn't return any useful information for icmp operands. For example:

      %1 = zext i8 %0 to i32
      %2 = xor i32 %1, 255
      %3 = icmp ult i32 %2, 24

This can obviously become:

      %2 = xor i8 %0, 255
      %3 = icmp ult i8 %2, 24

But demandedbits will not and can not tell us this, because while the upper 24 bits can be *truncated* and still return the same result, they cannot be arbitrarily changed (undef), which is the criterion DemandedBits uses.

This patch adds a fairly simple version of DemandedBits called DemandedBitsWithAssumptions (bikeshedding accepted). This is a thin wrapper around DemandedBits that allows a user to supply "facts" about the bits demanded in the dataflow graph that perhaps DemandedBits would be unable to deduce itself.

We do need to recompute DemandedBits afresh when doing this; there is possibly room in the future for more caching if this turns out to have an impact.

Repository:
  rL LLVM

http://reviews.llvm.org/D20204

Files:
  include/llvm/Analysis/DemandedBits.h
  lib/Analysis/DemandedBits.cpp
  lib/Analysis/VectorUtils.cpp
  test/Transforms/LoopVectorize/AArch64/loop-vectorization-factors.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20204.57032.patch
Type: text/x-patch
Size: 9982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160512/385ba978/attachment.bin>


More information about the llvm-commits mailing list