1 //===- MergedLoadStoreMotion.h - merge and hoist/sink load/stores ---------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //! \file
11 //! This pass performs merges of loads and stores on both sides of a
12 //  diamond (hammock). It hoists the loads and sinks the stores.
13 //
14 // The algorithm iteratively hoists two loads to the same address out of a
15 // diamond (hammock) and merges them into a single load in the header. Similar
16 // it sinks and merges two stores to the tail block (footer). The algorithm
17 // iterates over the instructions of one side of the diamond and attempts to
18 // find a matching load/store on the other side. It hoists / sinks when it
19 // thinks it safe to do so.  This optimization helps with eg. hiding load
20 // latencies, triggering if-conversion, and reducing static code size.
21 //
22 //===----------------------------------------------------------------------===//
23 
24 #ifndef LLVM_TRANSFORMS_SCALAR_MERGEDLOADSTOREMOTION_H
25 #define LLVM_TRANSFORMS_SCALAR_MERGEDLOADSTOREMOTION_H
26 
27 #include "llvm/IR/Module.h"
28 #include "llvm/IR/PassManager.h"
29 
30 namespace llvm {
31 class MergedLoadStoreMotionPass
32     : public PassInfoMixin<MergedLoadStoreMotionPass> {
33 public:
34   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
35 };
36 
37 }
38 
39 #endif // LLVM_TRANSFORMS_SCALAR_MERGEDLOADSTOREMOTION_H
40