1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

DBG_VALUE machine instruction pointing to undefined register for a variable justify a separate scope if the variable is inlined function's argument.

Radar 8122864.

llvm-svn: 106792
This commit is contained in:
Devang Patel 2010-06-24 21:51:19 +00:00
parent 3b3f37f51a
commit af1d4eede5
2 changed files with 16 additions and 4 deletions

View File

@ -2390,8 +2390,6 @@ DbgScope *DwarfDebug::getOrCreateDbgScope(const MDNode *Scope, const MDNode *Inl
static bool hasValidLocation(LLVMContext &Ctx, static bool hasValidLocation(LLVMContext &Ctx,
const MachineInstr *MInsn, const MachineInstr *MInsn,
const MDNode *&Scope, const MDNode *&InlinedAt) { const MDNode *&Scope, const MDNode *&InlinedAt) {
if (MInsn->isDebugValue())
return false;
DebugLoc DL = MInsn->getDebugLoc(); DebugLoc DL = MInsn->getDebugLoc();
if (DL.isUnknown()) return false; if (DL.isUnknown()) return false;
@ -2655,7 +2653,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
assert (MI->getNumOperands() > 1 && "Invalid machine instruction!"); assert (MI->getNumOperands() > 1 && "Invalid machine instruction!");
DIVariable DV(MI->getOperand(MI->getNumOperands() - 1).getMetadata()); DIVariable DV(MI->getOperand(MI->getNumOperands() - 1).getMetadata());
if (!DV.Verify()) continue; if (!DV.Verify()) continue;
if (isDbgValueInUndefinedReg(MI)) continue;
// If DBG_VALUE is for a local variable then it needs a label. // If DBG_VALUE is for a local variable then it needs a label.
if (DV.getTag() != dwarf::DW_TAG_arg_variable) if (DV.getTag() != dwarf::DW_TAG_arg_variable)
InsnNeedsLabel.insert(MI); InsnNeedsLabel.insert(MI);
@ -2663,7 +2660,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
else if (!DISubprogram(DV.getContext()).describes(MF->getFunction())) else if (!DISubprogram(DV.getContext()).describes(MF->getFunction()))
InsnNeedsLabel.insert(MI); InsnNeedsLabel.insert(MI);
// DBG_VALUE indicating argument location change needs a label. // DBG_VALUE indicating argument location change needs a label.
else if (!ProcessedArgs.insert(DV)) else if (isDbgValueInUndefinedReg(MI) == false && !ProcessedArgs.insert(DV))
InsnNeedsLabel.insert(MI); InsnNeedsLabel.insert(MI);
} else { } else {
// If location is unknown then instruction needs a location only if // If location is unknown then instruction needs a location only if

View File

@ -0,0 +1,15 @@
// RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -o %t.s
// RUN: grep "# DW_TAG_formal_parameter" %t.s | count 4
// Radar 8122864
static int foo(int a, int j) {
int k = 0;
if (a)
k = a + j;
else
k = j;
return k;
}
int bar(int o, int p) {
return foo(o, p);
}