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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 12:24:24 PDT 2021


reames created this revision.
reames added reviewers: skatkov, efriedma, qcolombet, atrick.
Herald added subscribers: javed.absar, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

This is a fix for PR43678, and is an alternate patch to D105723 <https://reviews.llvm.org/D105723>.

The basic issue we're running into is that LSR + SCEVExpander are moving the very instruction whose operand we're in the process of expanding.  This breaks the subtle and ill-documented invariant which let LSR work.  (Full story can be found here: https://reviews.llvm.org/D105723#2878473)

Rather than attempting a fix, this change just removes the optimization entirely.  The code is entirely untested, and removing it appears to have no impact I can find.

>From a philosophical standpoint, it also seems very strange to have the expander implementing optimizations which should live in a dedicated transform pass.

This code was added back in 2014 by 1e12f8563d4b7 with a single test which does not seem to actually test the hoisting logic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106178

Files:
  llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/test/Transforms/LoopStrengthReduce/wrong-hoisting-iv.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106178.359409.patch
Type: text/x-patch
Size: 15128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/d3ea048d/attachment.bin>


More information about the llvm-commits mailing list