]> granicus.if.org Git - llvm/commit
Teach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken...
authorPhilip Reames <listmail@philipreames.com>
Mon, 17 Jun 2019 21:06:17 +0000 (21:06 +0000)
committerPhilip Reames <listmail@philipreames.com>
Mon, 17 Jun 2019 21:06:17 +0000 (21:06 +0000)
commit10c34d1b8ddc5591d95ac4b170b04ad77c2a3d6c
treef6e962d29f60dc9c2963e717c1cc1e607f0d3cd6
parentb31d1763674f4464952feafc04b22f81dd372fa6
Teach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken backedges

This patch really contains two pieces:
    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.
    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.

Differential Revision: https://reviews.llvm.org/D63224

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363619 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/exit_value_tests.ll
test/Transforms/IndVarSimplify/pr39673.ll