Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes warnings and adds missing header guards #2124

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions enzyme/Enzyme/ActivityAnalysisPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
// results of a given function.
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_ACTIVITY_ANALYSIS_PRINTER_H
#define ENZYME_ACTIVITY_ANALYSIS_PRINTER_H

#include <llvm/Config/llvm-config.h>

#include "llvm/IR/PassManager.h"
Expand All @@ -46,3 +50,5 @@ class ActivityAnalysisPrinterNewPM final

static bool isRequired() { return true; }
};

#endif // ENZYME_ACTIVITY_ANALYSIS_PRINTER_H
6 changes: 6 additions & 0 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
// LLVM instructions.
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_ADJOINT_GENERATOR_H
#define ENZYME_ADJOINT_GENERATOR_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
Expand Down Expand Up @@ -6414,3 +6418,5 @@ class AdjointGenerator : public llvm::InstVisitor<AdjointGenerator> {
subretused);
}
};

#endif // ENZYME_ADJOINT_GENERATOR_H
3 changes: 1 addition & 2 deletions enzyme/Enzyme/Enzyme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3333,8 +3333,7 @@ extern cl::opt<unsigned> SetLicmMssaOptCap;

void augmentPassBuilder(llvm::PassBuilder &PB) {

auto PB0 = new llvm::PassBuilder(PB);
auto prePass = [PB0](ModulePassManager &MPM, OptimizationLevel Level) {
auto prePass = [](ModulePassManager &MPM, OptimizationLevel Level) {
FunctionPassManager OptimizePM;
OptimizePM.addPass(Float2IntPass());
OptimizePM.addPass(LowerConstantIntrinsicsPass());
Expand Down
5 changes: 5 additions & 0 deletions enzyme/Enzyme/Enzyme.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_H
#define ENZYME_H

#include "llvm/Pass.h"
#include "llvm/Passes/PassBuilder.h"

llvm::ModulePass *createEnzymePass(bool PostOpt = false);
void augmentPassBuilder(llvm::PassBuilder &PB);

#endif // ENZYME_H
15 changes: 0 additions & 15 deletions enzyme/Enzyme/EnzymeLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,21 +1352,6 @@ bool shouldAugmentCall(CallInst *op, const GradientUtils *gutils) {
return modifyPrimal;
}

static inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
ModRefInfo mri) {
if (mri == ModRefInfo::NoModRef)
return os << "nomodref";
else if (mri == ModRefInfo::ModRef)
return os << "modref";
else if (mri == ModRefInfo::Mod)
return os << "mod";
else if (mri == ModRefInfo::Ref)
return os << "ref";
else
llvm_unreachable("unknown modref");
return os;
}

bool legalCombinedForwardReverse(
CallInst *origop,
const std::map<ReturnInst *, StoreInst *> &replacedReturns,
Expand Down
6 changes: 6 additions & 0 deletions enzyme/Enzyme/JLInstSimplify.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
// }
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_JL_INST_SIMPLIFY_H
#define ENZYME_JL_INST_SIMPLIFY_H

#include <llvm/Config/llvm-config.h>

#include "llvm/IR/PassManager.h"
Expand All @@ -41,3 +45,5 @@ class JLInstSimplifyNewPM final

static bool isRequired() { return true; }
};

#endif // ENZYME_JL_INST_SIMPLIFY_H
5 changes: 5 additions & 0 deletions enzyme/Enzyme/MLIR/Interfaces/GradientUtilsReverse.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_MLIR_INTERFACES_GRADIENT_UTILS_REVERSE_H
#define ENZYME_MLIR_INTERFACES_GRADIENT_UTILS_REVERSE_H

#include "mlir/IR/IRMapping.h"
#include "mlir/Interfaces/FunctionInterfaces.h"

Expand Down Expand Up @@ -71,3 +74,5 @@ class MGradientUtilsReverse : public MDiffeGradientUtils {

} // namespace enzyme
} // namespace mlir

#endif // ENZYME_MLIR_INTERFACES_GRADIENT_UTILS_REVERSE_H
5 changes: 5 additions & 0 deletions enzyme/Enzyme/PreserveNVVM.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_PRESERVE_NVVM_H
#define ENZYME_PRESERVE_NVVM_H

#include "llvm/IR/PassManager.h"
#include "llvm/Passes/PassPlugin.h"

Expand All @@ -50,3 +53,5 @@ class PreserveNVVMNewPM final

static bool isRequired() { return true; }
};

#endif // ENZYME_PRESERVE_NVVM_H
5 changes: 5 additions & 0 deletions enzyme/Enzyme/TypeAnalysis/TypeAnalysisPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
//
//===----------------------------------------------------------------------===//

#ifndef ENZYME_TYPE_ANALYSIS_TYPE_ANALYSIS_PRINTER_H
#define ENZYME_TYPE_ANALYSIS_TYPE_ANALYSIS_PRINTER_H

#include "llvm/IR/PassManager.h"
#include "llvm/Passes/PassPlugin.h"

Expand All @@ -45,3 +48,5 @@ class TypeAnalysisPrinterNewPM final

static bool isRequired() { return true; }
};

#endif // ENZYME_TYPE_ANALYSIS_TYPE_ANALYSIS_PRINTER_H
Loading