[llvm] r368339 - [MBP] Disable aggressive loop rotate in plain mode

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 07:50:50 PDT 2019


+other debug info folks

I'm not especially familiar with debug location handling and it's been
going through a lot of work lately to improve quality especially with
optimized debug info, so perhaps they have some more recent info/experience
or can refer you to others that do



On Thu, Aug 15, 2019, 4:00 PM Carrot Wei <carrot at google.com> wrote:

> On Thu, Aug 15, 2019 at 8:10 AM Xinliang David Li <xinliangli at gmail.com>
> wrote:
> >
> > So your patch just triggered the bug?  +David Blaikie.
> >
> It's very likely a debug information bug just triggered by the MBP
> patch according to current finding. My understanding of the debug
> information propagation should not depend on code layout, it depends
> on data flow and control flow.
>
> Before ExtendRanges processing bb62, the MBB looks like
>
> bb.62 (%ir-block.187):
> ; predecessors: %bb.61
>   successors: %bb.63(0x80000000); %bb.63(100.00%)
>   liveins: $edi, $edx
>   renamable $eax = MOV32rm $esi, 1, $noreg, 0, $noreg :: (load 4 from
> %stack.54)
>   MOV32mr $esi, 1, $noreg, 24, $noreg, killed renamable $edx :: (store
> 4 into %stack.56)
>   renamable $edx = MOV32rm $esi, 1, $noreg, 20, $noreg :: (load 4 from
> %stack.55)
>   renamable $eax = SHL32ri killed renamable $eax(tied-def 0), 2,
> implicit-def dead $eflags, debug-location !13658;
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ..
> /../v8/src/torque/csa-generator.cc:76 ] ]
>   renamable $ebx = LEA32r killed renamable $eax, 2, renamable $eax, 0,
> $noreg, debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/to
> rque/csa-generator.cc:76 ] ]
>   renamable $eax = LEA32r $noreg, 4, killed renamable $edi, 0, $noreg,
> debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/torque/csa
> -generator.cc:76 ] ]
>   renamable $eax = LEA32r killed renamable $eax, 2, renamable $eax, 0,
> $noreg, debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/to
> rque/csa-generator.cc:76 ] ]
>   MOV32mr $esi, 1, $noreg, 0, $noreg, killed renamable $eax :: (store
> 4 into %stack.54)
>
> Then it calls join to propagate the debug information from its
> predecessors into bb62, bb62 has only 1 predecessor bb61
>
> bb.61 (%ir-block.177):
> ; predecessors: %bb.60
>   successors: %bb.62(0x40000000), %bb.69(0x40000000); %bb.62(50.00%),
> %bb.69(50.00%)
>   liveins: $eax, $ebx, $ecx, $edx
>   DBG_VALUE $ecx, $noreg, !"range", !DIExpression(DW_OP_LLVM_fragment,
> 0, 32), debug-location !13632; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/torq
> ue/csa-generator.cc:76 ] ] line no:263
>   DBG_VALUE $eax, $noreg, !"i", !DIExpression(), debug-location
> !13633; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] lin
> e no:266
>   DBG_VALUE $eax, $noreg, !"range", !DIExpression(DW_OP_LLVM_fragment,
> 32, 32), debug-location !13632; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/tor
> que/csa-generator.cc:76 ] ] line no:263
>   DBG_VALUE $noreg, $noreg, !"this", !DIExpression(), debug-location
> !13641; ../../v8\src/torque/utils.h:0 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v
> 8/src/torque/csa-generator.cc:76 ] ] ] line no:0
>   DBG_VALUE $noreg, $noreg, !"this", !DIExpression(), debug-location
> !13643; ../../v8\src/torque/utils.h:0 @[
> ../../v8\src/torque/utils.h:261 @[ ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/to
> rque/csa-generator.cc:94 @[ ../../v8/src/torque/csa-generator.cc:76 ]
> ] ] ] line no:0
>   DBG_VALUE $noreg, $noreg, !"this", !DIExpression(), debug-location
> !13645; ../../buildtools/third_party/libc++/trunk/include\vector:0 @[
> ../../v8\src/torque/utils.h:224 @[ ../../v8\src/torque/u
> tils.h:261 @[ ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] ] ] ] line no:0
>   MOV32mr $esi, 1, $noreg, 4, $noreg, killed renamable $eax :: (store
> 4 into %stack.53)
>   DBG_VALUE $esi, 0, !"range", !DIExpression(DW_OP_plus_uconst, 4,
> DW_OP_LLVM_fragment, 32, 32), debug-location !13632;
> ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
>  ../../v8/src/torque/csa-generator.cc:76 ] ] line no:263 indirect
>   renamable $eax = MOV32rm renamable $ebx, 1, $noreg, 4, $noreg,
> debug-location !13647 :: (load 4 from %ir.179);
> ../../buildtools/third_party/libc++/trunk/include\vector:656 @[
> ../../v8\src/torqu
> e/utils.h:224 @[ ../../v8\src/torque/utils.h:261 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] ] ] ]
> renamable $edi = MOV32rm renamable $ebx, 1, $noreg, 0, $noreg,
> debug-location !13647 :: (load 4 from %ir.181);
> ../../buildtools/third_party/libc++/trunk/include\vector:656 @[
> ../../v8\src/torqu
> e/utils.h:224 @[ ../../v8\src/torque/utils.h:261 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] ] ] ]
>   MOV32mr $esi, 1, $noreg, 0, $noreg, killed renamable $ecx :: (store
> 4 into %stack.54)
>   DBG_VALUE $esi, 0, !"range", !DIExpression(DW_OP_LLVM_fragment, 0,
> 32), debug-location !13632; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/torque/cs
> a-generator.cc:76 ] ] line no:263 indirect
>   $ecx = MOV32rr $eax, debug-location !13647;
> ../../buildtools/third_party/libc++/trunk/include\vector:656 @[
> ../../v8\src/torque/utils.h:224 @[ ../../v8\src/torque/utils.h:261 @[
> ../../v8\src/to
> rque/utils.h:266 @[ ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] ] ] ]
>   MOV32mr $esi, 1, $noreg, 20, $noreg, renamable $edi :: (store 4 into
> %stack.55)
>   renamable $ecx = SUB32rr killed renamable $ecx(tied-def 0), killed
> renamable $edi, implicit-def dead $eflags, debug-location !13647;
> ../../buildtools/third_party/libc++/trunk/include\vector:656
>  @[ ../../v8\src/torque/utils.h:224 @[ ../../v8\src/torque/utils.h:261
> @[ ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ]
>  ] ] ]
>   renamable $edi = MOV32rm $esi, 1, $noreg, 4, $noreg :: (load 4 from
> %stack.53)
>   DBG_VALUE $edi, $noreg, !"range", !DIExpression(), debug-location
> !13632; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ]
>  line no:263
>   renamable $ecx = exact SAR32ri killed renamable $ecx(tied-def 0), 2,
> implicit-def dead $eflags, debug-location !13647;
> ../../buildtools/third_party/libc++/trunk/include\vector:656 @[
> ../../v8\s
> rc/torque/utils.h:224 @[ ../../v8\src/torque/utils.h:261 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] ] ] ]
>   renamable $ecx = IMUL32rri killed renamable $ecx, -1431655765,
> implicit-def dead $eflags, debug-location !13647;
> ../../buildtools/third_party/libc++/trunk/include\vector:656 @[
> ../../v8\src/tor
> que/utils.h:224 @[ ../../v8\src/torque/utils.h:261 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ] ] ] ]
>   DBG_VALUE $noreg, $noreg, !"this", !DIExpression(), debug-location
> !13655; ../../v8\src/torque/utils.h:0 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v
> 8/src/torque/csa-generator.cc:76 ] ] ] line no:0
>   DBG_VALUE $noreg, $noreg, !"other", !DIExpression(), debug-location
> !13655; ../../v8\src/torque/utils.h:0 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../
> v8/src/torque/csa-generator.cc:76 ] ] ] line no:169
>   CMP32rr renamable $ecx, renamable $edi, implicit-def $eflags,
> debug-location !13657; ../../v8\src/torque/utils.h:170 @[
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:9
> 4 @[ ../../v8/src/torque/csa-generator.cc:76 ] ] ]
>   JCC_1 %bb.69, 6, implicit $eflags, debug-location !13658;
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ]
>
> This MBB has 5 DBG_VALUE instructions contains information about
> variable "range". Function join adds 2 DBG_VALUE instructions about
> variable "range" to bb62
>
> bb.62 (%ir-block.187):
> ; predecessors: %bb.61
>   successors: %bb.63(0x80000000); %bb.63(100.00%)
>   liveins: $edi, $edx
>   DBG_VALUE $edi, $noreg, !"range", !DIExpression(), debug-location
> !13632; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ]
>  line no:263
>   DBG_VALUE $esi, 0, !"range", !DIExpression(DW_OP_LLVM_fragment, 0,
> 32), debug-location !13632; ../../v8\src/torque/utils.h:0 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/torque/cs
> a-generator.cc:76 ] ] line no:263 indirect
>   renamable $eax = MOV32rm $esi, 1, $noreg, 0, $noreg :: (load 4 from
> %stack.54)
>   MOV32mr $esi, 1, $noreg, 24, $noreg, killed renamable $edx :: (store
> 4 into %stack.56)
>   renamable $edx = MOV32rm $esi, 1, $noreg, 20, $noreg :: (load 4 from
> %stack.55)
>   renamable $eax = SHL32ri killed renamable $eax(tied-def 0), 2,
> implicit-def dead $eflags, debug-location !13658;
> ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ..
> /../v8/src/torque/csa-generator.cc:76 ] ]
>   renamable $ebx = LEA32r killed renamable $eax, 2, renamable $eax, 0,
> $noreg, debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/to
> rque/csa-generator.cc:76 ] ]
>   renamable $eax = LEA32r $noreg, 4, killed renamable $edi, 0, $noreg,
> debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/torque/csa
> -generator.cc:76 ] ]
>   renamable $eax = LEA32r killed renamable $eax, 2, renamable $eax, 0,
> $noreg, debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/to
> rque/csa-generator.cc:76 ] ]
>   MOV32mr $esi, 1, $noreg, 0, $noreg, killed renamable $eax :: (store
> 4 into %stack.54)
>
> Then ExtendRanges process instructions in bb62 one by one.
>
> 1 the first DBG_VALUE instruction, a DebugVariable about var "range"
> without fragment information is added to OpenRanges.
> 2 the second DBG_VALUE instruction, a DebugVariable about var "range"
> with fragment information is added to OpenRanges.
> 3 the first MOV32rm instruction, the DebugVariable associated with the
> second DBG_VALUE instruction is deleted from OpenRanges, a new
> DebugVariable about var "range" without fragment information is added
> to OpenRanges, the new DebugVariable is the same as the one associated
> with the first DBG_VALUE instruction, but with a new ID, the new ID is
> added to OpenRanges.VarLocs, OpenRanges.Vars is a map, so no new
> DebugVariable is added to OpenRanges.Vars, it is just updated to map
> to the new ID. So now OpenRanges.VarLocs and OpenRanges.Vars have
> different number of elements.
>
> Is there anything obviously wrong with these instructions and operations?
>
> thanks
>
> > David
> >
> > On Thu, Aug 15, 2019 at 12:02 AM Carrot Wei via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >>
> >> When function LiveDebugValues::ExtendRanges works on following MBB
> >>
> >> bb.62 (%ir-block.187):
> >> ; predecessors: %bb.61
> >>   successors: %bb.63(0x80000000); %bb.63(100.00%)
> >>   liveins: $edi, $edx
> >>   DBG_VALUE $edi, $noreg, !"range", !DIExpression(), debug-location !136
> >> 32; ../../v8\src/torque/utils.h:0 @[
> >> ../../v8/src/torque/csa-generator.cc:94 @[
> >> ../../v8/src/torque/csa-generator.cc:76 ] ] line no:263
> >>   DBG_VALUE $esi, 0, !"range", !DIExpression(DW_OP_LLVM_fragment, 0, 32)
> >> , debug-location !13632; ../../v8\src/torque/utils.h:0 @[ ../../v8/src/t
> >> orque/csa-generator.cc:94 @[ ../../v8/src/torque/csa-generator.cc:76 ] ]
> >>  line no:263 indirect
> >>   renamable $eax = MOV32rm $esi, 1, $noreg, 0, $noreg :: (load 4 from
> %stack.54)
> >>   MOV32mr $esi, 1, $noreg, 24, $noreg, killed renamable $edx :: (store 4
> >>  into %stack.56)
> >>   renamable $edx = MOV32rm $esi, 1, $noreg, 20, $noreg :: (load 4 from %
> >> stack.55)
> >>   renamable $eax = SHL32ri killed renamable $eax(tied-def 0), 2,
> >> implicit-def dead $eflags, debug-location !13658;
> >> ../../v8\src/torque/utils.h:2
> >> 66 @[ ../../v8/src/torque/csa-generator.cc:94 @[ ../../v8/src/torque/csa
> >> -generator.cc:76 ] ]
> >>   renamable $ebx = LEA32r killed renamable $eax, 2, renamable $eax, 0, $
> >> noreg, debug-location !13658; ../../v8\src/torque/utils.h:266 @[ ../../v
> >> 8/src/torque/csa-generator.cc:94 @[
> ../../v8/src/torque/csa-generator.cc:76 ] ]
> >>   renamable $eax = LEA32r $noreg, 4, killed renamable $edi, 0, $noreg, d
> >> ebug-location !13658; ../../v8\src/torque/utils.h:266 @[ ../../v8/src/to
> >> rque/csa-generator.cc:94 @[ ../../v8/src/torque/csa-generator.cc:76 ] ]
> >>   renamable $eax = LEA32r killed renamable $eax, 2, renamable $eax, 0, $
> >> noreg, debug-location !13658; ../../v8\src/torque/utils.h:266 @[
> >> ../../v8/src/torque/csa-generator.cc:94 @[
> >> ../../v8/src/torque/csa-generator.cc
> >> :76 ] ]
> >>   MOV32mr $esi, 1, $noreg, 0, $noreg, killed renamable $eax :: (store 4
> >> into %stack.54)
> >>
> >> The data structure OpenRanges got inconsistent internal state. Its
> >> field OpenRanges.Vars and OpenRanges.VarLocs should have same number
> >> of elements.
> >>
> >> Before handling the third instruction
> >>
> >> renamable $eax = MOV32rm $esi, 1, $noreg, 0, $noreg :: (load 4 from
> %stack.54)
> >>
> >> Both OpenRanges.Vars and OpenRanges.VarLocs have 2 elements. Then
> >> function insertTransferDebugPair is called, it calls OpenRanges.erase
> >> to delete 1 element from OpenRanges, then both OpenRanges.Vars and
> >> OpenRanges.VarLocs have 1 element. Later OpenRanges.insert is called
> >> for the new fragment, this function adds new element to
> >> OpenRanges.Vars and OpenRanges.VarLocs at the same time, but the
> >> SmallDenseMap OpenRanges.Vars already has the same key, so
> >> OpenRanges.Vars just replaced the old value with new one, it still has
> >> only 1 element, OpenRanges.VarLocs has 2 elements now. Later when
> >> elements are removed from OpenRanges.Vars, OpenRanges.VarLocs still
> >> contains 1 value, and caused the assertion failure in function
> >> OpenRanges.empty.
> >>
> >> I'm not familiar with debug information, could anybody help to give me
> a hint?
> >>
> >> thanks a lot!
> >>
> >> On Tue, Aug 13, 2019 at 10:45 PM Carrot Wei <carrot at google.com> wrote:
> >> >
> >> > I didn't know llvm on linux can cross build windows binary.
> >> > Now I can reproduce it.
> >> >
> >> > On Tue, Aug 13, 2019 at 12:21 AM Hans Wennborg <hans at chromium.org>
> wrote:
> >> > >
> >> > > Did you look at
> >> > > https://bugs.chromium.org/p/chromium/issues/detail?id=992871#c3 ?
> It
> >> > > shows how to reproduce using the tarball on Linux.
> >> > >
> >> > > On Mon, Aug 12, 2019 at 8:17 PM Carrot Wei <carrot at google.com>
> wrote:
> >> > > >
> >> > > > The MBP patch doesn't touch debug information, I suspect there is
> >> > > > something unrelated was triggered.
> >> > > > I tried your tarball, but found it is for windows, I don't have a
> >> > > > windows machine :(. Do you have a linux reproduce? It's even
> better to
> >> > > > have a compiler command line.
> >> > > >
> >> > > > On Mon, Aug 12, 2019 at 7:24 AM Hans Wennborg <hans at chromium.org>
> wrote:
> >> > > > >
> >> > > > > I've reverted this in r368579 since it causes asserts when
> building
> >> > > > > Chromium. See
> https://bugs.chromium.org/p/chromium/issues/detail?id=992871
> >> > > > > for details and reproducer.
> >> > > > >
> >> > > > > On Thu, Aug 8, 2019 at 10:24 PM Guozhi Wei via llvm-commits
> >> > > > > <llvm-commits at lists.llvm.org> wrote:
> >> > > > > >
> >> > > > > > Author: carrot
> >> > > > > > Date: Thu Aug  8 13:25:23 2019
> >> > > > > > New Revision: 368339
> >> > > > > >
> >> > > > > > URL: http://llvm.org/viewvc/llvm-project?rev=368339&view=rev
> >> > > > > > Log:
> >> > > > > > [MBP] Disable aggressive loop rotate in plain mode
> >> > > > > >
> >> > > > > > Patch https://reviews.llvm.org/D43256 introduced more
> aggressive loop layout optimization which depends on profile information.
> If profile information is not available, the statically estimated profile
> information(generated by BranchProbabilityInfo.cpp) is used. If user
> program doesn't behave as BranchProbabilityInfo.cpp expected, the layout
> may be worse.
> >> > > > > >
> >> > > > > > To be conservative this patch restores the original layout
> algorithm in plain mode. But user can still try the aggressive layout
> optimization with -force-precise-rotation-cost=true.
> >> > > > > >
> >> > > > > > Differential Revision: https://reviews.llvm.org/D65673
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> https://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/20190816/5d9cb320/attachment.html>


More information about the llvm-commits mailing list