2720 Commits

Author SHA1 Message Date
Jeremy Morse
caa2044883 [DebugInfo] Avoid dropping location info across block boundaries
LiveDebugValues propagates variable locations between blocks by creating
new DBG_VALUE insts in the successors, then interpreting them when it
passes back through the block at a later time. However, this flushes out
any extra information about the location that LiveDebugValues holds: for
example, connections between variable locations such as discussed in
D65368. And as reported in PR42772 this causes us to lose track of the
fact that a spill-location is actually a spill, not a register location.

This patch fixes that by deferring the creation of propagated DBG_VALUEs
until after propagation has completed: instead location propagation occurs
only by sharing location ID numbers between blocks. 

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369508 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 09:22:31 +00:00
Jeremy Morse
597125079b [DebugInfo] Make postra sinking of DBG_VALUEs subregister-safe
Currently the machine instruction sinker identifies DBG_VALUE insts that
also need to sink by comparing register numbers. Unfortunately this isn't
safe, because (after register allocation) a DBG_VALUE may read a register
that aliases what's being sunk. To fix this, identify the DBG_VALUEs that
need to sink by recording & examining their register units. Register units
gives us the following guarantee:

  "Two registers overlap if and only if they have a common register unit"
  [MCRegisterInfo.h]

Thus we can always identify aliasing DBG_VALUEs if the set of register
units read by the DBG_VALUE, and the register units of the instruction
being sunk, intersect. (MachineSink already uses classes like
"LiveRegUnits" for determining sinking validity anyway).

The test added checks for super and subregister DBG_VALUE reads of a sunk
copy being sunk as well.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369247 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-19 09:53:07 +00:00
Jeremy Morse
43074ed007 [DebugInfo] Test for variable range un-coalescing
LiveDebugVariables can coalesce ranges of variable locations across
multiple basic blocks. However when it recreates DBG_VALUE instructions,
it has to recreate one DBG_VALUE per block, otherwise it doesn't
represent the pre-regalloc layout and variable assignments can go missing.

This feature works -- however while mucking around with LiveDebugVariables,
I commented the relevant code it out and no tests failed. Thus, here's a
test that checks LiveDebugVariables preserves DBG_VALUEs across block
boundaries.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369243 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-19 09:02:18 +00:00
Jeremy Morse
1375c53904 [DebugInfo] Handle complex expressions with spills in LiveDebugValues
In r369026 we disabled spill-recognition in LiveDebugValues for anything
that has a complex expression. This is because it's hard to recover the
complex expression once the spill location is baked into it.

This patch re-enables spill-recognition and slightly adjusts the DBG_VALUE
insts that LiveDebugValues tracks: instead of tracking the last DBG_VALUE
for a variable, it tracks the last _unspilt_ DBG_VALUE. The spill-restore
code is then able to access and copy the original complex expression; but
the rest of LiveDebugValues has to be aware of the slight semantic shift,
and produce a new spilt location if a spilt location is propagated between
blocks.

The test added produces an incorrect variable location (see FIXME), which
will be the subject of future work.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369092 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-16 10:04:17 +00:00
Jeremy Morse
5a682e0faa [DebugInfo] Avoid crash from dropped fragments in LiveDebugValues
This patch avoids a crash caused by DW_OP_LLVM_fragments being dropped
from DIExpressions by LiveDebugValues spill-restore code. The appearance
of a previously unseen fragment configuration confuses LDV, as documented
in PR42773, and reproduced by the test function this patch adds (Crashes
on a x86_64 debug build).

To avoid this, on spill restore, we now use fragment information from the
spilt-location-expression.

In addition, when spilling, we now don't spill any DBG_VALUE with a complex
expression, as it can't be safely restored and will definitely lead to an
incorrect variable location. The discussion of this is in D65368.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369026 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 17:49:46 +00:00
Taewook Oh
455edbb207 [DebugInfo] Consider debug label scope has an extra lexical block file
Summary: There are places where a case that debug label scope has an extra lexical block file is not considered properly. The modified test won't pass without this patch.

Reviewers: aprantl, HsiangKai

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368891 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:58:45 +00:00
Jonas Devlieghere
db1d61d715 [Dwarf] Complete the list of type tags.
An incorrect verification error revealed that the list of type tags was
incomplete. This patch adds the missing types by adding a tag kind to
the Dwarf.def file, which is used by the `isType` function.

A test was added for the original verification error.

Differential revision: https://reviews.llvm.org/D65914

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368718 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 17:00:54 +00:00
Hans Wennborg
ad324a1d84 Revert r368339 "[MBP] Disable aggressive loop rotate in plain mode"
It caused assertions to fire when building Chromium:

  lib/CodeGen/LiveDebugValues.cpp:331: bool
  {anonymous}::LiveDebugValues::OpenRangesSet::empty() const: Assertion
  `Vars.empty() == VarLocs.empty() && "open ranges are inconsistent"' failed.

See https://crbug.com/992871#c3 for how to reproduce.

> 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368579 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-12 14:23:13 +00:00
David Stenberg
8df59cdc28 [DebugInfo] Remove call sites when eliminating unreachable blocks
Summary:
When eliminating an unreachable block we must remove any call site
information for calls residing in the block.

This was originally found on a downstream target, and the attached x86
test case was produced by hand-modifying some MIR.

Reviewers: aprantl, asowda, NikolaPrica, djtodoro, ivanbaev, vsk

Reviewed By: NikolaPrica, vsk

Subscribers: vsk, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368566 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-12 13:22:29 +00:00
David Blaikie
d7cbb69576 DebugInfo/DWARF: Provide some (pretty half-hearted) error handling access when parsing units
This isn't the most robust error handling API, but does allow clients to
opt-in to getting Errors they can handle. I suspect the long-term
solution would be to move away from the lazy unit parsing and have an
explicit step that parses the unit and then allows access to the other
APIs that require a parsed unit.

llvm-dwarfdump could be expanded to use this (or newer/better API) to
demonstrate the benefit of it - but for now lld will use this in a
follow-up cl which ensures lld can exit non-zero on errors like this (&
provide more descriptive diagnostics including which object file the
error came from).

(error access to later errors when parsing nested DIEs would be good too
- but, again, exposing that without it being a hassle for every consumer
may be tricky)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368377 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-09 01:14:33 +00:00
Guozhi Wei
77558aa8f9 [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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368339 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-08 20:25:23 +00:00
Sander de Smalen
f7c0c16f0f [AArch64][WinCFI] Do not pair callee-save instructions in LoadStoreOptimizer
Prevent the LoadStoreOptimizer from pairing any load/store instructions with
instructions from the prologue/epilogue if the CFI information has encoded the
operations as separate instructions.  This would otherwise lead to a mismatch
of the actual prologue size from the size as recorded in the Windows CFI.

Reviewers: efriedma, mstorsjo, ssijaric

Reviewed By: efriedma

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368164 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 12:41:38 +00:00
Nilanjana Basu
c132cb0db6 Changing representation of .cv_def_range directives in Codeview debug info assembly format for better readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367867 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 14:16:58 +00:00
Nilanjana Basu
e1c95d270d Revert "Changing representation of .cv_def_range directives in Codeview debug info assembly format for better readability"
This reverts commit a885afa9fa8cab3b34f1ddf3d21535f88b662881.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367861 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 13:55:21 +00:00
Nilanjana Basu
ed8791f244 Changing representation of .cv_def_range directives in Codeview debug info assembly format for better readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367850 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 13:11:51 +00:00
Eric Christopher
b9ccc5854b Temporarily Revert "Changing representation of cv_def_range directives in Codeview debug info assembly format for better readability"
This is breaking bots and the author asked me to revert.

This reverts commit 367704.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367707 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-02 19:10:37 +00:00
Nilanjana Basu
fec0188416 Changing representation of cv_def_range directives in Codeview debug info assembly format for better readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367704 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-02 18:44:39 +00:00
Eric Christopher
0927bf13d7 Temporarily revert "Changes to improve CodeView debug info type record inline comments"
due to a sanitizer failure.

This reverts commit 367623.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367640 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-02 01:05:47 +00:00
Nilanjana Basu
8a1fd9ee0c Changes to improve CodeView debug info type record inline comments
Signed-off-by: Nilanjana Basu <nilanjana.basu87@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367623 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 22:05:14 +00:00
Djordje Todorovic
a782d2cb2d Reland "[DwarfDebug] Dump call site debug info"
The build failure found after the rL365467 has been
resolved.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367446 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-31 16:51:28 +00:00
Nilanjana Basu
c9afcce4ec Changes to emit CodeView debug info nested type records properly using MCStreamer directives
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366720 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-22 18:22:55 +00:00
Hsiangkai Wang
82ea6cfac0 [DebugInfo] Some fields do not need relocations even relax is enabled.
In debug frame information, some fields, e.g., Length in CIE/FDE and
Offset in FDE are attributes to describe the structure of CIE/FDE. They
are not related to the relaxed code. However, these attributes are
symbol differences. So, in current design, these attributes will be
filled as zero and LLVM generates relocations for them.

We only need to generate relocations for symbols in executable sections.
So, if the symbols are not located in executable sections, we still
evaluate their values under relaxation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366531 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-19 06:10:36 +00:00
Hsiangkai Wang
b6f810717a [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366524 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-19 02:03:34 +00:00
Hsiangkai Wang
1b3d4c83af Revert "[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame."
This reverts commit 17e3cbf5fe656483d9016d0ba9e1d0cd8629379e.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366444 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 15:06:50 +00:00
Hsiangkai Wang
17e3cbf5fe [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366442 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 14:47:34 +00:00
Alex Bradbury
fd81229099 [RISCV][DebugInfo] Fix dwarf-riscv-relocs.ll test on Windows
Windows sees DW_AT_decl_file (".\dwarf-riscv-relocs.c") while Linux sees
DW_AT_decl_file ("./dwarf-riscv-relocs.c").

This fixes a failure introduced in rL366402.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366410 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 07:25:56 +00:00
Alex Bradbury
bfd9349162 [DWARF][RISCV] Add support for RISC-V relocations needed for debug info
When code relaxation is enabled many RISC-V fixups are not resolved but
instead relocations are emitted. This happens even for DWARF debug
sections. Therefore, to properly support the parsing of DWARF debug info
we need to be able to resolve RISC-V relocations. This patch adds:

* Support for RISC-V relocations in RelocationResolver
* DWARF support for two relocations per object file offset
* DWARF changes to support relocations in more DIE fields

The two relocations per offset change is needed because some RISC-V
relocations (used for label differences) come in pairs.

Relocations can also be emitted for DWARF fields where relocations were
not yet evaluated. Adding relocation support for some of these fields is
essencial. On the other hand, LLVM currently emits RISC-V relocations
for fixups that could be safely evaluated, since they can never be
affected by code relaxations. This patch also adds relocation support
for the fields affected by those extraneous relocations (the DWARF unit
entry Length, and the DWARF debug line entry TotalLength and
PrologueLength), for testing purposes.

Differential Revision: https://reviews.llvm.org/D62062
Patch by Luís Marques.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366402 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 05:22:55 +00:00
Nilanjana Basu
587d5442ae Changes to display code view debug info type records in hex format
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366390 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-17 23:43:58 +00:00
Nilanjana Basu
932274efb6 Adding inline comments to code view type record directives for better readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366372 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-17 21:01:12 +00:00
Alex Bradbury
10494e0311 [RISCV][NFC] Add tests that capture current encodings for DWARF EH
Items which are known to be wrong/different vs GCC are marked as TODO and will
be address in follow-up patches.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366326 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-17 13:48:49 +00:00
David Blaikie
1374e00f70 DWARF: Skip zero column for inline call sites
D64033 <https://reviews.llvm.org/D64033> added DW_AT_call_column for
inline sites. However, that change wasn't aware of "-gno-column-info".
To avoid adding column info when "-gno-column-info" is used, now
DW_AT_call_column is only added when we have non-zero column (when
"-gno-column-info" is used, column will be zero).

Patch by Wenlei He!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366264 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 21:15:19 +00:00
Jonas Devlieghere
70f6aa0117 [DebugInfo] Add column info for inline sites
The column field is missing for all inline sites, currently it's always
zero. This changes populates DW_AT_call_column field for inline sites.
Test case modified to cover this change.

Patch by: Wenlei He

Differential revision: https://reviews.llvm.org/D64033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365945 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 19:25:45 +00:00
Djordje Todorovic
24d43bb78f Revert "[DwarfDebug] Dump call site debug info"
A build failure was found on the SystemZ platform.

This reverts commit 9e7e73578e54cd22b3c7af4b54274d743b6607cc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365886 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 09:45:12 +00:00
Nico Weber
33e880ca3b Make pdbdump-objfilename test work again
- The test had extension .yaml, which lit doesn't execute in this
  directory. Rename to .test to make it run, and move the yaml bits
  into a dedicated file, like with all other tests in this dir.

- llvm-pdbdump got renamed to llvm-pdbutil long ago, update test.

- -dbi-module-info got renamed in r305032, update test for this too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365514 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 17:02:51 +00:00
Djordje Todorovic
9e7e73578e [DwarfDebug] Dump call site debug info
Dump the DWARF information about call sites and call site parameters into
debug info sections.

The patch also provides an interface for the interpretation of instructions
that could load values of a call site parameters in order to generate DWARF
about the call site parameters.

([13/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365467 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 11:33:56 +00:00
Jeremy Morse
f0b251ebc6 Revert r364515 and r364524
Jordan reports on llvm-commits a performance regression with r364515,
backing the patch out while it's investigated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365448 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 09:38:03 +00:00
Djordje Todorovic
7936dfdc22 Reland "[LiveDebugValues] Emit the debug entry values"
Emit replacements for clobbered parameters location if the parameter
has unmodified value throughout the funciton. This is basic scenario
where we can use the debug entry values.

([12/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365444 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 08:36:34 +00:00
Nilanjana Basu
2a69e2802f Changing CodeView debug info type record representation in assembly files to make it more human-readable & editable & fixing bug introduced in r364987
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365417 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 01:11:02 +00:00
Nilanjana Basu
c2427c2dc9 Revert Changing CodeView debug info type record representation in assembly files to make it more human-readable & editable
This reverts r364982 (git commit 2082bf28ebea76cc187b508f801122866420d9ff)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364987 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-03 00:51:49 +00:00
Nilanjana Basu
e94c493e8c Changing CodeView debug info type record representation in assembly files to make it more human-readable & editable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364982 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-03 00:26:23 +00:00
Paul Robinson
2c307d9494 Use --defsym instead of sed in a test. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364929 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-02 14:47:49 +00:00
Jeremy Morse
9ea08046da [DebugInfo] Avoid adding too much indirection to pointer-valued variables
This patch addresses PR41675, where a stack-pointer variable is dereferenced
too many times by its location expression, presenting a value on the stack as
the pointer to the stack.

The difference between a stack *pointer* DBG_VALUE and one that refers to a
value on the stack, is currently the indirect flag. However the DWARF backend
will also try to guess whether something is a memory location or not, based
on whether there is any computation in the location expression. By simply
prepending the stack offset to existing expressions, we can accidentally
convert a register location into a memory location, which introduces a
suprise (and unintended) dereference.

The solution is to add DW_OP_stack_value whenever we add a DIExpression
computation to a stack *pointer*. It's an implicit location computed on the
expression stack, thus needs to be flagged as a stack_value.

For the edge case where the offset is zero and the location could be a register
location, DIExpression::prepend will still generate opcodes, and thus
DW_OP_stack_value must still be added.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364736 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 09:38:23 +00:00
Djordje Todorovic
6998f5cb03 Revert "[LiveDebugValues] Emit the debug entry values"
Appears that the 'test/DebugInfo/MIR/X86/dbginfo-entryvals.mir'
does not pass on Windows.

This reverts commit rL364553.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364571 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-27 18:12:04 +00:00
Djordje Todorovic
068d4d9024 [LiveDebugValues] Emit the debug entry values
Emit replacements for clobbered parameters location if the parameter
has unmodified value throughout the funciton. This is basic scenario
where we can use the debug entry values.

([12/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364553 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-27 15:35:48 +00:00
Jeremy Morse
86b3bad929 Add triple to a test I just added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364524 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-27 11:52:03 +00:00
Jeremy Morse
4a65564b26 [DebugInfo] Avoid register coalesing unsoundly changing DBG_VALUE locations
Once MIR code leaves SSA form and the liveness of a vreg is considered,
DBG_VALUE insts are able to refer to non-live vregs, because their
debug-uses do not contribute to liveness. This non-liveness becomes
problematic for optimizations like register coalescing, as they can't
``see'' the debug uses in the liveness analyses.

As a result registers get coalesced regardless of debug uses, and that can
lead to invalid variable locations containing unexpected values. In the
added test case, the first vreg operand of ADD32rr is merged with various
copies of the vreg (great for performance), but a DBG_VALUE of the
unmodified operand is blindly updated to the modified operand. This changes
what value the variable will appear to have in a debugger.

Fix this by changing any DBG_VALUE whose operand will be resurrected by
register coalescing to be a $noreg DBG_VALUE, i.e. give the variable no
location. This is an overapproximation as some coalesced locations are
safe (others are not) -- an extra domination analysis would be required to
work out which, and it would be better if we just don't generate non-live
DBG_VALUEs.

This fixes PR40010.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364515 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-27 10:20:27 +00:00
Thomas Lively
78cbc90959 [WebAssembly] Implement tail calls and unify tablegen call classes
Summary:
Implements direct and indirect tail calls enabled by the 'tail-call'
feature in both DAG ISel and FastISel. Updates existing call tests and
adds new tests including a binary encoding test.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364445 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-26 16:17:15 +00:00
Amy Huang
d33fc8b267 Store a pointer to the return value in a static alloca and let the debugger use that
as the variable address for NRVO variables.

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363952 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 17:15:21 +00:00
Fangrui Song
d020d45e35 [llvm-dwarfdump] --gdb-index: fix uninitialized TuListOffset
The test only checks the existence of the `Types CU list` line.
Unfortunately I can't make a better test because
{gcc,clang} -fuse-ld={lld,gold} --gdb-index do not give me a non-empty types CU list.

Reviewed By: ikudrin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363800 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-19 13:51:29 +00:00
Orlando Cazalet-Hyams
b1ba8a93bc [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
2019-06-19 10:50:47 +00:00