[PATCH] D137021: [ValueTracking] haveNoCommonBitsSet - add assumption cache handling (PR58624)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 29 08:06:37 PDT 2022


RKSimon created this revision.
RKSimon added reviewers: spatel, nikic, nlopes.
Herald added a subscriber: hiraditya.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a project: LLVM.

As detailed on Issue #58624, we fail to make use of assume calls when attempting to determine if two values haveNoCommonBitsSet

I've added a basic iterator across the assumption cache, looking for 'no common bits' comparisons - both the basic (lhs & rhs) == 0 and a boolean variant !(lhs & rhs) as comparisons of booleans will get folded.

I had hoped to support vectors as well but it looks like we'd have problems with poison if we try to match through reduction intrinsics: https://alive2.llvm.org/ce/z/Hn3Tnn

If people are happy with this approach, I'll get the test coverage pre-committed to simplify the patch


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137021

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/xor.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137021.471752.patch
Type: text/x-patch
Size: 5731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221029/063159c1/attachment.bin>


More information about the llvm-commits mailing list