[DebugInfo@O2][LoopVectorize] pr39024: Vectorized code linenos step through loop...
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>
Wed, 19 Jun 2019 10:50:47 +0000 (10:50 +0000)
committerOrlando Cazalet-Hyams <orlando.hyams@sony.com>
Wed, 19 Jun 2019 10:50:47 +0000 (10:50 +0000)
commitb1ba8a93bc935be2cfed3bfd385c56cba10461b6
tree13d32a8d8a11ee043e8a2746734a628030cfe148
parentc54dc662182f94283a280845516126af96b29751
[DebugInfo@O2][LoopVectorize] pr39024: Vectorized code linenos step through loop even after completion

Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=39024

The bug reports that a vectorized loop is stepped through 4 times and each step through the loop seemed to show a different path. I found two problems here:

A) An incorrect line number on a preheader block (for.body.preheader) instruction causes a step into the loop before it begins.
B) Instructions in the middle block have different line numbers which give the impression of another iteration.

In this patch I give all of the middle block instructions the line number of the scalar loop latch terminator branch. This seems to provide the smoothest debugging experience because the vectorized loops will always end on this line before dropping into the scalar loop. To solve problem A I have altered llvm::SplitBlockPredecessors to accommodate loop header blocks.

I have set up a separate review D61933 for a fix which is required for this patch.

Reviewers: samsonov, vsk, aprantl, probinson, anemet, hfinkel, jmorse

Reviewed By: hfinkel, jmorse

Subscribers: jmorse, javed.absar, eraman, kcc, bjope, jmellorcrummey, hfinkel, gbedwell, hiraditya, zzheng, llvm-commits

Tags: #llvm, #debug-info

Differential Revision: https://reviews.llvm.org/D60831

llvm-svn: 363046

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363786 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
lib/Transforms/Utils/BasicBlockUtils.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
test/DebugInfo/AArch64/inlined-argument.ll
test/Transforms/LoopIdiom/bcmp-debugify-remarks.ll
test/Transforms/LoopIdiom/memset-debugify-remarks.ll
test/Transforms/LoopSimplify/dbg-loc.ll
test/Transforms/LoopSimplify/do-preheader-dbg.ll [new file with mode: 0755]
test/Transforms/LoopSimplify/for-preheader-dbg.ll [new file with mode: 0755]
test/Transforms/LoopUnroll/runtime-loop1.ll
test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
test/Transforms/LoopVectorize/X86/vectorization-remarks-profitable.ll
test/Transforms/LoopVectorize/debugloc.ll
test/Transforms/LoopVectorize/fix-reduction-dbg.ll [new file with mode: 0755]
test/Transforms/LoopVectorize/unsafe-dep-remark.ll