[PATCH] D154953: [InstSimplify] Remove the remainder loop if we know the mask is always true
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 09:08:34 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1283
+ const APInt *RemC;
+ if (match(Op0, m_Power2(RemC))) {
+ KnownBits Known = computeKnownBits(Op1, Q.DL, 0, Q.AC, Q.CxtI, Q.DT);
----------------
move the match of Op0 against a constant to before the far more expensive `isKnownToBeAPowerOfTwo` check on Op1.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1288
+ return ConstantInt::getNullValue(Op0->getType());
+ }
+ }
----------------
Since we are already here, might as well also add an `else if(Known.getMinValue().ugt(*RemC)) { return Op0; }`
Proofs: https://alive2.llvm.org/ce/z/FkTMoy
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154953/new/
https://reviews.llvm.org/D154953
More information about the llvm-commits
mailing list