mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Introduce runtime unrolling disable matadata and use it to mark the scalar loop from vectorization.
Runtime unrolling is an expensive optimization which can bring benefit only if the loop is hot and iteration number is relatively large enough. For some loops, we know they are not worth to be runtime unrolled. The scalar loop from vectorization is one of the cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -619,6 +619,11 @@ static bool HasUnrollDisablePragma(const Loop *L) {
|
||||
return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.disable");
|
||||
}
|
||||
|
||||
// Returns true if the loop has an runtime unroll(disable) pragma.
|
||||
static bool HasRuntimeUnrollDisablePragma(const Loop *L) {
|
||||
return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.runtime.disable");
|
||||
}
|
||||
|
||||
// If loop has an unroll_count pragma return the (necessarily
|
||||
// positive) value from the pragma. Otherwise return 0.
|
||||
static unsigned UnrollCountPragmaValue(const Loop *L) {
|
||||
@ -807,6 +812,9 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
// Reduce count based on the type of unrolling and the threshold values.
|
||||
unsigned OriginalCount = Count;
|
||||
bool AllowRuntime = UserRuntime ? CurrentRuntime : UP.Runtime;
|
||||
if (HasRuntimeUnrollDisablePragma(L)) {
|
||||
AllowRuntime = false;
|
||||
}
|
||||
if (Unrolling == Partial) {
|
||||
bool AllowPartial = UserAllowPartial ? CurrentAllowPartial : UP.Partial;
|
||||
if (!AllowPartial && !CountSetExplicitly) {
|
||||
|
Reference in New Issue
Block a user