diff options
author | Dehao Chen <dehao@google.com> | 2016-07-11 22:45:24 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2016-07-11 22:45:24 +0000 |
commit | f84fc6de4f0d05e2af4f07cd99aebc35d0631590 (patch) | |
tree | 2a91a4aeab5b124f2740250ab5449f7e97048719 /include | |
parent | 334778a70b0797ed05f8139dc16152368d0487b4 (diff) |
New pass manager for LICM.
Summary: Port LICM to the new pass manager.
Reviewers: davidxl, silvas
Subscribers: silvas, davide, sanjoy, llvm-commits, mehdi_amini
Differential Revision: http://reviews.llvm.org/D21772
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/InitializePasses.h | 2 | ||||
-rw-r--r-- | include/llvm/Transforms/Scalar/LICM.h | 48 |
2 files changed, 49 insertions, 1 deletions
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h index b17a216d328..f4db6fe6f91 100644 --- a/include/llvm/InitializePasses.h +++ b/include/llvm/InitializePasses.h @@ -159,7 +159,7 @@ void initializeInternalizeLegacyPassPass(PassRegistry&); void initializeIntervalPartitionPass(PassRegistry&); void initializeJumpThreadingPass(PassRegistry&); void initializeLCSSAWrapperPassPass(PassRegistry &); -void initializeLICMPass(PassRegistry&); +void initializeLegacyLICMPassPass(PassRegistry&); void initializeLazyValueInfoWrapperPassPass(PassRegistry&); void initializeLintPass(PassRegistry&); void initializeLiveDebugValuesPass(PassRegistry&); diff --git a/include/llvm/Transforms/Scalar/LICM.h b/include/llvm/Transforms/Scalar/LICM.h new file mode 100644 index 00000000000..a050a43d617 --- /dev/null +++ b/include/llvm/Transforms/Scalar/LICM.h @@ -0,0 +1,48 @@ +//===- LICM.h - Loop Invariant Code Motion Pass -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass performs loop invariant code motion, attempting to remove as much +// code from the body of a loop as possible. It does this by either hoisting +// code into the preheader block, or by sinking code to the exit blocks if it is +// safe. This pass also promotes must-aliased memory locations in the loop to +// live in registers, thus hoisting and sinking "invariant" loads and stores. +// +// This pass uses alias analysis for two purposes: +// +// 1. Moving loop invariant loads and calls out of loops. If we can determine +// that a load or call inside of a loop never aliases anything stored to, +// we can hoist it or sink it like any other instruction. +// 2. Scalar Promotion of Memory - If there is a store instruction inside of +// the loop, we try to move the store to happen AFTER the loop instead of +// inside of the loop. This can only happen if a few conditions are true: +// A. The pointer stored through is loop invariant +// B. There are no stores or loads in the loop which _may_ alias the +// pointer. There are no calls in the loop which mod/ref the pointer. +// If these conditions are true, we can promote the loads and stores in the +// loop of the pointer to use a temporary alloca'd variable. We then use +// the SSAUpdater to construct the appropriate SSA form for the value. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TRANSFORMS_SCALAR_LICM_H +#define LLVM_TRANSFORMS_SCALAR_LICM_H + +#include "llvm/Analysis/LoopInfo.h" +#include "llvm/IR/PassManager.h" + +namespace llvm { + +/// Performs Loop Invariant Code Motion Pass. +class LICMPass : public PassInfoMixin<LICMPass> { +public: + PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM); +}; +} // end namespace llvm + +#endif // LLVM_TRANSFORMS_SCALAR_LICM_H |