[PATCH] D89821: [SCEV] Match 'zext (trunc A to iB) to iY' as URem.
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 03:37:50 PDT 2020
mkazantsev added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:12767
+ LHS = Trunc->getOperand();
+ RHS = getConstant(Expr->getType(),
+ 1u << getTypeSizeInBits(Trunc->getType()));
----------------
I think `getPowerOf2` would be a useful utility function in SCEV. Consider factoring out (maybe as separate patch).
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:12768
+ RHS = getConstant(Expr->getType(),
+ 1u << getTypeSizeInBits(Trunc->getType()));
+ return true;
----------------
`1u << X` will overflowan become zero if `X > 32`. Consider using APInt.
================
Comment at: llvm/unittests/Analysis/ScalarEvolutionTest.cpp:67
+
+ bool matchURem(ScalarEvolution &SE, const SCEV *Expr, const SCEV *&LHS,
+ const SCEV *&RHS) {
----------------
static?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89821/new/
https://reviews.llvm.org/D89821
More information about the llvm-commits
mailing list