@@ -182,14 +182,41 @@ void LoopVectorizeHints::setAlreadyVectorized() {
182
182
bool LoopVectorizeHints::allowVectorization (
183
183
Function *F, Loop *L, bool VectorizeOnlyWhenForced) const {
184
184
if (getForce () == LoopVectorizeHints::FK_Disabled) {
185
- LLVM_DEBUG (dbgs () << " LV: Not vectorizing: #pragma vectorize disable.\n " );
186
- emitRemarkWithHints ();
185
+ if (Force.Value == LoopVectorizeHints::FK_Disabled) {
186
+ LLVM_DEBUG (dbgs () << " LV: Not vectorizing: #pragma vectorize disable.\n " );
187
+ ORE.emit (OptimizationRemarkMissed (LV_NAME, " MissedExplicitlyDisabled" ,
188
+ TheLoop->getStartLoc (),
189
+ TheLoop->getHeader ())
190
+ << " loop not vectorized: vectorization is explicitly disabled" );
191
+ } else if (hasDisableAllTransformsHint (TheLoop)) {
192
+ LLVM_DEBUG (
193
+ dbgs () << " LV: Not vectorizing: loop hasDisableAllTransformsHint.\n " );
194
+ ORE.emit (OptimizationRemarkMissed (LV_NAME, " MissedTrafoDisabled" ,
195
+ TheLoop->getStartLoc (),
196
+ TheLoop->getHeader ())
197
+ << " loop not vectorized: loop transformations are disabled" );
198
+ } else {
199
+ // This should be unreachable unless there is a bug.
200
+ LLVM_DEBUG (
201
+ dbgs () << " LV: [FIXME] Not vectorizing: loop vect disabled for "
202
+ " an unknown reason!\n " );
203
+ ORE.emit (OptimizationRemarkMissed (LV_NAME, " MissedUnknown" ,
204
+ TheLoop->getStartLoc (),
205
+ TheLoop->getHeader ())
206
+ << " loop not vectorized: unknown reason, please file a bug "
207
+ " report on the LLVM issue tracker" );
208
+ }
187
209
return false ;
188
210
}
189
211
190
212
if (VectorizeOnlyWhenForced && getForce () != LoopVectorizeHints::FK_Enabled) {
191
- LLVM_DEBUG (dbgs () << " LV: Not vectorizing: No #pragma vectorize enable.\n " );
192
- emitRemarkWithHints ();
213
+ LLVM_DEBUG (dbgs () << " LV: Not vectorizing: VectorizeOnlyWhenForced is set, "
214
+ " and no #pragma vectorize enable.\n " );
215
+ ORE.emit (OptimizationRemarkMissed (LV_NAME, " MissedForceOnly" ,
216
+ TheLoop->getStartLoc (),
217
+ TheLoop->getHeader ())
218
+ << " loop not vectorized: only vectorizing loops that "
219
+ " explicitly request it" );
193
220
return false ;
194
221
}
195
222
0 commit comments