[DebugInfo] Fix pr41180 : Loop Vectorization Debugify Failure
authorVedant Kumar <vsk@apple.com>
Tue, 2 Apr 2019 17:28:34 +0000 (17:28 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 2 Apr 2019 17:28:34 +0000 (17:28 +0000)
commitc6bceec01a4bc89757d17a615d08f8f346c59c36
tree4f78e27d39d55427a60ca2a9389f911b6e363d12
parent7cb7daabbbe72399a56d6d27eeb28eaf66aa238b
[DebugInfo] Fix pr41180 : Loop Vectorization Debugify Failure

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

In the bug test case the debug location was missing for the cmp instruction in
the "middle block" BB. This patch fixes the bug by copying the debug location
from the cmp of the scalar loop's terminator branch, if it exists.

The patch also fixes the debug location on the subsequent branch instruction.
It was previously using the location of the of the original loop's pre-header
block terminator. Both of these instructions will now map to the source line of
the conditional branch in the original loop.

A regression test has been added that covers these issues.

Patch by Orlando Cazalet-Hyams!

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

llvm-svn: 357499
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/middle-block-dbg.ll [new file with mode: 0644]