mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-12 05:56:28 +00:00
[SelectionDAG] Remove debug locations from ConstantSD(FP)Nodes
This removes debug locations from ConstantSDNode and ConstantSDFPNode. When this kind of node is materialized we no longer create a line table entry which jumps back to the constant's first point of use. This makes single-stepping behavior smoother, and it matches the model used by IR, where Constants have no locations. See this thread for more context: http://lists.llvm.org/pipermail/llvm-dev/2018-June/124164.html I'd like to handle constant BuildVectorSDNodes and to try to eliminate passing SDLocs to SelectionDAG::getConstant*() in follow-up commits. Differential Revision: https://reviews.llvm.org/D48468 llvm-svn: 335497
This commit is contained in:
parent
12a71b7b2e
commit
92887bf199
@ -1498,9 +1498,8 @@ class ConstantSDNode : public SDNode {
|
||||
|
||||
const ConstantInt *Value;
|
||||
|
||||
ConstantSDNode(bool isTarget, bool isOpaque, const ConstantInt *val,
|
||||
const DebugLoc &DL, EVT VT)
|
||||
: SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, 0, DL,
|
||||
ConstantSDNode(bool isTarget, bool isOpaque, const ConstantInt *val, EVT VT)
|
||||
: SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, 0, DebugLoc(),
|
||||
getSDVTList(VT)),
|
||||
Value(val) {
|
||||
ConstantSDNodeBits.IsOpaque = isOpaque;
|
||||
@ -1536,10 +1535,9 @@ class ConstantFPSDNode : public SDNode {
|
||||
|
||||
const ConstantFP *Value;
|
||||
|
||||
ConstantFPSDNode(bool isTarget, const ConstantFP *val, const DebugLoc &DL,
|
||||
EVT VT)
|
||||
: SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, 0, DL,
|
||||
getSDVTList(VT)),
|
||||
ConstantFPSDNode(bool isTarget, const ConstantFP *val, EVT VT)
|
||||
: SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, 0,
|
||||
DebugLoc(), getSDVTList(VT)),
|
||||
Value(val) {}
|
||||
|
||||
public:
|
||||
|
@ -1243,7 +1243,7 @@ SDValue SelectionDAG::getConstant(const ConstantInt &Val, const SDLoc &DL,
|
||||
return SDValue(N, 0);
|
||||
|
||||
if (!N) {
|
||||
N = newSDNode<ConstantSDNode>(isT, isO, Elt, DL.getDebugLoc(), EltVT);
|
||||
N = newSDNode<ConstantSDNode>(isT, isO, Elt, EltVT);
|
||||
CSEMap.InsertNode(N, IP);
|
||||
InsertNode(N);
|
||||
NewSDValueDbgMsg(SDValue(N, 0), "Creating constant: ", this);
|
||||
@ -1286,7 +1286,7 @@ SDValue SelectionDAG::getConstantFP(const ConstantFP &V, const SDLoc &DL,
|
||||
return SDValue(N, 0);
|
||||
|
||||
if (!N) {
|
||||
N = newSDNode<ConstantFPSDNode>(isTarget, &V, DL.getDebugLoc(), EltVT);
|
||||
N = newSDNode<ConstantFPSDNode>(isTarget, &V, EltVT);
|
||||
CSEMap.InsertNode(N, IP);
|
||||
InsertNode(N);
|
||||
}
|
||||
|
@ -1,18 +1,17 @@
|
||||
; RUN: llc %s -enable-machine-outliner -mtriple=aarch64-unknown-unknown -pass-remarks=machine-outliner -pass-remarks-missed=machine-outliner -o /dev/null 2>&1 | FileCheck %s
|
||||
; CHECK: machine-outliner-remarks.ll:5:9:
|
||||
; CHECK: <unknown>:0:0:
|
||||
; CHECK-SAME: Did not outline 2 instructions from 2 locations.
|
||||
; CHECK-SAME: Bytes from outlining all occurrences (36) >=
|
||||
; CHECK-SAME: Unoutlined instruction bytes (16)
|
||||
; CHECK-SAME: (Also found at: machine-outliner-remarks.ll:13:9)
|
||||
; CHECK-SAME: (Also found at: <UNKNOWN LOCATION>)
|
||||
; CHECK: remark: <unknown>:0:0: Saved 20 bytes by outlining 12 instructions
|
||||
; CHECK-SAME: from 2 locations. (Found at: machine-outliner-remarks.ll:36:1,
|
||||
; CHECK-SAME: machine-outliner-remarks.ll:27:9)
|
||||
; CHECK-SAME: from 2 locations. (Found at: <UNKNOWN LOCATION>,
|
||||
; CHECK-SAME: <UNKNOWN LOCATION>)
|
||||
; RUN: llc %s -enable-machine-outliner -mtriple=aarch64-unknown-unknown -o /dev/null -pass-remarks-missed=machine-outliner -pass-remarks-output=%t.yaml
|
||||
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
|
||||
; YAML: --- !Missed
|
||||
; YAML-NEXT: Pass: machine-outliner
|
||||
; YAML-NEXT: Name: NotOutliningCheaper
|
||||
; YAML-NEXT: DebugLoc: { File: machine-outliner-remarks.ll, Line: 5, Column: 9 }
|
||||
; YAML-NEXT: Function: dog
|
||||
; YAML-NEXT: Args:
|
||||
; YAML-NEXT: - String: 'Did not outline '
|
||||
@ -28,8 +27,7 @@
|
||||
; YAML-NEXT: - NotOutliningCost: '16'
|
||||
; YAML-NEXT: - String: ')'
|
||||
; YAML-NEXT: - String: ' (Also found at: '
|
||||
; YAML-NEXT: - OtherStartLoc1: 'machine-outliner-remarks.ll:13:9'
|
||||
; YAML-NEXT: DebugLoc: { File: machine-outliner-remarks.ll, Line: 13, Column: 9 }
|
||||
; YAML-NEXT: - OtherStartLoc1: '<UNKNOWN LOCATION>'
|
||||
; YAML-NEXT: - String: ')'
|
||||
; YAML: --- !Passed
|
||||
; YAML-NEXT: Pass: machine-outliner
|
||||
@ -46,11 +44,9 @@
|
||||
; YAML-NEXT: - NumOccurrences: '2'
|
||||
; YAML-NEXT: - String: ' locations. '
|
||||
; YAML-NEXT: - String: '(Found at: '
|
||||
; YAML-NEXT: - StartLoc0: 'machine-outliner-remarks.ll:36:1'
|
||||
; YAML-NEXT: DebugLoc: { File: machine-outliner-remarks.ll, Line: 36, Column: 1 }
|
||||
; YAML-NEXT: - StartLoc0: '<UNKNOWN LOCATION>'
|
||||
; YAML-NEXT: - String: ', '
|
||||
; YAML-NEXT: - StartLoc1: 'machine-outliner-remarks.ll:27:9'
|
||||
; YAML-NEXT: DebugLoc: { File: machine-outliner-remarks.ll, Line: 27, Column: 9 }
|
||||
; YAML-NEXT: - StartLoc1: '<UNKNOWN LOCATION>'
|
||||
; YAML-NEXT: - String: ')'
|
||||
|
||||
define void @dog() #0 !dbg !8 {
|
||||
|
@ -9,9 +9,6 @@
|
||||
; return -1;
|
||||
; }
|
||||
|
||||
; CHECK: .loc 1 6 7
|
||||
; CHECK: mvn
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "armv7--linux-gnueabihf"
|
||||
|
||||
@ -33,7 +30,17 @@ if.then: ; preds = %entry
|
||||
br label %return, !dbg !18
|
||||
|
||||
if.end: ; preds = %entry
|
||||
; Materialize the constant.
|
||||
; CHECK: .loc 1 0
|
||||
; CHECK-NEXT: mvn r0, #0
|
||||
|
||||
; The backend performs the store to %retval first, for some reason.
|
||||
; CHECK-NEXT: .loc 1 7 5
|
||||
; CHECK-NEXT: str r0, [sp, #4]
|
||||
store i32 -1, i32* %x, align 4, !dbg !19
|
||||
|
||||
; CHECK-NEXT: .loc 1 6 7
|
||||
; CHECK-NEXT: str r0, [sp]
|
||||
store i32 -1, i32* %retval, !dbg !20
|
||||
br label %return, !dbg !20
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
; RUN: llc -debug -dag-dump-verbose < %s 2>&1 | FileCheck %s
|
||||
; REQUIRES: asserts
|
||||
|
||||
; CHECK: t{{[0-9]+}}: i32 = Constant<-1>test.c:4:5
|
||||
|
||||
define i32 @main() !dbg !4 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
store i32 0, i32* %retval
|
||||
ret i32 -1, !dbg !10
|
||||
}
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!8, !9}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, emissionKind: FullDebug)
|
||||
!1 = !DIFile(filename: "test.c", directory: "/home/user/clang-llvm/build")
|
||||
!2 = !{}
|
||||
!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
||||
!5 = !DISubroutineType(types: !6)
|
||||
!6 = !{!7}
|
||||
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!8 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!9 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!10 = !DILocation(line: 4, column: 5, scope: !4)
|
@ -1,23 +0,0 @@
|
||||
; RUN: llc -debug -dag-dump-verbose < %s 2>&1 | FileCheck %s
|
||||
; REQUIRES: asserts
|
||||
|
||||
; CHECK: t{{[0-9]+}}: f64 = ConstantFP<1.500000e+00>test.c:3:5
|
||||
|
||||
define double @f() !dbg !4 {
|
||||
entry:
|
||||
ret double 1.500000e+00, !dbg !10
|
||||
}
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!8, !9}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, emissionKind: FullDebug)
|
||||
!1 = !DIFile(filename: "test.c", directory: "/home/user/clang-llvm/build")
|
||||
!2 = !{}
|
||||
!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
||||
!5 = !DISubroutineType(types: !6)
|
||||
!6 = !{!7}
|
||||
!7 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)
|
||||
!8 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!9 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!10 = !DILocation(line: 3, column: 5, scope: !4)
|
@ -7,10 +7,10 @@
|
||||
; LINE: source_lines_test:
|
||||
; LINE-NEXT: ; {{.*}}source-lines.cl:1
|
||||
; Kernel.
|
||||
; LINE: ; {{.*}}source-lines.cl:2
|
||||
; LINE: v_mov_b32_e32 v{{[0-9]+}}, 0x777
|
||||
; LINE: ; {{.*}}source-lines.cl:3
|
||||
; LINE: ; {{.*}}source-lines.cl:2
|
||||
; LINE: v_mov_b32_e32 v{{[0-9]+}}, 0x888
|
||||
; LINE: ; {{.*}}source-lines.cl:3
|
||||
; LINE: ; {{.*}}source-lines.cl:4
|
||||
; LINE: v_add_u32_e32
|
||||
; LINE: ; {{.*}}source-lines.cl:5
|
||||
@ -23,10 +23,10 @@
|
||||
; SOURCE: source_lines_test:
|
||||
; SOURCE-NEXT: ; kernel void source_lines_test(global int *Out) {
|
||||
; Kernel.
|
||||
; SOURCE: ; int var0 = 0x777;
|
||||
; SOURCE: v_mov_b32_e32 v{{[0-9]+}}, 0x777
|
||||
; SOURCE: ; int var1 = 0x888;
|
||||
; SOURCE: ; int var0 = 0x777;
|
||||
; SOURCE: v_mov_b32_e32 v{{[0-9]+}}, 0x888
|
||||
; SOURCE: ; int var1 = 0x888;
|
||||
; SOURCE: ; int var2 = var0 + var1;
|
||||
; SOURCE: v_add_u32_e32
|
||||
; SOURCE: ; *Out = var2;
|
||||
|
Loading…
Reference in New Issue
Block a user