[llvm] [InstCombine] Extend Fold of Zero-extended Bit Test (PR #102100)

Marius Kamp via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 04:05:23 PDT 2024


================
@@ -997,7 +997,8 @@ Instruction *InstCombinerImpl::transformZExtICmp(ICmpInst *Cmp,
         X = Builder.CreateNot(X);
       Value *Lshr = Builder.CreateLShr(X, ShAmt);
       Value *And1 = Builder.CreateAnd(Lshr, ConstantInt::get(X->getType(), 1));
-      return replaceInstUsesWith(Zext, And1);
+      return replaceInstUsesWith(
+          Zext, Builder.CreateZExtOrTrunc(And1, Zext.getType()));
----------------
mskamp wrote:

Right. I've added a negative test and adjusted the implementation accordingly.

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


More information about the llvm-commits mailing list