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 Dec 3, 2024
1 parent d61d077 commit 33c04f6
Show file tree
Hide file tree
Showing 2 changed files with 16 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
15 changes: 15 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,15 @@ void AIEBaseTargetMachine::registerPassBuilderCallbacks(
}
});
}

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

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

0 comments on commit 33c04f6

Please sign in to comment.