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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 11:47:49 PDT 2022


spatel 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;
----------------
Rephrase this comment:
  // 'C + 1 << ShAmtC' can overflow as a signed number, so the 2nd
  // clause accounts for that pattern.


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