[PATCH] D154953: [InstCombine] Remove the remainder loop if we know the mask is always true

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 03:29:04 PDT 2023


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1950
+      Constant *Zero = ConstantInt::getNullValue(Ty);
+      return BinaryOperator::CreateAnd(Zero, Op1);
+    }
----------------
Allen wrote:
> david-arm wrote:
> > I think you can avoid the `and` by simply returning null, i.e.
> > 
> >   return ConstantInt::getNullValue(Ty);
> there is compilation problem if I **return ConstantInt::getNullValue(Ty)** directly
>    error: cannot convert 'llvm::Constant*' to 'llvm::Instruction*' in return
I believe this suggests that rather than an InstCombine this transformation should live in InstSimplify (e.g. simplifyURemInst).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154953/new/

https://reviews.llvm.org/D154953



More information about the llvm-commits mailing list