[PATCH] D104472: [ValueTracking] look through bitcast of vector in computeKnownBits

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 10:03:07 PDT 2021


spatel created this revision.
spatel added reviewers: RKSimon, lebedev.ri, efriedma.
Herald added subscribers: pengfei, hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

This borrows as much as possible from the SDAG version of the code (originally added with D27129 <https://reviews.llvm.org/D27129> and since updated with big endian support).

In IR, we can test more easily for correctness than we did in the original patch. I'm using the simplest cases that I could find for InstSimplify - we computeKnownBits on variable shift amounts to see if they are zero or in range, so I used a shuffle to push constant elements into a vector.

The motivating x86 example from https://llvm.org/PR50123 is also here. We computeKnownBits in the caller code, but we only check if the shift amount is in range. That could be enhanced to catch the 2nd x86 test - if the shift amount is known too big, the result is 0.


https://reviews.llvm.org/D104472

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll
  llvm/test/Transforms/InstSimplify/shift-knownbits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104472.352767.patch
Type: text/x-patch
Size: 12279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210617/a7e5dacd/attachment.bin>


More information about the llvm-commits mailing list