[PATCH] D127188: [InstCombine] improve fold for icmp-ugt-ashr

Chenbing.Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 01:25:46 PDT 2022


Chenbing.Zheng marked 2 inline comments as done.
Chenbing.Zheng added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2258-2259
       // icmp ugt (ashr X, ShAmtC), C --> icmp ugt X, ((C + 1) << ShAmtC) - 1
+      // Note: 'ShiftedC + 1' as an signed number may overflow, so than 'ashr'
+      // can not get expect value.
       APInt ShiftedC = (C + 1).shl(ShAmtVal) - 1;
----------------
spatel wrote:
> Rephrase this comment:
>   // 'C + 1 << ShAmtC' can overflow as a signed number, so the 2nd
>   // clause accounts for that pattern.
I modified it when commit


================
Comment at: llvm/test/Transforms/InstCombine/icmp-shr.ll:858
 ; negative test
 ; TODO: This is a sign-bit test, but we don't recognize the pattern.
 
----------------
spatel wrote:
> Check the history to see where this got fixed? Either way, we should delete the TODO since it optimized now.
I modified it when commit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127188



More information about the llvm-commits mailing list