mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-15 09:33:39 +00:00
Preserve debug info for unused zero extended boolean argument.
Radar 9422775. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cacdc4fc41
commit
227dfdb3c4
@ -4026,6 +4026,24 @@ static SDValue ExpandPowI(DebugLoc DL, SDValue LHS, SDValue RHS,
|
|||||||
return DAG.getNode(ISD::FPOWI, DL, LHS.getValueType(), LHS, RHS);
|
return DAG.getNode(ISD::FPOWI, DL, LHS.getValueType(), LHS, RHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getTruncatedArgReg - Find underlying register used for an truncated
|
||||||
|
// argument.
|
||||||
|
static unsigned getTruncatedArgReg(const SDValue &N) {
|
||||||
|
if (N.getOpcode() != ISD::TRUNCATE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
const SDValue &Ext = N.getOperand(0);
|
||||||
|
if (Ext.getOpcode() == ISD::AssertZext || Ext.getOpcode() == ISD::AssertSext){
|
||||||
|
const SDValue &CFR = Ext.getOperand(0);
|
||||||
|
if (CFR.getOpcode() == ISD::CopyFromReg)
|
||||||
|
return cast<RegisterSDNode>(CFR.getOperand(1))->getReg();
|
||||||
|
else
|
||||||
|
if (CFR.getOpcode() == ISD::TRUNCATE)
|
||||||
|
return getTruncatedArgReg(CFR);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// EmitFuncArgumentDbgValue - If the DbgValueInst is a dbg_value of a function
|
/// EmitFuncArgumentDbgValue - If the DbgValueInst is a dbg_value of a function
|
||||||
/// argument, create the corresponding DBG_VALUE machine instruction for it now.
|
/// 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.
|
/// At the end of instruction selection, they will be inserted to the entry BB.
|
||||||
@ -4057,9 +4075,12 @@ SelectionDAGBuilder::EmitFuncArgumentDbgValue(const Value *V, MDNode *Variable,
|
|||||||
Reg = 0;
|
Reg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (N.getNode() && N.getOpcode() == ISD::CopyFromReg) {
|
if (N.getNode()) {
|
||||||
Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();
|
if (N.getOpcode() == ISD::CopyFromReg)
|
||||||
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();
|
||||||
|
else
|
||||||
|
Reg = getTruncatedArgReg(N);
|
||||||
|
if (Reg && TargetRegisterInfo::isVirtualRegister(Reg)) {
|
||||||
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
||||||
unsigned PR = RegInfo.getLiveInPhysReg(Reg);
|
unsigned PR = RegInfo.getLiveInPhysReg(Reg);
|
||||||
if (PR)
|
if (PR)
|
||||||
@ -4221,9 +4242,9 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
|||||||
SDV = DAG.getDbgValue(Variable, FINode->getIndex(),
|
SDV = DAG.getDbgValue(Variable, FINode->getIndex(),
|
||||||
0, dl, SDNodeOrder);
|
0, dl, SDNodeOrder);
|
||||||
else {
|
else {
|
||||||
// Can't do anything with other non-AI cases yet. This might be a
|
// Address is an argument, so try to emit its dbg value using
|
||||||
// parameter of a callee function that got inlined, for example.
|
// virtual register info from the FuncInfo.ValueMap.
|
||||||
DEBUG(dbgs() << "Dropping debug info for " << DI);
|
EmitFuncArgumentDbgValue(Address, Variable, 0, N);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (AI)
|
} else if (AI)
|
||||||
|
@ -785,10 +785,19 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
|
|||||||
if (!DIVar.Verify())
|
if (!DIVar.Verify())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Instruction *DbgVal =
|
Instruction *DbgVal = NULL;
|
||||||
Builder.insertDbgValueIntrinsic(SI->getOperand(0), 0,
|
// If an argument is zero extended then use argument directly. The ZExt
|
||||||
DIVar, SI);
|
// may be zapped by an optimization pass in future.
|
||||||
|
Argument *ExtendedArg = NULL;
|
||||||
|
if (ZExtInst *ZExt = dyn_cast<ZExtInst>(SI->getOperand(0)))
|
||||||
|
ExtendedArg = dyn_cast<Argument>(ZExt->getOperand(0));
|
||||||
|
if (SExtInst *SExt = dyn_cast<SExtInst>(SI->getOperand(0)))
|
||||||
|
ExtendedArg = dyn_cast<Argument>(SExt->getOperand(0));
|
||||||
|
if (ExtendedArg)
|
||||||
|
DbgVal = Builder.insertDbgValueIntrinsic(ExtendedArg, 0, DIVar, SI);
|
||||||
|
else
|
||||||
|
DbgVal = Builder.insertDbgValueIntrinsic(SI->getOperand(0), 0, DIVar, SI);
|
||||||
|
|
||||||
// Propagate any debug metadata from the store onto the dbg.value.
|
// Propagate any debug metadata from the store onto the dbg.value.
|
||||||
DebugLoc SIDL = SI->getDebugLoc();
|
DebugLoc SIDL = SI->getDebugLoc();
|
||||||
if (!SIDL.isUnknown())
|
if (!SIDL.isUnknown())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user