aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-04-29 01:40:30 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-04-29 01:40:30 +0000
commit9e8a2b93465bc8abd9b318faebb256b1c168baa9 (patch)
tree09d6f461edf9ea95fb872b7103921d647d2939c6 /lib/CodeGen/SelectionDAG
parentc924556dd5fd3a3912d5e9ce201ee571bdefdd1a (diff)
downloadexternal_llvm-9e8a2b93465bc8abd9b318faebb256b1c168baa9.zip
external_llvm-9e8a2b93465bc8abd9b318faebb256b1c168baa9.tar.gz
external_llvm-9e8a2b93465bc8abd9b318faebb256b1c168baa9.tar.bz2
Do not generate duplicate dbg_value instructions for function arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp18
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h2
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index cb933d7..38e0c29 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3684,17 +3684,17 @@ static SDValue ExpandPowI(DebugLoc DL, SDValue LHS, SDValue RHS,
/// EmitFuncArgumentDbgValue - If the DbgValueInst is a dbg_value of a function
/// argument, create the corresponding DBG_VALUE machine instruction for it now.
/// At the end of instruction selection, they will be inserted to the entry BB.
-void
+bool
SelectionDAGBuilder::EmitFuncArgumentDbgValue(const DbgValueInst &DI,
const Value *V, MDNode *Variable,
uint64_t Offset, SDValue &N) {
if (!isa<Argument>(V))
- return;
+ return false;
MachineFunction &MF = DAG.getMachineFunction();
MachineBasicBlock *MBB = FuncInfo.MBBMap[DI.getParent()];
if (MBB != &MF.front())
- return;
+ return false;
unsigned Reg = 0;
if (N.getOpcode() == ISD::CopyFromReg) {
@@ -3710,13 +3710,14 @@ SelectionDAGBuilder::EmitFuncArgumentDbgValue(const DbgValueInst &DI,
if (!Reg)
Reg = FuncInfo.ValueMap[V];
if (!Reg)
- return;
+ return false;
const TargetInstrInfo *TII = DAG.getTarget().getInstrInfo();
MachineInstrBuilder MIB = BuildMI(MF, getCurDebugLoc(),
TII->get(TargetOpcode::DBG_VALUE))
.addReg(Reg).addImm(Offset).addMetadata(Variable);
FuncInfo.ArgDbgValues.push_back(&*MIB);
+ return true;
}
/// visitIntrinsicCall - Lower the call to the specified intrinsic function. If
@@ -3895,10 +3896,11 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
} else {
SDValue &N = NodeMap[V];
if (N.getNode()) {
- EmitFuncArgumentDbgValue(DI, V, Variable, Offset, N);
- SDV = DAG.getDbgValue(Variable, N.getNode(),
- N.getResNo(), Offset, dl, SDNodeOrder);
- DAG.AddDbgValue(SDV, N.getNode(), false);
+ if (!EmitFuncArgumentDbgValue(DI, V, Variable, Offset, N)) {
+ SDV = DAG.getDbgValue(Variable, N.getNode(),
+ N.getResNo(), Offset, dl, SDNodeOrder);
+ DAG.AddDbgValue(SDV, N.getNode(), false);
+ }
} else {
// We may expand this to cover more cases. One case where we have no
// data available is an unreferenced parameter; we need this fallback.
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index b07d70a..f52c0e0 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
@@ -502,7 +502,7 @@ private:
/// function argument, create the corresponding DBG_VALUE machine instruction
/// for it now. At the end of instruction selection, they will be inserted to
/// the entry BB.
- void EmitFuncArgumentDbgValue(const DbgValueInst &DI,
+ bool EmitFuncArgumentDbgValue(const DbgValueInst &DI,
const Value *V, MDNode *Variable,
uint64_t Offset, SDValue &N);
};