[llvm] r335513 - [SCEVExp] Advance found insertion point until we find a non-dbg instruction.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 13:48:45 PDT 2018


Hi Florian,

it appears that your commit is breaking this bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/25449/steps/build%20release%20tsan%20with%20clang/logs/stdio

On Mon, Jun 25, 2018 at 12:17 PM, Florian Hahn via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: fhahn
> Date: Mon Jun 25 12:17:29 2018
> New Revision: 335513
>
> URL: http://llvm.org/viewvc/llvm-project?rev=335513&view=rev
> Log:
> [SCEVExp] Advance found insertion point until we find a non-dbg
> instruction.
>
> This avoids creating unnecessary casts if the IP used to be a dbg info
> intrinsic. Fixes PR37727.
>
> Reviewers: vsk, aprantl, sanjoy, efriedma
>
> Reviewed By: vsk, efriedma
>
> Differential Revision: https://reviews.llvm.org/D47874
>
>
> Added:
>     llvm/trunk/test/Transforms/LoopVectorize/scev-expander-debug.ll
> Modified:
>     llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
>
> Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/
> ScalarEvolutionExpander.cpp?rev=335513&r1=335512&r2=335513&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Jun 25
> 12:17:29 2018
> @@ -162,7 +162,8 @@ Value *SCEVExpander::InsertNoopCastOfTo(
>
>    // Cast the instruction immediately after the instruction.
>    Instruction *I = cast<Instruction>(V);
> -  BasicBlock::iterator IP = findInsertPointAfter(I,
> Builder.GetInsertBlock());
> +  BasicBlock::iterator IP = skipDebugInfo(
> +      findInsertPointAfter(I, Builder.GetInsertBlock()));
>    return ReuseOrCreateCast(I, Ty, Op, IP);
>  }
>
> @@ -1480,8 +1481,8 @@ Value *SCEVExpander::visitAddRecExpr(con
>        NewOps[i] = SE.getAnyExtendExpr(S->op_begin()[i],
> CanonicalIV->getType());
>      Value *V = expand(SE.getAddRecExpr(NewOps, S->getLoop(),
>                                         S->getNoWrapFlags(SCEV::FlagNW)));
> -    BasicBlock::iterator NewInsertPt =
> -        findInsertPointAfter(cast<Instruction>(V),
> Builder.GetInsertBlock());
> +    BasicBlock::iterator NewInsertPt = skipDebugInfo(
> +        findInsertPointAfter(cast<Instruction>(V),
> Builder.GetInsertBlock()));
>      V = expandCodeFor(SE.getTruncateExpr(SE.getUnknown(V), Ty), nullptr,
>                        &*NewInsertPt);
>      return V;
>
> Added: llvm/trunk/test/Transforms/LoopVectorize/scev-expander-debug.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> Transforms/LoopVectorize/scev-expander-debug.ll?rev=335513&view=auto
> ============================================================
> ==================
> --- llvm/trunk/test/Transforms/LoopVectorize/scev-expander-debug.ll
> (added)
> +++ llvm/trunk/test/Transforms/LoopVectorize/scev-expander-debug.ll Mon
> Jun 25 12:17:29 2018
> @@ -0,0 +1,61 @@
> +; RUN: opt -loop-vectorize %s -S | FileCheck %s
> +; Tests that the debug intrinsic does not cause additional instructions
> to be
> +; created by SCEVExpander.
> +
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> +
> +%struct.s = type { double* }
> +
> +; CHECK-LABEL: entry:
> +; CHECK: %[[LV:.+]] = load double*, double** %a
> +; CHECK-NEXT: call void @llvm.dbg.value(metadata double* %[[LV]]
> +; CHECK-NEXT: %[[PTI:.+]] = ptrtoint double* %[[LV]] to i64
> +; CHECK-NEXT: %[[MPTR:.+]] = and i64 %[[PTI]], 31
> +; CHECK-NEXT: %[[MCOND:.+]] = icmp eq i64 %[[MPTR]], 0
> +; CHECK-NEXT: br i1 false, label %scalar.ph, label %vector.scevcheck
> +
> +
> +define void @test(%struct.s* %x) !dbg !6 {
> +entry:
> +  %a = getelementptr inbounds %struct.s, %struct.s* %x, i64 0, i32 0
> +  %0 = load double*, double** %a, align 8
> +  call void @llvm.dbg.value(metadata double* %0, metadata !9, metadata
> !DIExpression()), !dbg !11
> +  %ptrint = ptrtoint double* %0 to i64
> +  %maskedptr = and i64 %ptrint, 31
> +  %maskcond = icmp eq i64 %maskedptr, 0
> +  br label %for.body
> +
> +for.body:                                         ; preds = %for.body,
> %entry
> +  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.1, %for.body ]
> +  %arrayidx = getelementptr inbounds double, double* %0, i64 %indvars.iv
> +  %1 = load double, double* %arrayidx, align 16
> +  %add = fadd double %1, 1.000000e+00
> +  store double %add, double* %arrayidx, align 16
> +  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
> +  %arrayidx.1 = getelementptr inbounds double, double* %0, i64
> %indvars.iv.next
> +  %2 = load double, double* %arrayidx.1, align 8
> +  %add.1 = fadd double %2, 1.000000e+00
> +  store double %add.1, double* %arrayidx.1, align 8
> +  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.next, 1
> +  %exitcond.1 = icmp eq i64 %indvars.iv.next, 1599
> +  br i1 %exitcond.1, label %for.end, label %for.body
> +
> +for.end:                                          ; preds = %for.body
> +  ret void
> +}
> +
> +declare void @llvm.dbg.value(metadata, metadata, metadata)
> +
> +!llvm.dbg.cu = !{!0}
> +!llvm.module.flags = !{!5}
> +
> +!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer:
> "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug,
> enums: !2)
> +!1 = !DIFile(filename: "file.ll", directory: "/")
> +!2 = !{}
> +!5 = !{i32 2, !"Debug Info Version", i32 3}
> +!6 = distinct !DISubprogram(name: "test", linkageName: "test", scope:
> null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true,
> scopeLine: 1, isOptimized: true, unit: !0)
> +!7 = !DISubroutineType(types: !2)
> +!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
> +!10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
> +!11 = !DILocation(line: 1, column: 1, scope: !6)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180625/82d1292e/attachment.html>


More information about the llvm-commits mailing list