[llvm] ba71ca3 - [DebugInfo] Describe size of spilled values in call site params

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 12:04:00 PST 2019


Author: Vedant Kumar
Date: 2019-11-19T12:03:52-08:00
New Revision: ba71ca37208faf0916b4cae4298789796b791cfe

URL: https://github.com/llvm/llvm-project/commit/ba71ca37208faf0916b4cae4298789796b791cfe
DIFF: https://github.com/llvm/llvm-project/commit/ba71ca37208faf0916b4cae4298789796b791cfe.diff

LOG: [DebugInfo] Describe size of spilled values in call site params

A call site parameter description of a memory operand needs to
unambiguously convey the size of the operand to prevent incorrect entry
value evaluation.

Thanks for David Stenberg for pointing this issue out!

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetInstrInfo.cpp
    llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index 2b987dabd24f..d7a02eb61a2c 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1150,7 +1150,11 @@ TargetInstrInfo::describeLoadedValue(const MachineInstr &MI) const {
     if (!TII->getMemOperandWithOffset(MI, BaseOp, Offset, TRI))
       return None;
 
-    Expr = DIExpression::prepend(Expr, DIExpression::DerefAfter, Offset);
+    SmallVector<uint64_t, 8> Ops;
+    DIExpression::appendOffset(Ops, Offset);
+    Ops.push_back(dwarf::DW_OP_deref_size);
+    Ops.push_back(MMO->getSize());
+    Expr = DIExpression::prependOpcodes(Expr, Ops);
     return ParamLoadedValue(*BaseOp, Expr);
   }
 

diff  --git a/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir b/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
index 26ea062c499b..373b484850a7 100644
--- a/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
+++ b/llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
@@ -22,7 +22,7 @@
 
 # CHECK-LABEL: DW_TAG_call_site_parameter
 # CHECK-NEXT:    DW_AT_location (DW_OP_reg5 RDI)
-# CHECK-NEXT:    DW_AT_call_value (DW_OP_fbreg -44, DW_OP_deref)
+# CHECK-NEXT:    DW_AT_call_value (DW_OP_fbreg -44, DW_OP_deref_size 0x4)
 
 --- |
   ; ModuleID = 'spill.cc'


        


More information about the llvm-commits mailing list