diff options
| author | Alexandre Isoard <alexandre.isoard@gmail.com> | 2017-06-29 16:29:04 +0000 |
|---|---|---|
| committer | Alexandre Isoard <alexandre.isoard@gmail.com> | 2017-06-29 16:29:04 +0000 |
| commit | aa29afc75600c659e9eef0f124b7fa74fd8006cb (patch) | |
| tree | 9c9c43296812661cad7b1a50efd682e085465895 /llvm/include | |
| parent | 39b88f01a53cc561c0002361eb77b1a4d0d35bfd (diff) | |
| download | bcm5719-llvm-aa29afc75600c659e9eef0f124b7fa74fd8006cb.tar.gz bcm5719-llvm-aa29afc75600c659e9eef0f124b7fa74fd8006cb.zip | |
ScalarEvolution: Add URem support
In LLVM IR the following code:
%r = urem <ty> %t, %b
is equivalent to:
%q = udiv <ty> %t, %b
%s = mul <ty> nuw %q, %b
%r = sub <ty> nuw %t, %q ; (t / b) * b + (t % b) = t
As UDiv, Mul and Sub are already supported by SCEV, URem can be
implemented with minimal effort this way.
Note: While SRem and SDiv are also related this way, SCEV does not
provides SDiv yet.
llvm-svn: 306695
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Analysis/ScalarEvolution.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h index 002a3174fd1..c57c600075e 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolution.h +++ b/llvm/include/llvm/Analysis/ScalarEvolution.h @@ -1244,6 +1244,7 @@ public: } const SCEV *getUDivExpr(const SCEV *LHS, const SCEV *RHS); const SCEV *getUDivExactExpr(const SCEV *LHS, const SCEV *RHS); + const SCEV *getURemExpr(const SCEV *LHS, const SCEV *RHS); const SCEV *getAddRecExpr(const SCEV *Start, const SCEV *Step, const Loop *L, SCEV::NoWrapFlags Flags); const SCEV *getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands, |

