[Openmp-commits] [PATCH] D125717: [InstCombine] Optimize and of icmps with power-of-2 and contiguous masks

John McIver via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat May 20 15:09:01 PDT 2023


jmciver updated this revision to Diff 524062.
jmciver added a comment.

Add foldPowerOf2AndShiftedMask(...) and call from InstCombinerImpl::foldAndOrOfICmps(...)

Place the folding of ((icmp X u< P) & (icmp(X & M) != M)) or ((icmp X s> -1) &
(icmp(X & M) != M)) into (icmp X u< M) in foldPowerOf2AndShiftedMask(...).  This
function attempts the transform of (X <u 2^n) into (X & ~(2^n-1)) == 0 or (icmp
X s> -1) into (icmp (X & SignMask) == 0) and then performs additional checks in
foldNegativePower2AndShiftedMask(...).

This patch delta removes prior implementation work from
foldLogOpOfMaskedICmps(...).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125717/new/

https://reviews.llvm.org/D125717

Files:
  llvm/include/llvm/IR/PatternMatch.h
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/icmp-power2-and-icmp-shifted-mask.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125717.524062.patch
Type: text/x-patch
Size: 22564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230520/173db4b0/attachment-0001.bin>


More information about the Openmp-commits mailing list