mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Emit warnings if vectorization is forced and fails.
This patch modifies the existing DiagnosticInfo system to create a generic base class that is inherited to produce diagnostic-based warnings. This is used by the loop vectorizer to trigger a warning when vectorization is forced and fails. Several tests have been added to verify this behavior. Reviewed by: Arnold Schwaighofer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213110 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1086,6 +1086,23 @@ private:
|
||||
MDNode *LoopID;
|
||||
};
|
||||
|
||||
static void emitMissedWarning(Function *F, Loop *L,
|
||||
const LoopVectorizeHints &LH) {
|
||||
emitOptimizationRemarkMissed(F->getContext(), DEBUG_TYPE, *F,
|
||||
L->getStartLoc(), LH.emitRemark());
|
||||
|
||||
if (LH.getForce() == LoopVectorizeHints::FK_Enabled) {
|
||||
if (LH.getWidth() != 1)
|
||||
emitLoopVectorizeWarning(
|
||||
F->getContext(), *F, L->getStartLoc(),
|
||||
"failed explicitly specified loop vectorization");
|
||||
else if (LH.getUnroll() != 1)
|
||||
emitLoopInterleaveWarning(
|
||||
F->getContext(), *F, L->getStartLoc(),
|
||||
"failed explicitly specified loop interleaving");
|
||||
}
|
||||
}
|
||||
|
||||
static void addInnerLoop(Loop &L, SmallVectorImpl<Loop *> &V) {
|
||||
if (L.empty())
|
||||
return V.push_back(&L);
|
||||
@ -1241,8 +1258,7 @@ struct LoopVectorize : public FunctionPass {
|
||||
LoopVectorizationLegality LVL(L, SE, DL, DT, TLI, F);
|
||||
if (!LVL.canVectorize()) {
|
||||
DEBUG(dbgs() << "LV: Not vectorizing: Cannot prove legality.\n");
|
||||
emitOptimizationRemarkMissed(F->getContext(), DEBUG_TYPE, *F,
|
||||
L->getStartLoc(), Hints.emitRemark());
|
||||
emitMissedWarning(F, L, Hints);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1276,8 +1292,7 @@ struct LoopVectorize : public FunctionPass {
|
||||
emitOptimizationRemarkAnalysis(
|
||||
F->getContext(), DEBUG_TYPE, *F, L->getStartLoc(),
|
||||
"loop not vectorized due to NoImplicitFloat attribute");
|
||||
emitOptimizationRemarkMissed(F->getContext(), DEBUG_TYPE, *F,
|
||||
L->getStartLoc(), Hints.emitRemark());
|
||||
emitMissedWarning(F, L, Hints);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user