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

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 07:11:57 PDT 2015


sbaranga created this revision.
sbaranga added a reviewer: sanjoy.
sbaranga added a subscriber: llvm-commits.
Herald added a subscriber: sanjoy.

When forming expressions for phi nodes having an incoming value from
outside the loop A and a value coming from the previous iteration B
we were forming an AddRec if:
  - B was an AddRec
  - the value A was equal to the value for B at iteration -1 (or equal
    to the value of B shifted by one iteration, at iteration 0)

In this case, we were computing the expression to be the expression of
B, shifted by one iteration.

This changes generalizes the logic above by removing the restriction that
B needs to be an AddRec. For this we introduce two expression rewriters
that allow us to
  - shift an expression by one iteration
  - get the value of an expression at iteration 0

This allows us to get SCEV expressions for PHI nodes when these expressions
are not AddRecExprs.

http://reviews.llvm.org/D14175

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/non-IV-phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14175.38735.patch
Type: text/x-patch
Size: 5883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151029/26565d7c/attachment.bin>


More information about the llvm-commits mailing list