[PATCH] D117365: [InstCombine] optimize icmp-ugt-ashr
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 18 15:34:47 PST 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2253
APInt ShiftedC = (C + 1).shl(ShAmtVal) - 1;
- if (!C.isMaxSignedValue() && !(C + 1).shl(ShAmtVal).isMinSignedValue() &&
- (ShiftedC + 1).ashr(ShAmtVal) == (C + 1))
+ if (!C.isMaxSignedValue() && (ShiftedC + 1).ashr(ShAmtVal) == (C + 1))
+ return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC));
----------------
I think the `!(C + 1).shl(ShAmtVal).isMinSignedValue()` term is required for the signed case isn't it? It's the commented out code in my alive proof.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117365/new/
https://reviews.llvm.org/D117365
More information about the llvm-commits
mailing list