[all-commits] [llvm/llvm-project] 656001: [ValueTracking] look through bitcast of vector in ...
RotateRight via All-commits
all-commits at lists.llvm.org
Wed Jun 23 08:47:04 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 656001e7b2b939d9bce4fb58831d314dc67ddf7a
https://github.com/llvm/llvm-project/commit/656001e7b2b939d9bce4fb58831d314dc67ddf7a
Author: Sanjay Patel <spatel at rotateright.com>
Date: 2021-06-23 (Wed, 23 Jun 2021)
Changed paths:
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll
M llvm/test/Transforms/InstSimplify/shift-knownbits.ll
Log Message:
-----------
[ValueTracking] look through bitcast of vector in computeKnownBits
This borrows as much as possible from the SDAG version of the code
(originally added with 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 shuffle constant elements into a vector,
cast it, and shift it.
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.
Alive2 understands the datalayout and agrees that the tests here are
correct - example:
https://alive2.llvm.org/ce/z/KZJFMZ
Differential Revision: https://reviews.llvm.org/D104472
More information about the All-commits
mailing list