[all-commits] [llvm/llvm-project] d9a4a2: Add CanonicalizeFreezeInLoops pass

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Wed May 20 17:29:47 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d9a4a244138c4ec7dcc1b316e2ca57c9c833bf6c
      https://github.com/llvm/llvm-project/commit/d9a4a244138c4ec7dcc1b316e2ca57c9c833bf6c
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2020-05-21 (Thu, 21 May 2020)

  Changed paths:
    M llvm/include/llvm/InitializePasses.h
    M llvm/include/llvm/Transforms/Utils.h
    A llvm/include/llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Transforms/Utils/CMakeLists.txt
    A llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
    M llvm/lib/Transforms/Utils/Utils.cpp
    A llvm/test/Transforms/CanonicalizeFreezeInLoops/func_from_mcf_r.ll
    A llvm/test/Transforms/CanonicalizeFreezeInLoops/nonsteps-preserve-flags.ll
    A llvm/test/Transforms/CanonicalizeFreezeInLoops/onephi.ll
    A llvm/test/Transforms/CanonicalizeFreezeInLoops/phis.ll

  Log Message:
  -----------
  Add CanonicalizeFreezeInLoops pass

Summary:
If an induction variable is frozen and used, SCEV yields imprecise result
because it doesn't say anything about frozen variables.

Due to this reason, performance degradation happened after
https://reviews.llvm.org/D76483 is merged, causing
SCEV yield imprecise result and preventing LSR to optimize a loop.

The suggested solution here is to add a pass which canonicalizes frozen variables
inside a loop. To be specific, it pushes freezes out of the loop by freezing
the initial value and step values instead & dropping nsw/nuw flags from instructions used by freeze.
This solution was also mentioned at https://reviews.llvm.org/D70623 .

Reviewers: spatel, efriedma, lebedev.ri, fhahn, jdoerfert

Reviewed By: fhahn

Subscribers: nikic, mgorny, hiraditya, javed.absar, llvm-commits, sanwou01, nlopes

Tags: #llvm

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




More information about the All-commits mailing list