[PATCH] D95959: [ValueTracking] improve analysis for "C << X" and "C >> X"
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 3 09:49:06 PST 2021
spatel created this revision.
spatel added reviewers: nikic, lebedev.ri, xbolva00.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.
This is based on the example/comments in:
https://llvm.org/PR48984
I tried just lifting the restriction in computeKnownBitsFromShiftOperator() as suggested, but that doesn't catch all of the cases shown here. I didn't step through to see exactly why that happened. But it seems like a reasonable compromise to cheaply check the special-case of shifting a constant.
There's a slight regression on a cmp transform as noted, but I think this is likely the more important/common pattern, so we can fix that icmp pattern later if needed.
https://reviews.llvm.org/D95959
Files:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/and2.ll
llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
llvm/test/Transforms/InstCombine/shift.ll
llvm/test/Transforms/InstCombine/signbit-shl-and-icmpeq-zero.ll
llvm/test/Transforms/InstCombine/zext-or-icmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95959.321130.patch
Type: text/x-patch
Size: 8387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210203/7692f4d3/attachment.bin>
More information about the llvm-commits
mailing list