[DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink
Summary:
The logic for handling the sinking of COPY instructions was generating
different code when building with debug flags.
The original code did not take into consideration debug instructions. This
resulted in the registers in the DBG_VALUE instructions being treated as used,
and prevented the COPY from being sunk. This patch avoids analyzing debug
instructions when trying to sink COPY instructions.
This patch also creates a routine from the code in MachineSinking::SinkInstruction to
perform the logic of sinking an instruction along with its debug instructions.
This functionality is used in multiple places, including the code for sinking COPY instrs.
Reviewers: junbuml, javed.absar, MatzeB, bjope
Reviewed By: bjope
Subscribers: aprantl, probinson, thegameg, jonpa, bjope, vsk, kristof.beyls, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D45637
llvm-svn: 335264
2018-06-22 01:59:52 +08:00
|
|
|
# RUN: llc -mtriple=x86_64-none-linux-gnu -run-pass=postra-machine-sink -verify-machineinstrs -o - %s | FileCheck %s
|
|
|
|
#
|
|
|
|
# This test was originally generated from the following sample:
|
|
|
|
#
|
|
|
|
# int x0;
|
|
|
|
# extern void x3(int, int);
|
|
|
|
# void x1(int x2) {
|
|
|
|
# if (x0)
|
|
|
|
# x3(0, x2);
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# The code generates a COPY instruction which the PostRA Machine Sink pass will
|
|
|
|
# try to sink. Earlier versions were not performing the sink due to a
|
|
|
|
# DBG_VALUE instruction confusing the sinking algorithm.
|
|
|
|
|
|
|
|
--- |
|
|
|
|
@x0 = common dso_local global i32 0, align 4, !dbg !0
|
|
|
|
|
|
|
|
define dso_local void @x1(i32) !dbg !11 {
|
|
|
|
%2 = alloca i32, align 4
|
|
|
|
store i32 %0, i32* %2, align 4
|
|
|
|
call void @llvm.dbg.declare(metadata i32* %2, metadata !14, metadata !DIExpression()), !dbg !16
|
|
|
|
%3 = load i32, i32* @x0, align 4, !dbg !16
|
|
|
|
%4 = icmp ne i32 %3, 0, !dbg !16
|
|
|
|
br i1 %4, label %5, label %7, !dbg !16
|
|
|
|
|
|
|
|
; <label>:5: ; preds = %1
|
|
|
|
%6 = load i32, i32* %2, align 4, !dbg !16
|
|
|
|
call void @x3(i32 0, i32 %6), !dbg !16
|
|
|
|
br label %7, !dbg !16
|
|
|
|
|
|
|
|
; <label>:7: ; preds = %5, %1
|
|
|
|
ret void, !dbg !16
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata)
|
|
|
|
declare dso_local void @x3(i32, i32)
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!7, !8}
|
|
|
|
|
|
|
|
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
|
|
|
!1 = distinct !DIGlobalVariable(name: "x0", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
|
|
|
|
!3 = !DIFile(filename: "test.c", directory: "")
|
|
|
|
!4 = !{}
|
|
|
|
!5 = !{!0}
|
|
|
|
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
|
|
!7 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!11 = distinct !DISubprogram(name: "x1", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !2)
|
|
|
|
!12 = !DISubroutineType(types: !13)
|
|
|
|
!13 = !{null, !6}
|
|
|
|
!14 = !DILocalVariable(name: "x2", arg: 1, scope: !11, file: !3, line: 3, type: !6)
|
|
|
|
!15 = distinct !DILexicalBlock(scope: !11, file: !3, line: 4, column: 7)
|
|
|
|
!16 = !DILocation(line: 4, column: 7, scope: !15)
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
# CHECK: name: x1
|
|
|
|
# CHECK: bb.0:
|
|
|
|
# CHECK-NOT: $eax = COPY $edi
|
|
|
|
# CHECK: bb.1:
|
|
|
|
# CHECK: renamable $eax = COPY $edi
|
2018-10-31 07:28:27 +08:00
|
|
|
# CHECK-NEXT: DBG_VALUE $eax,
|
[DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink
Summary:
The logic for handling the sinking of COPY instructions was generating
different code when building with debug flags.
The original code did not take into consideration debug instructions. This
resulted in the registers in the DBG_VALUE instructions being treated as used,
and prevented the COPY from being sunk. This patch avoids analyzing debug
instructions when trying to sink COPY instructions.
This patch also creates a routine from the code in MachineSinking::SinkInstruction to
perform the logic of sinking an instruction along with its debug instructions.
This functionality is used in multiple places, including the code for sinking COPY instrs.
Reviewers: junbuml, javed.absar, MatzeB, bjope
Reviewed By: bjope
Subscribers: aprantl, probinson, thegameg, jonpa, bjope, vsk, kristof.beyls, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D45637
llvm-svn: 335264
2018-06-22 01:59:52 +08:00
|
|
|
# CHECK: bb.2:
|
|
|
|
name: x1
|
[Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing
Summary:
This catches malformed mir files which specify alignment as log2 instead of pow2.
See https://reviews.llvm.org/D65945 for reference,
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: MatzeB, qcolombet, dschuff, arsenm, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67433
llvm-svn: 371608
2019-09-11 19:16:48 +08:00
|
|
|
alignment: 16
|
[DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink
Summary:
The logic for handling the sinking of COPY instructions was generating
different code when building with debug flags.
The original code did not take into consideration debug instructions. This
resulted in the registers in the DBG_VALUE instructions being treated as used,
and prevented the COPY from being sunk. This patch avoids analyzing debug
instructions when trying to sink COPY instructions.
This patch also creates a routine from the code in MachineSinking::SinkInstruction to
perform the logic of sinking an instruction along with its debug instructions.
This functionality is used in multiple places, including the code for sinking COPY instrs.
Reviewers: junbuml, javed.absar, MatzeB, bjope
Reviewed By: bjope
Subscribers: aprantl, probinson, thegameg, jonpa, bjope, vsk, kristof.beyls, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D45637
llvm-svn: 335264
2018-06-22 01:59:52 +08:00
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
successors: %bb.2, %bb.1; %bb.2, %bb.1
|
|
|
|
liveins: $edi
|
2018-10-31 07:28:27 +08:00
|
|
|
DBG_VALUE $edi, $noreg, !14, !DIExpression(), debug-location !16
|
[DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink
Summary:
The logic for handling the sinking of COPY instructions was generating
different code when building with debug flags.
The original code did not take into consideration debug instructions. This
resulted in the registers in the DBG_VALUE instructions being treated as used,
and prevented the COPY from being sunk. This patch avoids analyzing debug
instructions when trying to sink COPY instructions.
This patch also creates a routine from the code in MachineSinking::SinkInstruction to
perform the logic of sinking an instruction along with its debug instructions.
This functionality is used in multiple places, including the code for sinking COPY instrs.
Reviewers: junbuml, javed.absar, MatzeB, bjope
Reviewed By: bjope
Subscribers: aprantl, probinson, thegameg, jonpa, bjope, vsk, kristof.beyls, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D45637
llvm-svn: 335264
2018-06-22 01:59:52 +08:00
|
|
|
renamable $eax = COPY $edi
|
2018-10-31 07:28:27 +08:00
|
|
|
DBG_VALUE $eax, $noreg, !14, !DIExpression(), debug-location !16
|
[DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink
Summary:
The logic for handling the sinking of COPY instructions was generating
different code when building with debug flags.
The original code did not take into consideration debug instructions. This
resulted in the registers in the DBG_VALUE instructions being treated as used,
and prevented the COPY from being sunk. This patch avoids analyzing debug
instructions when trying to sink COPY instructions.
This patch also creates a routine from the code in MachineSinking::SinkInstruction to
perform the logic of sinking an instruction along with its debug instructions.
This functionality is used in multiple places, including the code for sinking COPY instrs.
Reviewers: junbuml, javed.absar, MatzeB, bjope
Reviewed By: bjope
Subscribers: aprantl, probinson, thegameg, jonpa, bjope, vsk, kristof.beyls, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D45637
llvm-svn: 335264
2018-06-22 01:59:52 +08:00
|
|
|
CMP32mi8 $rip, 1, $noreg, @x0, $noreg, 0, implicit-def $eflags, debug-location !16
|
[X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.
Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.
Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon
Reviewed By: RKSimon
Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60228
llvm-svn: 357802
2019-04-06 03:28:09 +08:00
|
|
|
JCC_1 %bb.2, 4, implicit killed $eflags, debug-location !16
|
[DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink
Summary:
The logic for handling the sinking of COPY instructions was generating
different code when building with debug flags.
The original code did not take into consideration debug instructions. This
resulted in the registers in the DBG_VALUE instructions being treated as used,
and prevented the COPY from being sunk. This patch avoids analyzing debug
instructions when trying to sink COPY instructions.
This patch also creates a routine from the code in MachineSinking::SinkInstruction to
perform the logic of sinking an instruction along with its debug instructions.
This functionality is used in multiple places, including the code for sinking COPY instrs.
Reviewers: junbuml, javed.absar, MatzeB, bjope
Reviewed By: bjope
Subscribers: aprantl, probinson, thegameg, jonpa, bjope, vsk, kristof.beyls, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D45637
llvm-svn: 335264
2018-06-22 01:59:52 +08:00
|
|
|
JMP_1 %bb.1, debug-location !16
|
|
|
|
|
|
|
|
bb.1:
|
|
|
|
liveins: $eax
|
|
|
|
$edi = MOV32r0 implicit-def dead $eflags, debug-location !16
|
|
|
|
$esi = COPY killed renamable $eax, debug-location !16
|
|
|
|
|
|
|
|
bb.2:
|
|
|
|
RET 0, debug-location !16
|
|
|
|
...
|