[PATCH] Don't try to emit loopVectorize warning if DebugLoc isn't available

Duncan Exon Smith dexonsmith at apple.com
Sat May 2 22:26:15 PDT 2015


Would it be better to make emitOptimizationRemarkMissed() resilient to a null DebugLoc?   It seems strange to require debug info to print pass remarks.

-- dpnes

> On May 2, 2015, at 9:25 PM, Davide Italiano <dccitaliano at gmail.com> wrote:
> 
> Hi nadav, dexonsmith,
> 
> This is a (hopefullly) reasonable attempt to fix PR23380 
> https://llvm.org/bugs/show_bug.cgi?id=23380
> 
> REPOSITORY
>  rL LLVM
> 
> http://reviews.llvm.org/D9463
> 
> Files:
>  lib/Transforms/Vectorize/LoopVectorize.cpp
> 
> Index: lib/Transforms/Vectorize/LoopVectorize.cpp
> ===================================================================
> --- lib/Transforms/Vectorize/LoopVectorize.cpp
> +++ lib/Transforms/Vectorize/LoopVectorize.cpp
> @@ -1144,17 +1144,20 @@
> 
> static void emitMissedWarning(Function *F, Loop *L,
>                               const LoopVectorizeHints &LH) {
> +  DebugLoc DL = L->getStartLoc();
> +  if (!DL)
> +    return;
>   emitOptimizationRemarkMissed(F->getContext(), DEBUG_TYPE, *F,
> -                               L->getStartLoc(), LH.emitRemark());
> +                               DL, LH.emitRemark());
> 
>   if (LH.getForce() == LoopVectorizeHints::FK_Enabled) {
>     if (LH.getWidth() != 1)
>       emitLoopVectorizeWarning(
> -          F->getContext(), *F, L->getStartLoc(),
> +          F->getContext(), *F, DL,
>           "failed explicitly specified loop vectorization");
>     else if (LH.getInterleave() != 1)
>       emitLoopInterleaveWarning(
> -          F->getContext(), *F, L->getStartLoc(),
> +          F->getContext(), *F, DL,
>           "failed explicitly specified loop interleaving");
>   }
> }
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> <D9463.24863.patch>




More information about the llvm-commits mailing list