[PATCH] D144381: [SCEV] Added a utility method that raising the number 2 to the desired power to SCEV

Dmitry Bakunevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 02:51:23 PST 2023


dbakunevich added a comment.

In D144381#4154615 <https://reviews.llvm.org/D144381#4154615>, @nikic wrote:

> Where is this method going to be used?

This helper method is planned to be used to improve the SCEV module. In particular, to improve existing optimizations and to write new ones.



================
Comment at: llvm/include/llvm/Analysis/ScalarEvolution.h:659
+  /// Return a SCEV for the constant 2 with \p Degree power of a specific type.
+  const SCEV *getPowerOfTwo(Type *Ty, long long Degree) {
+    return getConstant(Ty, 1 << Degree);
----------------
mkazantsev wrote:
> mkazantsev wrote:
> > 1. `Degree -> Power`
> > 2. Does it really have to be `long long`? I mean, it's neither signed nor practically that huge.
> > 
> Change return types here to `const SCEVConstant *`? Can be an NFC follow-up.
I'll do it in the next NFC patch.


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

https://reviews.llvm.org/D144381



More information about the llvm-commits mailing list