mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
DebugInfo: Assert dbg.declare/value insts are valid
Remove early returns for when `getVariable()` is null, and just assert that it never happens. The Verifier already confirms that there's a valid variable on these intrinsics, so we should assume the debug info isn't broken. I also updated a check for a `!dbg` attachment, which the Verifier similarly guarantees. llvm-svn: 235400
This commit is contained in:
parent
3b4014368f
commit
8c237b09f4
@ -1088,8 +1088,8 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
|
|||||||
}
|
}
|
||||||
case Intrinsic::dbg_declare: {
|
case Intrinsic::dbg_declare: {
|
||||||
const DbgDeclareInst *DI = cast<DbgDeclareInst>(II);
|
const DbgDeclareInst *DI = cast<DbgDeclareInst>(II);
|
||||||
DIVariable DIVar = DI->getVariable();
|
assert(DI->getVariable() && "Missing variable");
|
||||||
if (!DIVar || !FuncInfo.MF->getMMI().hasDebugInfo()) {
|
if (!FuncInfo.MF->getMMI().hasDebugInfo()) {
|
||||||
DEBUG(dbgs() << "Dropping debug info for " << *DI << "\n");
|
DEBUG(dbgs() << "Dropping debug info for " << *DI << "\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -202,8 +202,9 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
|||||||
// during the initial isel pass through the IR so that it is done
|
// during the initial isel pass through the IR so that it is done
|
||||||
// in a predictable order.
|
// in a predictable order.
|
||||||
if (const DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(I)) {
|
if (const DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(I)) {
|
||||||
DIVariable DIVar = DI->getVariable();
|
assert(DI->getVariable() && "Missing variable");
|
||||||
if (MMI.hasDebugInfo() && DIVar && DI->getDebugLoc()) {
|
assert(DI->getDebugLoc() && "Missing location");
|
||||||
|
if (MMI.hasDebugInfo()) {
|
||||||
// Don't handle byval struct arguments or VLAs, for example.
|
// Don't handle byval struct arguments or VLAs, for example.
|
||||||
// Non-byval arguments are handled here (they refer to the stack
|
// Non-byval arguments are handled here (they refer to the stack
|
||||||
// temporary alloca at this point).
|
// temporary alloca at this point).
|
||||||
|
@ -4650,8 +4650,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
|||||||
MDLocalVariable *Variable = DI.getVariable();
|
MDLocalVariable *Variable = DI.getVariable();
|
||||||
MDExpression *Expression = DI.getExpression();
|
MDExpression *Expression = DI.getExpression();
|
||||||
const Value *Address = DI.getAddress();
|
const Value *Address = DI.getAddress();
|
||||||
DIVariable DIVar = Variable;
|
assert(Variable && "Missing variable");
|
||||||
if (!Address || !DIVar) {
|
if (!Address) {
|
||||||
DEBUG(dbgs() << "Dropping debug info for " << DI << "\n");
|
DEBUG(dbgs() << "Dropping debug info for " << DI << "\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -4728,9 +4728,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
|||||||
}
|
}
|
||||||
case Intrinsic::dbg_value: {
|
case Intrinsic::dbg_value: {
|
||||||
const DbgValueInst &DI = cast<DbgValueInst>(I);
|
const DbgValueInst &DI = cast<DbgValueInst>(I);
|
||||||
DIVariable DIVar = DI.getVariable();
|
assert(DI.getVariable() && "Missing variable");
|
||||||
if (!DIVar)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
MDLocalVariable *Variable = DI.getVariable();
|
MDLocalVariable *Variable = DI.getVariable();
|
||||||
MDExpression *Expression = DI.getExpression();
|
MDExpression *Expression = DI.getExpression();
|
||||||
|
@ -1000,8 +1000,7 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
|
|||||||
StoreInst *SI, DIBuilder &Builder) {
|
StoreInst *SI, DIBuilder &Builder) {
|
||||||
DIVariable DIVar = DDI->getVariable();
|
DIVariable DIVar = DDI->getVariable();
|
||||||
DIExpression DIExpr = DDI->getExpression();
|
DIExpression DIExpr = DDI->getExpression();
|
||||||
if (!DIVar)
|
assert(DIVar && "Missing variable");
|
||||||
return false;
|
|
||||||
|
|
||||||
if (LdStHasDebugValue(DIVar, SI))
|
if (LdStHasDebugValue(DIVar, SI))
|
||||||
return true;
|
return true;
|
||||||
@ -1028,8 +1027,7 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
|
|||||||
LoadInst *LI, DIBuilder &Builder) {
|
LoadInst *LI, DIBuilder &Builder) {
|
||||||
DIVariable DIVar = DDI->getVariable();
|
DIVariable DIVar = DDI->getVariable();
|
||||||
DIExpression DIExpr = DDI->getExpression();
|
DIExpression DIExpr = DDI->getExpression();
|
||||||
if (!DIVar)
|
assert(DIVar && "Missing variable");
|
||||||
return false;
|
|
||||||
|
|
||||||
if (LdStHasDebugValue(DIVar, LI))
|
if (LdStHasDebugValue(DIVar, LI))
|
||||||
return true;
|
return true;
|
||||||
@ -1107,8 +1105,7 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
|
|||||||
DebugLoc Loc = DDI->getDebugLoc();
|
DebugLoc Loc = DDI->getDebugLoc();
|
||||||
DIVariable DIVar = DDI->getVariable();
|
DIVariable DIVar = DDI->getVariable();
|
||||||
DIExpression DIExpr = DDI->getExpression();
|
DIExpression DIExpr = DDI->getExpression();
|
||||||
if (!DIVar)
|
assert(DIVar && "Missing variable");
|
||||||
return false;
|
|
||||||
|
|
||||||
if (Deref) {
|
if (Deref) {
|
||||||
// Create a copy of the original DIDescriptor for user variable, prepending
|
// Create a copy of the original DIDescriptor for user variable, prepending
|
||||||
|
Loading…
Reference in New Issue
Block a user