[llvm] r190961 - Debug info: Get rid of the VLA indirection hack in FastISel.
Adrian Prantl
aprantl at apple.com
Wed Sep 18 15:09:00 PDT 2013
Author: adrian
Date: Wed Sep 18 17:08:59 2013
New Revision: 190961
URL: http://llvm.org/viewvc/llvm-project?rev=190961&view=rev
Log:
Debug info: Get rid of the VLA indirection hack in FastISel.
Use the DIVariable::isIndirect() flag set by the frontend instead of
guessing whether to set the machine location's indirection bit.
Paired commit with CFE.
Modified:
llvm/trunk/include/llvm/MC/MachineLocation.h
llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/trunk/test/DebugInfo/X86/op_deref.ll
llvm/trunk/test/DebugInfo/X86/vla.ll
Modified: llvm/trunk/include/llvm/MC/MachineLocation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MachineLocation.h?rev=190961&r1=190960&r2=190961&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MachineLocation.h (original)
+++ llvm/trunk/include/llvm/MC/MachineLocation.h Wed Sep 18 17:08:59 2013
@@ -44,7 +44,8 @@ public:
Offset == Other.Offset;
}
- // Accessors
+ // Accessors.
+ /// \return true iff this is a register-indirect location.
bool isIndirect() const { return !IsRegister; }
bool isReg() const { return IsRegister; }
unsigned getReg() const { return Register; }
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=190961&r1=190960&r2=190961&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Sep 18 17:08:59 2013
@@ -638,29 +638,24 @@ bool FastISel::SelectCall(const User *I)
(!isa<AllocaInst>(Address) ||
!FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(Address))))
Op = MachineOperand::CreateReg(FuncInfo.InitializeRegForValue(Address),
- false);
+ false);
- if (Op)
+ if (Op) {
if (Op->isReg()) {
- // Set the indirect flag if the type and the DIVariable's
- // indirect field are in disagreement: Indirectly-addressed
- // variables that are nonpointer types should be marked as
- // indirect, and VLAs should be marked as indirect eventhough
- // they are a pointer type.
- bool IsIndirect = DI->getAddress()->getType()->isPointerTy()
- ^ DIVar.isIndirect();
Op->setIsDebug(true);
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(TargetOpcode::DBG_VALUE),
- IsIndirect, Op->getReg(), Offset, DI->getVariable());
- } else
- BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
- TII.get(TargetOpcode::DBG_VALUE)).addOperand(*Op).addImm(0)
- .addMetadata(DI->getVariable());
- else
+ false, Op->getReg(), 0, DI->getVariable());
+ } else
+ BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+ TII.get(TargetOpcode::DBG_VALUE))
+ .addOperand(*Op).addImm(0)
+ .addMetadata(DI->getVariable());
+ } else {
// We can't yet handle anything else here because it would require
// generating code, thus altering codegen because of debug info.
DEBUG(dbgs() << "Dropping debug info for " << *DI << "\n");
+ }
return true;
}
case Intrinsic::dbg_value: {
Modified: llvm/trunk/test/DebugInfo/X86/op_deref.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/op_deref.ll?rev=190961&r1=190960&r2=190961&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/op_deref.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/op_deref.ll Wed Sep 18 17:08:59 2013
@@ -10,7 +10,8 @@
; right now, so we check the asm output:
; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK
; vla should have a register-indirect address at one point.
-; ASM-CHECK: DEBUG_VALUE: vla <- [RCX+0]
+; ASM-CHECK: DEBUG_VALUE: vla <- RCX
+; ASM-CHECK: DW_OP_breg2
define void @testVLAwithSize(i32 %s) nounwind uwtable ssp {
entry:
@@ -77,7 +78,7 @@ declare void @llvm.stackrestore(i8*) nou
!11 = metadata !{i32 1, i32 26, metadata !5, null}
!12 = metadata !{i32 3, i32 13, metadata !13, null}
!13 = metadata !{i32 786443, metadata !28, metadata !5, i32 2, i32 1, i32 0} ; [ DW_TAG_lexical_block ]
-!14 = metadata !{i32 786688, metadata !13, metadata !"vla", metadata !6, i32 3, metadata !15, i32 0, i32 0, i64 2} ; [ DW_TAG_auto_variable ]
+!14 = metadata !{i32 786688, metadata !13, metadata !"vla", metadata !6, i32 3, metadata !15, i32 8192, i32 0, i64 2} ; [ DW_TAG_auto_variable ]
!15 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 0, i64 32, i32 0, i32 0, metadata !9, metadata !16, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 32, offset 0] [from int]
!16 = metadata !{metadata !17}
!17 = metadata !{i32 786465, i64 0, i64 -1} ; [ DW_TAG_subrange_type ]
Modified: llvm/trunk/test/DebugInfo/X86/vla.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/vla.ll?rev=190961&r1=190960&r2=190961&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/vla.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/vla.ll Wed Sep 18 17:08:59 2013
@@ -1,6 +1,7 @@
; RUN: llc -O0 -mtriple=x86_64-apple-darwin -filetype=asm %s -o - | FileCheck %s
-; Ensure that we generate a breg+0 location for the variable length array a.
-; CHECK: ##DEBUG_VALUE: vla:a <- [RDX+0]
+; Ensure that we generate an indirect location for the variable length array a.
+; CHECK: ##DEBUG_VALUE: vla:a <- RDX
+; CHECK: DW_OP_breg1
; rdar://problem/13658587
;
; generated from:
@@ -91,7 +92,7 @@ entry:
!15 = metadata !{i32 786689, metadata !4, metadata !"n", metadata !5, i32 16777217, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [n] [line 1]
!16 = metadata !{i32 1, i32 0, metadata !4, null}
!17 = metadata !{i32 2, i32 0, metadata !4, null}
-!18 = metadata !{i32 786688, metadata !4, metadata !"a", metadata !5, i32 2, metadata !19, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [a] [line 2]
+!18 = metadata !{i32 786688, metadata !4, metadata !"a", metadata !5, i32 2, metadata !19, i32 8192, i32 0} ; [ DW_TAG_auto_variable ] [a] [line 2]
!19 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 0, i64 32, i32 0, i32 0, metadata !8, metadata !20, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 32, offset 0] [from int]
!20 = metadata !{metadata !21}
!21 = metadata !{i32 786465, i64 0, i64 -1} ; [ DW_TAG_subrange_type ] [unbounded]
More information about the llvm-commits
mailing list