-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AArch64] Allow unrolling of scalar epilogue loops #151164
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4905,14 +4905,17 @@ void AArch64TTIImpl::getUnrollingPreferences( | |
| // Disable partial & runtime unrolling on -Os. | ||
| UP.PartialOptSizeThreshold = 0; | ||
|
|
||
| // No need to unroll auto-vectorized loops | ||
| if (findStringMetadataForLoop(L, "llvm.loop.isvectorized")) | ||
| return; | ||
|
|
||
| // Scan the loop: don't unroll loops with calls as this could prevent | ||
| // inlining. | ||
| // inlining. Don't unroll auto-vectorized loops either, though do allow | ||
| // unrolling of the scalar remainder. | ||
| bool IsVectorized = getBooleanLoopAttribute(L, "llvm.loop.isvectorized"); | ||
| for (auto *BB : L->getBlocks()) { | ||
| for (auto &I : *BB) { | ||
| // Both auto-vectorized loops and the scalar remainder have the | ||
| // isvectorized attribute, so differentiate between them by the presence | ||
| // of vector instructions. | ||
| if (IsVectorized && I.getType()->isVectorTy()) | ||
| return; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setting an attribute or a field to the Loop instance telling "remainder of a loop that has isvectorized attribute" would help. Each of the loop variant its run through
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In LV, you mean? Yes, I think this would be a good addition. |
||
| if (isa<CallBase>(I)) { | ||
| if (isa<CallInst>(I) || isa<InvokeInst>(I)) | ||
| if (const Function *F = cast<CallBase>(I).getCalledFunction()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that we now may also allow to unroll is loops that are only interleaved by LV I think, but that was the same before, so should be fine for now.