1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
Commit Graph

2995 Commits

Author SHA1 Message Date
Russell Gallop
1df74a286a [DebugInfo] Fix test Fortran-DIModule.ll after 678bd84c4
Was failing here:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32320
2020-05-13 15:27:44 +01:00
Sourabh Singh Tomar
71478d79e5 [DebugInfo] Fixes windows bot failure due to a test failure
This fixes failures on windows bot specifically:

http://lab.llvm.org:8011/builders/lld-x86_64-win/builds/445
and http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/
builds/32314

* TEST 'LLVM :: DebugInfo/X86/Fortran-DIModule.ll' FAILED *
Script:
--
: 'RUN: at line 2';   c:\ps4-buildslave2\lld-x86_64-win\build\bin\llc.exe
-mtriple=x86_64-pc-windows-gnu
c:\ps4-buildslave2\lld-x86_64-win\llvm-project\llvm\test\DebugInfo\X86\Fortran-DIModule.ll
-filetype=obj -o - |    c:\ps4-buildslave2\lld-x86_64-win\build\bin\llvm-dwarfdump.exe - |
 c:\ps4-buildslave2\lld-x86_64-win\build\bin\filecheck.exe
c:\ps4-buildslave2\lld-x86_64-win\llvm-project\llvm\test\DebugInfo\X86\Fortran-DIModule.ll
--
Exit Code: 1
error: command failed with exit status: 1
2020-05-13 14:34:47 +05:30
Sourabh Singh Tomar
99bc9bdea6 [DebugInfo] Fortran module DebugInfo support in LLVM
This patch extends DIModule Debug metadata in LLVM to support
Fortran modules. DIModule is extended to contain File and Line
fields, these fields will be used by Flang FE to create debug
information necessary for representing Fortran modules at IR level.

Furthermore DW_TAG_module is also extended to contain these fields.
If these fields are missing, debuggers like GDB won't be able to
show Fortran modules information correctly.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D79484
2020-05-13 12:52:30 +05:30
Sourabh Singh Tomar
412512e2cd [DWARF5]: Added support for dumping strx forms in llvm-dwarfdump
This patch adds support for dumping DW_MACRO_define_strx,
DW_MACRO_undef_strx in llvm-dwarfdump. These forms are currently
supported only in debug_macro section.

Reviewed By: ikudrin, dblaikie

Differential Revision: https://reviews.llvm.org/D78736
2020-05-12 10:29:18 +05:30
OCHyams
5a1aa7d07d [NFC][DwarfDebug] Add test for variables with a single location which
don't span their entire scope.

The previous commit (6d1c40c171e) is an older version of the test.

Reviewed By: aprantl, vsk

Differential Revision: https://reviews.llvm.org/D79573
2020-05-11 09:43:30 +01:00
OCHyams
7cbe1e2d68 [NFC][DwarfDebug] Add test for variables with a single location which
don't span their entire scope.

Reviewed By: aprantl, vsk

Differential Revision: https://reviews.llvm.org/D79573
2020-05-11 09:36:49 +01:00
Igor Kudrin
f3f7971c5c [DebugInfo] Dump raw data in a case of decoding error of an expression.
It looks like that was an initial intention, but some code paths in
`DWARFExpression::Operation::extract()` did not initialize `EndOffset`
properly.

Differential Revision: https://reviews.llvm.org/D79622
2020-05-09 10:04:22 +07:00
Ricky Zhou
30d6c2bb93 [SimplifyCFG] Remap rewritten debug intrinsic operands.
FoldBranchToCommonDest clones instructions to a different basic block,
but handles debug intrinsics in a separate path. Previously, when
cloning debug intrinsics, their operands were not updated to reference
the correct cloned values. As a result, we would emit debug.value
intrinsics with broken operand references which are discarded in later
passes. This leads to incorrect debuginfo that reports incorrect values
for variables.

Fix this by remapping debug intrinsic operands when cloning them.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45667.

Differential Revision: https://reviews.llvm.org/D79602
2020-05-08 11:10:25 -07:00
Fangrui Song
880f863489 Reland D79501 "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."
With a fix to uninitialized EndOffset.

DW_OP_call_ref is the only operation that has an operand which depends
on the DWARF format. The patch fixes handling that operation in DWARF64
units.

Differential Revision: https://reviews.llvm.org/D79501
2020-05-08 09:35:54 -07:00
Krasimir Georgiev
3f7e709012 Revert "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."
This reverts commit 989ae9e848a079715c2d23e5d3622cac9b48e08e.

Newly added test fails:
FAIL: LLVM::DW_OP_call_ref_unexpected.s

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/28298
2020-05-08 17:24:32 +02:00
Igor Kudrin
841cf82b6f Fix a failing test.
Differential Revision: https://reviews.llvm.org/D79501
2020-05-08 15:36:01 +07:00
Igor Kudrin
94e656da18 [DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units.
DW_OP_call_ref is the only operation that has an operand which depends
on the DWARF format. The patch fixes handling that operation in DWARF64
units.

Differential Revision: https://reviews.llvm.org/D79501
2020-05-08 15:14:42 +07:00
Alexandre Ganea
83e616ec37 Revert "[Debug][CodeView] Emit fully qualified names for globals"
This reverts commit 06591b6d191ad3582d21a801cbaf56b36714cae7.
2020-05-06 15:23:58 -04:00
Alexandre Ganea
13e60df049 [Debug][CodeView] Emit fully qualified names for globals
Emit S_[L|G][THREAD32|DATA32] records with a fully qualified name (namespace + class scope).

Differential Revision: https://reviews.llvm.org/D79447
2020-05-06 09:12:00 -04:00
Alexandre Ganea
730dc93e22 [DebugInfo][CodeView] Include namespace into emitted globals
Before this patch, global variables didn't have their namespace prepended in the Codeview debug symbol stream. This prevented Visual Studio from displaying them in the debugger (they appeared as 'unspecified error')

Differential Revision: https://reviews.llvm.org/D79028
2020-05-04 13:59:36 -04:00
Djordje Todorovic
c074cdefc8 [llvm-dwarfdump][Stats] Clean up
This addresses:
  -Clean up the source code
  -Refactor the JSON fields
  -Fix the test cases
  -Improve the docs for the stats output

Differential Revision: https://reviews.llvm.org/D77789
2020-05-04 09:35:40 +02:00
David Spickett
ee47d74637 [globalopt] Don't emit DWARF fragments for members
of a struct that cover the whole struct

This can happen when the rest of the
members of are zero length. Following
the same pattern applied to the SROA
pass in:
d7f6f1636d53c3e2faf55cdf20fbb44a1a149df1

Fixes: https://bugs.llvm.org/show_bug.cgi?id=45335

Differential Revision: https://reviews.llvm.org/D78720
2020-04-30 11:36:55 +01:00
Igor Kudrin
ecb37ccd0f [DebugInfo][DWARF64] Fix dumping pre-standard .debug_str_offsets.dwo sections.
The sizes of offsets in the `.debug_str_offsets.dwo` section depend on
the format of compilation or type units referencing them: 4 bytes for
DWARF32 units and 8 bytes for DWARF64 ones. The fix uses parsed units
to determine the actual size of offsets in the corresponding part of
the `.debug_str_offsets.dwo` section.

Differential Revision: https://reviews.llvm.org/D78555
2020-04-25 18:59:41 +07:00
Vedant Kumar
5430d2dee2 [MachineDebugify] Insert synthetic DBG_VALUE instructions
Summary:
Teach MachineDebugify how to insert DBG_VALUE instructions.  This can
help find bugs causing CodeGen differences when debug info is present.
DBG_VALUE instructions are only emitted when -debugify-level is set to
locations+variables.

There is essentially no attempt made to match up DBG_VALUE register
operands with the local variables they ought to correspond to. I'm not
sure how to improve the situation. In some cases (MachineMemOperand?)
it's possible to find the IR instruction a MachineInstr corresponds to,
but in general this seems to call for "undoing" the work done by ISel.

Reviewers: dsanders, aprantl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78135
2020-04-22 17:03:39 -07:00
Fangrui Song
80f1762659 [XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations
In a future change we should properly fix xray_fn_idx to use PC-relative
addresses as well, but for now let's keep absolute addresses until sled
addresses are all fixed.
2020-04-21 12:02:29 -07:00
Fangrui Song
e8dd5bcb82 [XRay] Change xray_instr_map sled addresses from absolute to PC relative for x86-64
xray_instr_map contains absolute addresses of sleds, which are relocated
by `R_*_RELATIVE` when linked in -pie or -shared mode.

By making these addresses relative to PC, we can avoid the dynamic
relocations and remove the SHF_WRITE flag from xray_instr_map.  We can
thus save VM pages containg xray_instr_map (because they are not
modified).

This patch changes x86-64 and bumps the sled version to 2. Subsequent
changes will change powerpc64le and AArch64.

Reviewed By: dberris, ianlevesque

Differential Revision: https://reviews.llvm.org/D78082
2020-04-21 09:36:09 -07:00
David Blaikie
5104defed9 Recommit: DebugInfo: Fix rangesBaseAddress DICompileUnit bitcode serialization/deserialization
Recommits c51b45e32ef7f35c11891f60871aa9c2c04cd991
Reverted in b350c666ab65b7585bc58301b03d2b46dc6b0504 due to some
(Google-internal) regressions I cannot reproduce... (so we'll see if
they reproduce this time around)
2020-04-20 17:29:04 -07:00
Wouter van Oortmerssen
15e7e14c11 [WebAssembly] fixed target index strings in DebugInfo test 2020-04-16 17:11:14 -07:00
Wouter van Oortmerssen
2d2a0b49b2 [WebAssembly] Add int32 DW_OP_WASM_location variant
This to allow us to add reloctable global indices as a symbol.
Also adds R_WASM_GLOBAL_INDEX_I32 relocation type to support it.

See discussion in https://github.com/WebAssembly/debugging/issues/12
2020-04-16 16:32:17 -07:00
Amy Huang
995a26bf12 Reland "[codeview] Reference types in type parent scopes"
Summary:
Original description (https://reviews.llvm/org/D69924)
Without this change, when a nested tag type of any kind (enum, class,
struct, union) is used as a variable type, it is emitted without
emitting the parent type. In CodeView, parent types point to their inner
types, and inner types do not point back to their parents. We already
walk over all of the parent scopes to build the fully qualified name.
This change simply requests their type indices as we go along to enusre
they are all emitted.

Now, while walking over the parent scopes, add the types to
DeferredCompleteTypes, since they might already be in the process of
being emitted.

Fixes PR43905

Reviewers: rnk, amccarth

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78249
2020-04-16 12:08:52 -07:00
Jeremy Morse
7af5cc5a22 [LiveDebugValues] Terminate open ranges on DBG_VALUE $noreg
In D68209, LiveDebugValues::transferDebugValue had a call to
OpenRanges.erase shifted, and by accident this led to a code path where
DBG_VALUEs of $noreg would not have their open range terminated, allowing
variable locations to extend past blocks where they were terminated.

This patch correctly terminates the open range, if present, when such a
DBG_VAUE is encountered, and adds a test for this behaviour.

Differential Revision: https://reviews.llvm.org/D78218
2020-04-16 10:26:47 +01:00
David Blaikie
1519ccfd27 Reapply "llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries""
Originally committed as 416fa7720e30750939c53935051c6c750dfad2c2
Reverted (due to buildbot failure - breaking lldb) in 7a45aeacf3a23449039ef2efcf476995ae1c7007.

I still can't seem to build lldb locally, but Pavel Labath has kindly
provided a potential fix to preserve the old behavior in lldb by
registering a simple recoverable error handler there that prints to the
desired stream in lldb, rather than stderr.
2020-04-14 14:44:32 -07:00
Sourabh Singh Tomar
a98d25eefc [DWARF5]: Added support for DW_MACRO_import form in llvm-dwarfdump
GCC emits this new form along with others forms(supported in llvm-dwardump)
and since it's support was missing in llvm-dwarfdump, it was not
able to correctly dump the content a debug_macro section for GCC
generated binaries.

This patch extends llvm-dwarfdump to support this form,
now GCC generated debug_macro section can be correctly dumped
using llvm-dwarfdump.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D78006
2020-04-14 23:51:46 +05:30
Vedant Kumar
87714cc468 [Debugify] Strip added metadata in the -debugify-each pipeline
Summary:
Share logic to strip debugify metadata between the IR and MIR level
debugify passes. This makes it simpler to hunt for bugs by diffing IR
with vs. without -debugify-each turned on.

As a drive-by, fix an issue causing CallGraphNodes to become invalid
when a dead llvm.dbg.value prototype is deleted.

Reviewers: dsanders, aprantl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77915
2020-04-13 10:55:17 -07:00
David Blaikie
356c6ad409 Revert "llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries"
Broke an LLDB build bot & I can't seem to build LLDB locally to fix
forward...
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/15567/steps/test/logs/stdio

This reverts commit 416fa7720e30750939c53935051c6c750dfad2c2.
2020-04-11 16:54:49 -07:00
David Blaikie
f04e26215b llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries
This probably isn't ideal - the error was being printed specifically
inline with the dumping that was more legible - but then the error
wasn't reported to stderr and didn't produce a non-zero exit code.

Probably the error message could be improved by adding more context now
that it isn't printed in-situ of the DIE dumping as much.
2020-04-10 17:28:09 -07:00
David Blaikie
4f1d6dd171 llvm-dwarfdump: Return non-zero on error
Makes it easier to test "this doesn't produce an error" (& indeed makes
that the implied default so we don't accidentally write tests that have
silent/sneaky errors as well as the positive behavior we're testing for)

Though the support for applying relocations is patchy enough that a
bunch of tests treat lack of relocation application as more of a warning
than an error - so rather than me trying to figure out how to add
support for a bunch of relocation types, let's degrade that to a warning
to match the usage (& indeed, it's sort of more of a tool warning anyway
- it's not that the DWARF is wrong, just that the tool can't fully cope
with it - and it's not like the tool won't dump the DWARF, it just won't
follow/render certain relocations - I guess in the most general case it
might try to render an unrelocated value & instead render something
bogus... but mostly seems to be about interesting relocations used in
eh_frame (& honestly it might be nice if we were lazier about doing this
relocation resolution anyway - if you're not dumping eh_frame, should we
really be erroring about the relocations in it?))
2020-04-09 20:53:58 -07:00
Igor Kudrin
afc5a59902 [DebugInfo] Fix reading DWARFv5 type units in DWP.
In DWARFv5, type units are stored in .debug_info sections, along with
compilation units, and they are distinguished by the unit_type field
in the header, not by the name of the section. It is impossible to
associate the correct index section of a DWP file with the unit before
the unit's header is read. This patch fixes reading DWARFv5 type units
by parsing the header first and then applying the index entry according
to the actual unit type.

Differential Revision: https://reviews.llvm.org/D77552
2020-04-08 12:50:58 +07:00
Awanish Pandey
5ea0dc759a [DWARF5]: Added a left over test case from D73462
Unfortunately this test case never made it to the trunk. This
was part of https://reviews.llvm.org/D73462 revision.
2020-04-07 10:32:56 +05:30
Davide Italiano
75fce625cd [MachineCSE] Don't carry the wrong location when hoisting
PR: 45425
<rdar://problem/61359768>

Differential Revision:  https://reviews.llvm.org/D77604
2020-04-06 16:36:22 -07:00
Jonathan Roelofs
c9acf39233 [llvm] Fix missing FileCheck directive colons
https://reviews.llvm.org/D77352
2020-04-06 09:59:08 -06:00
Sourabh Singh Tomar
8ba532e8e1 [DWARF5] Added support for emission of debug_macro section.
Summary:
This patch adds support for emission of following DWARFv5 macro forms
in .debug_macro section.

1. DW_MACRO_start_file
2. DW_MACRO_end_file
3. DW_MACRO_define_strp
4. DW_MACRO_undef_strp.

Reviewed By: dblaikie, ikudrin

Differential Revision: https://reviews.llvm.org/D72828
2020-04-06 17:45:10 +05:30
Igor Kudrin
bd56c5cba9 [DebugInfo] Fix reading range lists of v5 units in DWP.
In package files, the base offset provided by index sections should be
used to find the contribution of a unit. The patch adds that base
offset when reading range list tables.

Differential revision: https://reviews.llvm.org/D77401
2020-04-06 13:28:06 +07:00
Igor Kudrin
bb7c5db8c9 [DebugInfo] Fix reading location tables headers of v5 units in DWP.
This fixes the reading of location lists headers for compilation units
in package files by adjusting the reading offset according to the
corresponding record in the unit index. This is required for
DW_FORM_loclistx to work.

Differential revision: https://reviews.llvm.org/D77146
2020-04-06 13:28:06 +07:00
Igor Kudrin
f0e687f6fb [DebugInfo] Fix reading location tables of v5 units in DWP.
Without the patch, all version 5 compile units in a DWP file read
location tables from the beginning of a .debug_loclists.dwo section.
The patch fixes that by adjusting the reading offset the same way as
for pre-v5 units. The section identifier to find the contribution
entry corresponds to the version of the unit.

Differential revision: https://reviews.llvm.org/D77145
2020-04-06 13:28:06 +07:00
Igor Kudrin
0e6bc8dff3 [DebugInfo] Support DWARFv5 index sections.
DWARFv5 defines index sections in package files in a slightly different
way than the pre-standard GNU proposal, see Section 7.3.5 in the DWARF
standard and https://gcc.gnu.org/wiki/DebugFissionDWP for GNU proposal.
The main concern here is values for section identifiers, which are
partially overlapped with changed meanings. The patch adds support for
v5 index sections and resolves that difficulty by defining a set of
identifiers for internal use which can represent and distinct values
of both standards.

Differential Revision: https://reviews.llvm.org/D75929
2020-04-06 13:28:06 +07:00
OCHyams
b12a4a3014 [DebugInfo] Salvage debug info when sinking loop invariant instructions
Reviewed By: vsk, aprantl, djtodoro

Differential Revision: https://reviews.llvm.org/D77318
2020-04-03 09:19:26 +01:00
Sourabh Singh Tomar
d33f7a7cb5 [DWARF5] Added support for debug_macro section parsing and dumping in llvm-dwarfdump.
Summary:
This patch adds parsing and dumping DWARFv5 .debug_macro section in llvm-dwarfdump,
it does not introduce any new switch. Existing switch "--debug-macro"
should be used to dump macinfo or macro section.

Reviewed By: dblaikie, ikudrin, jhenderson

Differential Revision: https://reviews.llvm.org/D73086
2020-04-03 12:23:51 +05:30
Chris Jackson
65cfb4a16b [DebugInfo] Ensure that a demanded bits optimisation in
InstCombine does not result in an incorrect debuginfo variable
value

- Add an additional salvage and a test.

Reviewers: aprantl, djtodoro

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

Bugzilla:  https://bugs.llvm.org/show_bug.cgi?id=44371
2020-03-30 15:39:22 +01:00
Chris Jackson
2d8c535e77 [DebugInfo] Ensure dead store elimination can mark an operand
value as undefined

    - Correct a debug info salvage and add a test

    Reviewers: aprantl, vsk

    Differential Revision: https://reviews.llvm.org/D76930
    Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45080
2020-03-30 14:58:14 +01:00
Yvan Roux
c9838f5f9f [ARM] Move ConstantIsland and LowOverheadLoops Passes.
Move ARM ConstantIsland and LowOverheadLopps passes later in the pipeline
such that they will be run after the upcoming Machine Outlining pass.

Differential Revision: https://reviews.llvm.org/D76065
2020-03-25 16:49:21 +01:00
Vedant Kumar
baf8348499 [DWARF] Emit DW_AT_call_pc for tail calls
Record the address of a tail-calling branch instruction within its call
site entry using DW_AT_call_pc. This allows a debugger to determine the
address to use when creating aritificial frames.

This creates an extra attribute + relocation at tail call sites, which
constitute 3-5% of all call sites in xnu/clang respectively.

rdar://60307600

Differential Revision: https://reviews.llvm.org/D76336
2020-03-24 12:01:55 -07:00
Vedant Kumar
3de3902a62 PR45181: Fix another invalid DIExpression combination
The original test case from PR45181 triggers a DIExpression combination
that wasn't fixed in D76164.
2020-03-20 11:18:05 -07:00
Scott Linder
a70016c8d5 [AMDGPU] Add Scratch Wave Offset to Scratch Buffer Descriptor in entry functions
Add the scratch wave offset to the scratch buffer descriptor (SRSrc) in
the entry function prologue. This allows us to removes the scratch wave
offset register from the calling convention ABI.

As part of this change, allow the use of an inline constant zero for the
SOffset of MUBUF instructions accessing the stack in entry functions
when a frame pointer is not requested/required. Entry functions with
calls still need to set up the calling convention ABI stack pointer
register, and reference it in order to address arguments of called
functions. The ABI stack pointer register remains unswizzled, but is now
wave-relative instead of queue-relative.

Non-entry functions also use an inline constant zero SOffset for
wave-relative scratch access, but continue to use the stack and frame
pointers as before. When the stack or frame pointer is converted to a
swizzled offset it is now scaled directly, as the scratch wave offset no
longer needs to be subtracted first.

Update llvm/docs/AMDGPUUsage.rst to reflect these changes to the calling
convention.

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75138
2020-03-19 15:35:16 -04:00
Vedant Kumar
af2c299da6 [test] Re-enable accidentally disabled X86 tests
A number of X86 tests were accidentally disabled in
https://reviews.llvm.org/D73568. This commit re-enables those tests.

```
$ for x86_test in $(gg 'REQUIRES: x86$' llvm/test | fst); do sed -i "" '/REQUIRES: x86/d' $x86_test; done
```

(Note that 'x86' is not an available feature, that's what caused the
tests to be disabled.)
2020-03-19 09:29:23 -07:00