[all-commits] [llvm/llvm-project] 99166f: [SCEVExpander] Add option to preserve LCSSA directly.

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Jul 29 07:08:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 99166fd4fb422351f131fb1265cb85d5f6c5b8da
      https://github.com/llvm/llvm-project/commit/99166fd4fb422351f131fb1265cb85d5f6c5b8da
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-07-29 (Wed, 29 Jul 2020)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp

  Log Message:
  -----------
  [SCEVExpander] Add option to preserve LCSSA directly.

This patch teaches SCEVExpander to directly preserve LCSSA.

As it is currently, SCEV does not look through PHI nodes in loops,
as it might break LCSSA form. Once SCEVExpander can preserve
LCSSA form, it should be safe for SCEV to look through PHIs.

To preserve LCSSA form, this patch uses formLCSSAForInstructions
on operands of newly created instructions, if the definition is inside
a different loop than the new instruction.

The final value we return from expandCodeFor may also need LCSSA
phis, depending on the insert point. As no user for it exists there yet,
create a temporary instruction at the insert point, which can be passed
to formLCSSAForInstructions. This temporary instruction is removed
after LCSSA construction.

Reviewed By: mkazantsev

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




More information about the All-commits mailing list