Skip to content

Commit eeb5ac0

Browse files
OCHyamsronlieb
authored andcommitted
[RemoveDIs][NFC] Remove dbg intrinsic handling code from SelectionDAG ISel (llvm#144702)
1 parent 6cb1133 commit eeb5ac0

File tree

6 files changed

+1
-120
lines changed

6 files changed

+1
-120
lines changed

llvm/include/llvm/CodeGen/FunctionLoweringInfo.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ namespace llvm {
3535
class Argument;
3636
class BasicBlock;
3737
class BranchProbabilityInfo;
38-
class DbgDeclareInst;
3938
class Function;
4039
class Instruction;
4140
class MachineFunction;
@@ -191,9 +190,8 @@ class FunctionLoweringInfo {
191190
/// The current call site index being processed, if any. 0 if none.
192191
unsigned CurCallSite = 0;
193192

194-
/// Collection of dbg.declare instructions handled after argument
193+
/// Collection of dbg_declare instructions handled after argument
195194
/// lowering and before ISel proper.
196-
SmallPtrSet<const DbgDeclareInst *, 8> PreprocessedDbgDeclares;
197195
SmallPtrSet<const DbgVariableRecord *, 8> PreprocessedDVRDeclares;
198196

199197
/// set - Initialize this FunctionLoweringInfo with the given Function

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,54 +1395,6 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
13951395
// Neither does the llvm.experimental.noalias.scope.decl intrinsic
13961396
case Intrinsic::experimental_noalias_scope_decl:
13971397
return true;
1398-
case Intrinsic::dbg_declare: {
1399-
const DbgDeclareInst *DI = cast<DbgDeclareInst>(II);
1400-
assert(DI->getVariable() && "Missing variable");
1401-
if (FuncInfo.PreprocessedDbgDeclares.contains(DI))
1402-
return true;
1403-
1404-
const Value *Address = DI->getAddress();
1405-
if (!lowerDbgDeclare(Address, DI->getExpression(), DI->getVariable(),
1406-
MIMD.getDL()))
1407-
LLVM_DEBUG(dbgs() << "Dropping debug info for " << *DI);
1408-
1409-
return true;
1410-
}
1411-
case Intrinsic::dbg_assign:
1412-
// A dbg.assign is a dbg.value with more information, typically produced
1413-
// during optimisation. If one reaches fastisel then something odd has
1414-
// happened (such as an optimised function being always-inlined into an
1415-
// optnone function). We will not be using the extra information in the
1416-
// dbg.assign in that case, just use its dbg.value fields.
1417-
[[fallthrough]];
1418-
case Intrinsic::dbg_value: {
1419-
// This form of DBG_VALUE is target-independent.
1420-
const DbgValueInst *DI = cast<DbgValueInst>(II);
1421-
const Value *V = DI->getValue();
1422-
DIExpression *Expr = DI->getExpression();
1423-
DILocalVariable *Var = DI->getVariable();
1424-
if (DI->hasArgList())
1425-
// Signal that we don't have a location for this.
1426-
V = nullptr;
1427-
1428-
assert(Var->isValidLocationForIntrinsic(MIMD.getDL()) &&
1429-
"Expected inlined-at fields to agree");
1430-
1431-
if (!lowerDbgValue(V, Expr, Var, MIMD.getDL()))
1432-
LLVM_DEBUG(dbgs() << "Dropping debug info for " << *DI << "\n");
1433-
1434-
return true;
1435-
}
1436-
case Intrinsic::dbg_label: {
1437-
const DbgLabelInst *DI = cast<DbgLabelInst>(II);
1438-
assert(DI->getLabel() && "Missing label");
1439-
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD,
1440-
TII.get(TargetOpcode::DBG_LABEL)).addMetadata(DI->getLabel());
1441-
return true;
1442-
}
1443-
case Intrinsic::dbg_def:
1444-
case Intrinsic::dbg_kill:
1445-
report_fatal_error("unsupported DIExpr-based metadata");
14461398
case Intrinsic::objectsize:
14471399
llvm_unreachable("llvm.objectsize.* should have been lowered already");
14481400

llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ void FunctionLoweringInfo::clear() {
369369
StatepointStackSlots.clear();
370370
StatepointRelocationMaps.clear();
371371
PreferredExtendType.clear();
372-
PreprocessedDbgDeclares.clear();
373372
PreprocessedDVRDeclares.clear();
374373
}
375374

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6676,69 +6676,6 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
66766676
DAG.setRoot(Res.getValue(1));
66776677
return;
66786678
}
6679-
case Intrinsic::dbg_declare: {
6680-
const auto &DI = cast<DbgDeclareInst>(I);
6681-
// Debug intrinsics are handled separately in assignment tracking mode.
6682-
// Some intrinsics are handled right after Argument lowering.
6683-
if (AssignmentTrackingEnabled ||
6684-
FuncInfo.PreprocessedDbgDeclares.count(&DI))
6685-
return;
6686-
LLVM_DEBUG(dbgs() << "SelectionDAG visiting dbg_declare: " << DI << "\n");
6687-
DILocalVariable *Variable = DI.getVariable();
6688-
DIExpression *Expression = DI.getExpression();
6689-
dropDanglingDebugInfo(Variable, Expression);
6690-
// Assume dbg.declare can not currently use DIArgList, i.e.
6691-
// it is non-variadic.
6692-
assert(!DI.hasArgList() && "Only dbg.value should currently use DIArgList");
6693-
handleDebugDeclare(DI.getVariableLocationOp(0), Variable, Expression,
6694-
DI.getDebugLoc());
6695-
return;
6696-
}
6697-
case Intrinsic::dbg_label: {
6698-
const DbgLabelInst &DI = cast<DbgLabelInst>(I);
6699-
DILabel *Label = DI.getLabel();
6700-
assert(Label && "Missing label");
6701-
6702-
SDDbgLabel *SDV;
6703-
SDV = DAG.getDbgLabel(Label, dl, SDNodeOrder);
6704-
DAG.AddDbgLabel(SDV);
6705-
return;
6706-
}
6707-
case Intrinsic::dbg_assign: {
6708-
// Debug intrinsics are handled separately in assignment tracking mode.
6709-
if (AssignmentTrackingEnabled)
6710-
return;
6711-
// If assignment tracking hasn't been enabled then fall through and treat
6712-
// the dbg.assign as a dbg.value.
6713-
[[fallthrough]];
6714-
}
6715-
case Intrinsic::dbg_value: {
6716-
// Debug intrinsics are handled separately in assignment tracking mode.
6717-
if (AssignmentTrackingEnabled)
6718-
return;
6719-
const DbgValueInst &DI = cast<DbgValueInst>(I);
6720-
assert(DI.getVariable() && "Missing variable");
6721-
6722-
DILocalVariable *Variable = DI.getVariable();
6723-
DIExpression *Expression = DI.getExpression();
6724-
dropDanglingDebugInfo(Variable, Expression);
6725-
6726-
if (DI.isKillLocation()) {
6727-
handleKillDebugValue(Variable, Expression, DI.getDebugLoc(), SDNodeOrder);
6728-
return;
6729-
}
6730-
6731-
SmallVector<Value *, 4> Values(DI.getValues());
6732-
if (Values.empty())
6733-
return;
6734-
6735-
bool IsVariadic = DI.hasArgList();
6736-
if (!handleDebugValue(Values, Variable, Expression, DI.getDebugLoc(),
6737-
SDNodeOrder, IsVariadic))
6738-
addDanglingDebugInfo(Values, Variable, Expression, IsVariadic,
6739-
DI.getDebugLoc(), SDNodeOrder);
6740-
return;
6741-
}
67426679

67436680
case Intrinsic::eh_typeid_for: {
67446681
// Find the type id for the given typeinfo.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class CleanupPadInst;
5656
class CleanupReturnInst;
5757
class Constant;
5858
class ConstrainedFPIntrinsic;
59-
class DbgValueInst;
6059
class DataLayout;
6160
class DIExpression;
6261
class DILocalVariable;

llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,10 +1592,6 @@ static bool processDbgDeclare(FunctionLoweringInfo &FuncInfo,
15921592
/// in case the declarations refer to arguments.
15931593
static void processDbgDeclares(FunctionLoweringInfo &FuncInfo) {
15941594
for (const auto &I : instructions(*FuncInfo.Fn)) {
1595-
const auto *DI = dyn_cast<DbgDeclareInst>(&I);
1596-
if (DI && processDbgDeclare(FuncInfo, DI->getAddress(), DI->getExpression(),
1597-
DI->getVariable(), DI->getDebugLoc()))
1598-
FuncInfo.PreprocessedDbgDeclares.insert(DI);
15991595
for (const DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
16001596
if (DVR.Type == DbgVariableRecord::LocationType::Declare &&
16011597
processDbgDeclare(FuncInfo, DVR.getVariableLocationOp(0),

0 commit comments

Comments
 (0)