[PATCH] D14175: [SCEV] Generalize the SCEV algorithm for creating expressions for PHI nodes

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 30 07:33:31 PDT 2015


sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.

My previous comment was not correct, so no need to address it.  But please add a one line documentation for the two rewriters you added (something like `F({S,+,X}) ==> F({S-X,+,X})` would be fine).


================
Comment at: lib/Analysis/ScalarEvolution.cpp:3818
@@ +3817,3 @@
+      // by one iteration.
+      const SCEV *Shifted = SCEVShiftRewriter::rewrite(BEValue, L, *this);
+      const SCEV *Start = SCEVInitRewriter::rewrite(Shifted, L, *this);
----------------
sanjoy wrote:
> Why not do `{A,+,B}` => `(A-B)` as a single transform?
> 
> Also, a nice way to document this rule is (totally up to you if you like this language):
> 
> ```
> PHI(f(I), f({I+S,+,S})) --> f({I,+,S})
> ```
> 
Actually, I'll take back that comment -- you need to use `Shift` below.


http://reviews.llvm.org/D14175





More information about the llvm-commits mailing list