[PATCH] D39985: [SCEV] Apply a single debug loc when expanding a SCEV

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 15:18:13 PST 2017


vsk created this revision.

The SCEV expander currently applies debug locations to generated code
based on which location is set at the insertion point. This isn't always
the correct location to apply (see PR25630).

Following the suggestion in the bug report, this patch solves the
problem by introducing an overload of expandCodeFor() which accepts a
DebugLoc. This single location is applied to all instructions generated
while expanding a SCEV.

The existing expand...() methods are updated to use a special location
which conveys that line table information for the expanded code is
unknown. If the function has debug information attached, this special
location is <file>:0:0. Otherwise, the location is empty. The end result
should be conservatively correct.

The existing expand...() methods and are also deprecated. My plan is to
audit calls to the deprecated methods and replace them, one-by-one, by
calls which set an appropriate DebugLoc.

Testing: check-llvm

Depends on https://reviews.llvm.org/D39982


https://reviews.llvm.org/D39985

Files:
  include/llvm/Analysis/ScalarEvolutionExpander.h
  lib/Analysis/ScalarEvolutionExpander.cpp
  unittests/Analysis/ScalarEvolutionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39985.122737.patch
Type: text/x-patch
Size: 31062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171113/c7f9df9d/attachment.bin>


More information about the llvm-commits mailing list