[llvm] InstCombine: Stop transforming EQ/NE of SHR to 0 to ULT/UGT if >1 use. (PR #168007)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 14 06:51:39 PST 2025


================
@@ -2638,17 +2638,17 @@ Instruction *InstCombinerImpl::foldICmpShrConstant(ICmpInst &Cmp,
   if (Shr->isExact())
     return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, C << ShAmtVal));
 
-  if (C.isZero()) {
-    // == 0 is u< 1.
-    if (Pred == CmpInst::ICMP_EQ)
-      return new ICmpInst(CmpInst::ICMP_ULT, X,
-                          ConstantInt::get(ShrTy, (C + 1).shl(ShAmtVal)));
-    else
-      return new ICmpInst(CmpInst::ICMP_UGT, X,
-                          ConstantInt::get(ShrTy, (C + 1).shl(ShAmtVal) - 1));
-  }
-
   if (Shr->hasOneUse()) {
+    if (0) {
----------------
dtcxzyw wrote:

This doesn't match the PR title.

https://github.com/llvm/llvm-project/pull/168007


More information about the llvm-commits mailing list