[PATCH] D106178: [SCEVExpander] Stop hoisting IR when reusing phis

Andrew Trick via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 13:48:56 PDT 2021


atrick added a comment.

I have no objection. AFAIK SCEVExpander is generally just trying to avoid introducing new phis that didn't exist in the original loop. I was never a fan of the whole SCEVExpander approach.

But it seems pretty clear why this was done:

commit 26f567d8a4ea440c6182c793d6946aad5587cfe7
Date:   Sun Feb 16 15:49:50 2014 +0000

  SCEVExpander: Try hard not to create derived induction variables in other loops
  
  During LSR of one loop we can run into a situation where we have to expand the
  start of a recurrence of a loop induction variable in this loop. This start
  value is a value derived of the induction variable of a preceeding loop. SCEV
  has cannonicalized this value to a different recurrence than the recurrence of
  the preceeding loop's induction variable (the type and/or step direction) has
  changed). When we come to instantiate this SCEV we created a second induction
  variable in this preceeding loop.  This patch tries to base such derived
  induction variables of the preceeding loop's induction variable.
  
  This helps twolf on arm and seems to help scimark2 on x86.
  
  Reapply with a fix for the case of a value derived from a pointer.
  
  radar://15970709


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106178



More information about the llvm-commits mailing list