Skip to content

Commit

Permalink
[loop count assumptions] by default enable loop iteration assumption …
Browse files Browse the repository at this point in the history
…for AIE targets
  • Loading branch information
F-Stuckmann committed Nov 28, 2024
1 parent a81c719 commit deff215
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 1 addition & 3 deletions clang/test/CodeGen/aie/peel-itercount.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
// and that the itercounts have been updated appropriately

// CHECK-LABEL: loop28_37
// CHECK: entry
// CHECK: for.body.preheader:
// CHECK: for.body.peel.next:
// CHECK: for.cond.cleanup:
// CHECK: for.cond.cleanup:
// CHECK: for.body:
// CHECK: !llvm.loop !6
// CHECK: !6 = distinct !{!6, !7, !8, !9}
Expand Down
14 changes: 14 additions & 0 deletions llvm/lib/Target/AIE/AIEBaseTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Transforms/IPO/Internalize.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/LoopIterCountAssumptions.h"

using namespace llvm;

Expand All @@ -56,6 +57,11 @@ static cl::opt<bool>
cl::desc("Enable tail merging for AIE."),
cl::init(false), cl::Hidden);

static cl::opt<bool> EnableLoopIterCountToAssumptions(
"enable-loop-iter-count-assumptions", cl::Hidden, cl::init(true),
cl::desc(
"Enable Conversion of Loop Iteration Count Metadata to Assumptions."));

// Option to run internalize pass.
static cl::opt<bool> InternalizeSymbols(
"aie-internalize-symbols",
Expand Down Expand Up @@ -179,6 +185,14 @@ void AIEBaseTargetMachine::registerPassBuilderCallbacks(
}
});
}

if (EnableLoopIterCountToAssumptions) {
PB.registerPipelineEarlySimplificationEPCallback(
[](ModulePassManager &PM, OptimizationLevel) {
PM.addPass(createModuleToFunctionPassAdaptor(
createFunctionToLoopPassAdaptor(LoopIterCountAssumptions())));
});
}
}

AIEBasePassConfig::AIEBasePassConfig(LLVMTargetMachine &TM, PassManagerBase &PM)
Expand Down

0 comments on commit deff215

Please sign in to comment.