Enzyme main
Loading...
Searching...
No Matches
SimpleGVN.h
Go to the documentation of this file.
1//=- SimpleGVN.h - GVN-like load forwarding optimization ================//
2//
3// Enzyme Project
4//
5// Part of the Enzyme Project, under the Apache License v2.0 with LLVM
6// Exceptions. See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9// If using this code in an academic setting, please cite the following:
10// @incollection{enzymeNeurips,
11// title = {Instead of Rewriting Foreign Code for Machine Learning,
12// Automatically Synthesize Fast Gradients},
13// author = {Moses, William S. and Churavy, Valentin},
14// booktitle = {Advances in Neural Information Processing Systems 33},
15// year = {2020},
16// note = {To appear in},
17// }
18//
19//===----------------------------------------------------------------------===//
20//
21// This file declares SimpleGVN, a GVN-like optimization pass that forwards
22// loads from noalias/nocapture arguments to their corresponding stores.
23//
24// This pass provides an alternative to LLVM's built-in GVN pass without the
25// instruction/offset limit imposed by memdep analysis, allowing it to handle
26// cases with large numbers of memory operations and offsets.
27//
28//===----------------------------------------------------------------------===//
29
30#ifndef ENZYME_SIMPLE_GVN_H
31#define ENZYME_SIMPLE_GVN_H
32
33#include <llvm/Config/llvm-config.h>
34
35#include "PassUtils.h"
36#include "llvm/IR/PassManager.h"
37
38namespace llvm {
39class FunctionPass;
40}
41
42class SimpleGVNNewPM final : public PassParent<SimpleGVNNewPM> {
44
45private:
46 static llvm::AnalysisKey Key;
47
48public:
49 using Result = llvm::PreservedAnalyses;
51
52 Result run(llvm::Function &F, llvm::FunctionAnalysisManager &FAM);
53
54 static bool isRequired() { return true; }
55};
56
57#endif // ENZYME_SIMPLE_GVN_H
llvm::PreservedAnalyses Result
Definition SimpleGVN.h:49
Result run(llvm::Function &F, llvm::FunctionAnalysisManager &FAM)
static bool isRequired()
Definition SimpleGVN.h:54