[llvm] [InstCombine] Prefer to keep power-of-2 constants when combining ashr exact and slt/ult of a constant (PR #86111)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 09:28:07 PDT 2024
================
@@ -2482,10 +2482,21 @@ Instruction *InstCombinerImpl::foldICmpShrConstant(ICmpInst &Cmp,
// those conditions rather than checking them. This is difficult because of
// undef/poison (PR34838).
if (IsAShr && Shr->hasOneUse()) {
+ if (IsExact && (Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_ULT) &&
+ !C.isMinSignedValue() && (C - 1).isPowerOf2()) {
----------------
goldsteinn wrote:
Doesn't `(C - 1).isPowerOf2()` preclude `C.isMinSignedValue()`?
https://github.com/llvm/llvm-project/pull/86111
More information about the llvm-commits
mailing list