-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[LV] Emit better debug and opt-report messages when vectorization is disallowed in the LoopVectorizer #158513
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
81f1800
6d941ff
c0e6aec
c290bec
109b3fd
3c4c8de
fa19ccc
29d1fa2
117c358
2241343
98a90e9
55af5ac
120a5bf
a509ea9
bc68571
c6a624d
d4f407b
5d656e8
0a933b2
6dfffe8
936d9e3
b895a97
8173da8
835f8f0
7f9fe50
552a8ab
dcd926f
86515c5
5f7c8b0
96d6136
6c1932e
8e0c12b
1ec46e8
f530fd5
60f86af
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 |
|---|---|---|
|
|
@@ -182,14 +182,41 @@ void LoopVectorizeHints::setAlreadyVectorized() { | |
| bool LoopVectorizeHints::allowVectorization( | ||
| Function *F, Loop *L, bool VectorizeOnlyWhenForced) const { | ||
| if (getForce() == LoopVectorizeHints::FK_Disabled) { | ||
| LLVM_DEBUG(dbgs() << "LV: Not vectorizing: #pragma vectorize disable.\n"); | ||
| emitRemarkWithHints(); | ||
| if (Force.Value == LoopVectorizeHints::FK_Disabled) { | ||
| LLVM_DEBUG(dbgs() << "LV: Not vectorizing: #pragma vectorize disable.\n"); | ||
| ORE.emit(OptimizationRemarkMissed(LV_NAME, "MissedExplicitlyDisabled", | ||
| TheLoop->getStartLoc(), | ||
| TheLoop->getHeader()) | ||
| << "loop not vectorized: vectorization is explicitly disabled"); | ||
|
||
| } else if (hasDisableAllTransformsHint(TheLoop)) { | ||
| LLVM_DEBUG( | ||
| dbgs() << "LV: Not vectorizing: loop hasDisableAllTransformsHint.\n"); | ||
| ORE.emit(OptimizationRemarkMissed(LV_NAME, "MissedTransformsDisabled", | ||
| TheLoop->getStartLoc(), | ||
| TheLoop->getHeader()) | ||
| << "loop not vectorized: loop transformations are disabled"); | ||
| } else { | ||
| // This should be unreachable unless there is a bug. | ||
| LLVM_DEBUG( | ||
| dbgs() << "LV: [FIXME] Not vectorizing: loop vect disabled for " | ||
| "an unknown reason!\n"); | ||
| ORE.emit(OptimizationRemarkMissed(LV_NAME, "MissedUnknown", | ||
| TheLoop->getStartLoc(), | ||
| TheLoop->getHeader()) | ||
| << "loop not vectorized: unknown reason, please file a bug " | ||
| "report on the LLVM issue tracker"); | ||
TiborGY marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| return false; | ||
| } | ||
|
|
||
| if (VectorizeOnlyWhenForced && getForce() != LoopVectorizeHints::FK_Enabled) { | ||
| LLVM_DEBUG(dbgs() << "LV: Not vectorizing: No #pragma vectorize enable.\n"); | ||
| emitRemarkWithHints(); | ||
| LLVM_DEBUG(dbgs() << "LV: Not vectorizing: VectorizeOnlyWhenForced is set, " | ||
| "and no #pragma vectorize enable.\n"); | ||
| ORE.emit(OptimizationRemarkMissed(LV_NAME, "MissedForceOnly", | ||
| TheLoop->getStartLoc(), | ||
| TheLoop->getHeader()) | ||
| << "loop not vectorized: only vectorizing loops that " | ||
| "explicitly request it"); | ||
| return false; | ||
| } | ||
|
|
||
|
|
||
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.
Why is this duplicated from emitRemarkWithHints?
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.
I am planning to refactor and rename emitRemarkWithHints in a future PR. Its name does not reflect well what it is doing and it does not let the caller emit a remark more specific than "loop not vectorized". So for now, I have inlined the relevant part of emitRemarkWithHints here.