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 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 D39982
I think DebugLoc is already a value type, so there is no point in passing it by reference.