[PATCH] D129103: [InstCombine] [NFC] use C.isNegatedPowerOf2() instead of (~C + 1).isPowerOf2()

Chenbing.Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 02:05:39 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb66220f25aea: [InstCombine] [NFC] use C.isNegatedPowerOf2() instead of (~C + 1).isPowerOf2() (authored by Chenbing.Zheng).

Changed prior to commit:
  https://reviews.llvm.org/D129103?vs=442168&id=442208#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129103

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp


Index: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -1779,7 +1779,7 @@
 
     // Restrict this fold only for single-use 'and' (PR10267).
     // ((%x & C) == 0) --> %x u< (-C)  iff (-C) is power of two.
-    if ((~(*C2) + 1).isPowerOf2()) {
+    if (C2->isNegatedPowerOf2()) {
       Constant *NegBOC =
           ConstantExpr::getNeg(cast<Constant>(And->getOperand(1)));
       auto NewPred = isICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129103.442208.patch
Type: text/x-patch
Size: 649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220705/04058e17/attachment.bin>


More information about the llvm-commits mailing list