[LLVMdev] Cast to SCEVAddRecExpr

Sanjoy Das sanjoy at playingwithpointers.com
Mon Mar 30 20:52:17 PDT 2015


On Mon, Mar 30, 2015 at 8:39 PM, Nema, Ashutosh <Ashutosh.Nema at amd.com> wrote:
> Hi Nick,
>
> Consider below case:
>
> for (j=1; j < itr; j++) {
>      - - - -
>      for (i=1; i < itr; i++) {
>      {
>        temp=  var[1 << i];
>         - - - - -
>      }
> }
>
> In the above example, we are unable to get "SCEVAddRecExpr" for "var[1 << i]"

I don't think var[1<<i] is not an add recurrence -- it is a mul
recurrence {var,*,2}, and as of right now there is no direct way to
express such a thing in SCEV.

Alternately, we could have a SCEVLeftShiftExpr and express 1<<i as a
SCEVLeftShiftExpr of an SCEVAddRecExpr.

-- Sanjoy



More information about the llvm-dev mailing list