1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/DebugInfo/X86
Reid Kleckner 20a3d2184f [FastISel] Sink local value materializations to first use
Summary:
Local values are constants, global addresses, and stack addresses that
can't be folded into the instruction that uses them. For example, when
storing the address of a global variable into memory, we need to
materialize that address into a register.

FastISel doesn't want to materialize any given local value more than
once, so it generates all local value materialization code at
EmitStartPt, which always dominates the current insertion point. This
allows it to maintain a map of local value registers, and it knows that
the local value area will always dominate the current insertion point.

The downside is that local value instructions are always emitted without
a source location. This is done to prevent jumpy line tables, but it
means that the local value area will be considered part of the previous
statement. Consider this C code:
  call1();      // line 1
  ++global;     // line 2
  ++global;     // line 3
  call2(&global, &local); // line 4

Today we end up with assembly and line tables like this:
  .loc 1 1
  callq call1
  leaq global(%rip), %rdi
  leaq local(%rsp), %rsi
  .loc 1 2
  addq $1, global(%rip)
  .loc 1 3
  addq $1, global(%rip)
  .loc 1 4
  callq call2

The LEA instructions in the local value area have no source location and
are treated as being on line 1. Stepping through the code in a debugger
and correlating it with the assembly won't make much sense, because
these materializations are only required for line 4.

This is actually problematic for the VS debugger "set next statement"
feature, which effectively assumes that there are no registers live
across statement boundaries. By sinking the local value code into the
statement and fixing up the source location, we can make that feature
work. This was filed as https://bugs.llvm.org/show_bug.cgi?id=35975 and
https://crbug.com/793819.

This change is obviously not enough to make this feature work reliably
in all cases, but I felt that it was worth doing anyway because it
usually generates smaller, more comprehensible -O0 code. I measured a
0.12% regression in code generation time with LLC on the sqlite3
amalgamation, so I think this is worth doing.

There are some special cases worth calling out in the commit message:
1. local values materialized for phis
2. local values used by no-op casts
3. dead local value code

Local values can be materialized for phis, and this does not show up as
a vreg use in MachineRegisterInfo. In this case, if there are no other
uses, this patch sinks the value to the first terminator, EH label, or
the end of the BB if nothing else exists.

Local values may also be used by no-op casts, which adds the register to
the RegFixups table. Without reversing the RegFixups map direction, we
don't have enough information to sink these instructions.

Lastly, if the local value register has no other uses, we can delete it.
This comes up when fastisel tries two instruction selection approaches
and the first materializes the value but fails and the second succeeds
without using the local value.

Reviewers: aprantl, dblaikie, qcolombet, MatzeB, vsk, echristo

Subscribers: dotdash, chandlerc, hans, sdardis, amccarth, javed.absar, zturner, llvm-commits, hiraditya

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

llvm-svn: 327581
2018-03-14 21:54:21 +00:00
..
2010-04-13-PubType.ll
2011-09-26-GlobalVarContext.ll
2011-12-16-BadStructRef.ll
abstract_origin.ll
accel-tables.ll Don't emit apple accelerator tables on non-darwin targets 2018-01-17 11:52:13 +00:00
align_c11.ll
align_cpp11.ll
align_objc.ll
aligned_stack_var.ll
arange-and-stub.ll
arange.ll
arguments.ll
array2.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
array.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
asm-macro-line-number.s
atomic-c11-dwarf-4.ll
atomic-c11-dwarf-5.ll
bbjoin.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
bitfields-dwarf4.ll
bitfields.ll
block-capture.ll
byvalstruct.ll
c-type-units.ll
clang-module.ll
coff_debug_info_type.ll
coff_relative_names.ll
concrete_out_of_line.ll
constant-aggregate.ll
constant-loclist.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
containing-type-extension-rust.ll
cu-ranges-odr.ll
cu-ranges.ll
data_member_location.ll
dbg_value_direct.ll
dbg-abstract-vars-g-gmlt.ll
dbg-addr-dse.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
dbg-addr.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
dbg-asm.s
dbg-byval-parameter.ll
dbg-const-int.ll
dbg-const.ll
dbg-declare-alloca.ll
dbg-declare-arg.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dbg-declare-inalloca.ll
dbg-declare.ll
dbg-file-name.ll Revert "Reapply "[DWARFv5] Emit file 0 to the line table."" 2018-03-07 16:27:44 +00:00
dbg-i128-const.ll
dbg-merge-loc-entry.ll
dbg-prolog-end.ll
dbg-subrange.ll
dbg-value-const-byref.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dbg-value-dag-combine.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
dbg-value-frame-index.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
dbg-value-g-gmlt.ll
dbg-value-inlined-parameter.ll [SelectionDAG] Improve handling of dangling debug info 2018-03-12 18:02:39 +00:00
dbg-value-isel.ll
dbg-value-location.ll
dbg-value-range.ll
dbg-value-regmask-clobber.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
dbg-value-terminator.ll
dbg-value-transfer-order.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
dbg-vector-size.ll [DebugInfo] Add DW_AT_byte_size to vectors 2018-03-08 22:22:26 +00:00
debug_and_nodebug_CUs.ll
debug_frame.ll
debug-dead-local-var.ll
debug-info-access.ll
debug-info-block-captured-self.ll
debug-info-blocks.ll
debug-info-packed-struct.ll
debug-info-producer-with-flags.ll
debug-info-static-member.ll
debug-loc-asan.ll [FastISel] Sink local value materializations to first use 2018-03-14 21:54:21 +00:00
debug-loc-frame.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
debug-loc-offset.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
debug-macro.ll [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
debug-ranges-offset.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
debugger-tune.ll Rewrite debugger tuning test case to not depend on apple sections 2018-01-17 11:11:53 +00:00
decl-derived-member.ll
default-subrange-array.ll
deleted-bit-piece.ll
DIModule.ll
DIModuleContext.ll
discriminator2.ll
discriminator3.ll
discriminator.ll
dllimport.ll
double-declare.ll
DW_AT_byte_size.ll
DW_AT_calling-convention.ll
DW_AT_linkage_name.ll
DW_AT_location-reference.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
DW_AT_object_pointer.ll
DW_AT_specification.ll
DW_AT_stmt_list_sec_offset.ll
dw_op_minus_direct.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dw_op_minus.ll [DebugInfo] Align comments in debug_loc section 2018-01-05 22:20:30 +00:00
DW_TAG_friend.ll
dwarf-aranges-no-dwarf-labels.ll
dwarf-aranges.ll
dwarf-linkage-names.ll
dwarf-no-source-loc.ll
dwarf-public-names.ll
dwarf-pubnames-split.ll
dwarfdump-bogus-LNE.s [DebugInfo] Bail out if making no progress dumping line tables. 2017-12-01 18:25:30 +00:00
dwarfdump-debug-loc-simple.test [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dwarfdump-debug-names.s [DebugInfo] Basic .debug_names dumping support 2018-01-29 11:08:32 +00:00
dwarfdump-header-64.s [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
dwarfdump-header.s [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
dwarfdump-line-dwo.s [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
dwarfdump-line-only.s [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
dwarfdump-ranges-baseaddr-exe.s [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dwarfdump-ranges-baseaddr.s [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dwarfdump-ranges-unrelocated.s [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
dwarfdump-str-offsets-dwp.s [DWARF v5] Rework of string offsets table reader 2017-12-21 19:38:13 +00:00
dwarfdump-str-offsets-invalid-1.s [NFC] Change the string offsets table tests to generate the object on the fly 2017-12-09 00:39:53 +00:00
dwarfdump-str-offsets-invalid-2.s [NFC] Change the string offsets table tests to generate the object on the fly 2017-12-09 00:39:53 +00:00
dwarfdump-str-offsets-invalid-3.s [DWARF v5] Rework of string offsets table reader 2017-12-21 19:38:13 +00:00
dwarfdump-str-offsets-invalid-4.s [DWARF v5] Rework of string offsets table reader 2017-12-21 19:38:13 +00:00
dwarfdump-str-offsets-invalid-5.s [NFC] Change the string offsets table tests to generate the object on the fly 2017-12-09 00:39:53 +00:00
dwarfdump-str-offsets-invalid-6.s [DWARF v5] Rework of string offsets table reader 2017-12-21 19:38:13 +00:00
dwarfdump-str-offsets-macho.s [DWARF v5] Rework of string offsets table reader 2017-12-21 19:38:13 +00:00
dwarfdump-str-offsets.s [DWARF v5] Rework of string offsets table reader 2017-12-21 19:38:13 +00:00
earlydup-crash.ll
elf-names.ll
empty_macinfo.ll [DEBUGINFO] Do not output labels for empty macinfo sections. 2018-02-22 16:20:30 +00:00
empty-and-one-elem-array.ll
empty-array.ll
empty.ll Re-submit r289925 (Update .debug_line section version to match DWARF version) 2017-12-04 21:27:46 +00:00
ending-run.ll
enum-class.ll Re-commit r324489: [DebugInfo] Improvements to representation of enumeration types (PR36168) 2018-02-12 16:10:09 +00:00
enum-fwd-decl.ll
fi-expr.ll
fi-piece.ll
fission-cu.ll
fission-hash.ll
fission-inline.ll
fission-no-inlining.ll
fission-ranges.ll Revert "[DebugInfo][FastISel] Fix dropping dbg.value()" 2018-02-22 19:53:59 +00:00
float_const_loclist.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
float_const.ll
formal_parameter.ll
fragment-offset-order.ll [DebugInfo] Fix fragment offset emission order for symbol locations 2018-01-29 12:37:30 +00:00
frame-register.ll
FrameIndexExprs.ll
generate-odr-hash.ll [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
ghost-sdnode-dbgvalues.ll
global-sra-fp80-array.ll [GlobalOpt] Include padding in debug fragments 2018-02-02 10:34:13 +00:00
global-sra-fp80-struct.ll [GlobalOpt] Include padding in debug fragments 2018-02-02 10:34:13 +00:00
gmlt.test
gnu-public-names-empty.ll
gnu-public-names-gmlt.ll
gnu-public-names-multiple-cus.ll
gnu-public-names-tu.ll
gnu-public-names.ll
header.ll
inline-asm-locs.ll Revert "Reapply "[DWARFv5] Emit file 0 to the line table."" 2018-03-07 16:27:44 +00:00
inline-member-function.ll
inline-namespace.ll
inline-seldag-test.ll
inlined-formal-parameter.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
inlined-indirect-value.ll
InlinedFnLocalVar.ll
instcombine-instrinsics.ll
invalid-prologue-end.ll [DWARF] Fix incorrect prologue end line record. 2018-02-14 17:35:52 +00:00
isel-cse-line.ll
lexical_block.ll
lexical-block-file-inline.ll
line-info.ll
line.test
linkage-name.ll
lit.local.cfg
live-debug-values.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
live-debug-variables.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
live-debug-vars-discard-invalid.mir [DebugInfo] Discard invalid DBG_VALUE instructions in LiveDebugVariables 2018-03-06 08:47:07 +00:00
live-debug-vars-dse.mir Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
low-pc-cu.ll
main-file-name.s
memberfnptr.ll
mi-print.ll
misched-dbg-value.ll
missing-file-line.ll
mixed-nodebug-cu.ll
multiple-aranges.ll
multiple-at-const-val.ll
nodebug_with_debug_loc.ll
nodebug.ll [DebugInfo] Use llc instead of llc_dwarf to fix this test. 2017-12-08 17:15:50 +00:00
nondefault-subrange-array.ll
nophysreg.ll
noreturn_c11.ll
noreturn_cpp11.ll
noreturn_objc.ll
objc-fwd-decl.ll
objc-property-void.ll
op_deref.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
parameters.ll
partial-constant.ll
pieces-1.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
pieces-2.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
pieces-3.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
pieces-4.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
pointer-type-size.ll
pr11300.ll
pr12831.ll
pr13303.ll
pr19307.ll
pr28270.ll
pr34545.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
PR26148.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
processes-relocations.ll
prologue-stack.ll [FastISel] Sink local value materializations to first use 2018-03-14 21:54:21 +00:00
range_reloc.ll
ref_addr_relocation.ll
reference-argument.ll
rematerialize.ll
rvalue-ref.ll
safestack-byval.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
sdag-combine.ll [DAGCombiner] When combining zero_extend of a truncate, only mask before extending for vectors. 2018-03-01 22:32:25 +00:00
sdag-dangling-dbgvalue.ll [SelectionDAG] Improve handling of dangling debug info 2018-03-12 18:02:39 +00:00
sdag-salvage-add.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
sdag-split-arg.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
sdagsplit-1.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
single-dbg_value.ll
single-fi.ll
spill-indirect-nrvo.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
spill-nontrivial-param.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
spill-nospill.ll Re-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding" 2018-02-27 16:59:10 +00:00
split-dwarf-cross-unit-reference.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
split-dwarf-multiple-cu-hash.ll
split-dwarf-omit-empty.ll
split-global.ll
sret.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
sroasplit-1.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
sroasplit-2.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
sroasplit-3.ll
sroasplit-4.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
sroasplit-5.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
sroasplit-dbg-declare.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
stack-args.ll EmitFuncArgumentDbgValue: Prefer stack slots over registers for stack arguments 2017-12-14 22:55:06 +00:00
stack-value-dwarf2.ll
stack-value-dwarf4.ll
stack-value-piece.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
static_member_array.ll
stmt-list-multiple-compile-units.ll [DebugInfo] Support DWARF v5 source code embedding extension 2018-02-23 23:01:06 +00:00
stmt-list.ll
string-offsets-multiple-cus.ll [DWARF] Corrected test committed in r323670 to use llc instead of llc_dwarf to avoid multiple triples. 2018-01-30 01:11:46 +00:00
string-offsets-table.ll [DWARF] Recommitting a test that was removed with r323564. Restricted to x86 linux target. 2018-01-30 18:41:31 +00:00
stringpool.ll
strip-broken-debuginfo.ll Add an llc testcase analogous to test/LTO/X86/strip-debug-info.ll 2018-03-01 21:53:17 +00:00
struct-loc.ll
subrange-type.ll
subreg.ll
subregisters.ll [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
tail-merge.ll
template.ll
this-stack_value.ll
tls.ll
type_units_with_addresses.ll
unattached-global.ll
union-const.ll
union-template.ll
vector.ll
vla-dependencies.ll [dwarfdump] Only print CU relative offset in verbose mode 2018-03-07 16:28:53 +00:00
vla-global.ll [dwarfdump] Only print CU relative offset in verbose mode 2018-03-07 16:28:53 +00:00
vla-multi.ll [dwarfdump] Only print CU relative offset in verbose mode 2018-03-07 16:28:53 +00:00
vla.ll Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
void-typedef.ll Re-land "Fix faulty assertion in debug info" 2018-01-05 23:01:04 +00:00
xray-split-dwarf-interaction.ll
zextload.ll