Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/enzyme-mlir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: 'llvm/llvm-project'
ref: '615644763ffcfc939bda59e9f3e71d6e7d9fd264'
ref: 'fb423ba07c3ff51fda3caa41d8bbb78d50f61906'
path: 'llvm-project'

- name: Set BASE_DIR
Expand Down
17 changes: 15 additions & 2 deletions enzyme/Enzyme/Enzyme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3135,7 +3135,7 @@ AnalysisKey EnzymeNewPM::Key;

static InlineParams getInlineParamsFromOptLevel(OptimizationLevel Level) {
#if LLVM_VERSION_MAJOR >= 23
return getInlineParams(Level.getSpeedupLevel());
return getInlineParamsFromOptLevel(static_cast<unsigned>(Level));

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously passing the optimization level to an API accepting an inlining threshold ... so this was effectively setting a very low inlining threshold.

#else
return getInlineParams(Level.getSpeedupLevel(), Level.getSizeLevel());
#endif
Expand Down Expand Up @@ -3271,7 +3271,12 @@ void augmentPassBuilder(llvm::PassBuilder &PB) {
// system libraries and other oracles.
MPM.addPass(InferFunctionAttrsPass());

if (Level.getSpeedupLevel() > 1) {
#if LLVM_VERSION_MAJOR >= 23
if (Level > OptimizationLevel::O1)
#else
if (Level.getSpeedupLevel() > 1)
#endif
{
MPM.addPass(createModuleToFunctionPassAdaptor(CallSiteSplittingPass(),
EagerlyInvalidateAnalyses));

Expand Down Expand Up @@ -3345,7 +3350,11 @@ void augmentPassBuilder(llvm::PassBuilder &PB) {
// have to resolve varargs calls, etc, so let instcombine do this.
FunctionPassManager PeepholeFPM;
PeepholeFPM.addPass(InstCombinePass());
#if LLVM_VERSION_MAJOR >= 23
if (Level > OptimizationLevel::O1)
#else
if (Level.getSpeedupLevel() > 1)
#endif
PeepholeFPM.addPass(AggressiveInstCombinePass());

MPM.addPass(createModuleToFunctionPassAdaptor(std::move(PeepholeFPM),
Expand Down Expand Up @@ -3483,7 +3492,11 @@ void augmentPassBuilder(llvm::PassBuilder &PB) {
MainFPM.addPass(MergedLoadStoreMotionPass());

LoopPassManager LPM;
#if LLVM_VERSION_MAJOR >= 23
if (EnableLoopFlatten && Level > OptimizationLevel::O1)
#else
if (EnableLoopFlatten && Level.getSpeedupLevel() > 1)
#endif
LPM.addPass(LoopFlattenPass());
LPM.addPass(IndVarSimplifyPass());
LPM.addPass(LoopDeletionPass());
Expand Down
Loading