[PATCH] D63224: Teach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken backedges

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 12:40:07 PDT 2019


reames created this revision.
reames added reviewers: sanjoy, apilipenko, nikic.
Herald added subscribers: javed.absar, bollu, mcrosier.
Herald added a project: LLVM.

This patch really contains two pieces:

1. Teach SCEV how to fold a phi in the header of a loop to the value on the backedge when a) the backedge is known to execute at least once, and b) the value is safe to use globally within the scope dominated by the original phi.
2. Teach IndVarSimplify's rewriteLoopExitValues to allow loop invariant expressions which already exist (and thus don't need new computation inserted) even in loops where we can't optimize away other uses.

Noticed when writing test cases for generalizations of D58113 <https://reviews.llvm.org/D58113>, but otherwise unrelated.


Repository:
  rL LLVM

https://reviews.llvm.org/D63224

Files:
  lib/Analysis/ScalarEvolution.cpp
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/exit_value_tests.ll
  test/Transforms/IndVarSimplify/pr39673.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63224.204342.patch
Type: text/x-patch
Size: 8058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190612/dd16d898/attachment.bin>


More information about the llvm-commits mailing list