Skip to content

Commit 98bd0d9

Browse files
authored
[SelectionDAG] Adjust placement of blank lines in debug output. NFC (#70969)
Also add a blank line to the beginning of every dump of the SelectionDAG to visually separate it from whatever the last message was. Add a blank line before "Legalizing node:" in the type legalizer. Remove the blank line after things like "Promote integer result:". This keeps all of the messages for the legalization of a single node grouped together with no blank lines in the middle. This is consistent with the operation legalizers.
1 parent 22212ca commit 98bd0d9

File tree

5 files changed

+32
-43
lines changed

5 files changed

+32
-43
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ static RTLIB::Libcall GetFPLibCall(EVT VT,
4949
//===----------------------------------------------------------------------===//
5050

5151
void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {
52-
LLVM_DEBUG(dbgs() << "Soften float result " << ResNo << ": "; N->dump(&DAG);
53-
dbgs() << "\n");
52+
LLVM_DEBUG(dbgs() << "Soften float result " << ResNo << ": "; N->dump(&DAG));
5453
SDValue R = SDValue();
5554

5655
switch (N->getOpcode()) {
@@ -898,8 +897,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_VECREDUCE_SEQ(SDNode *N) {
898897
//===----------------------------------------------------------------------===//
899898

900899
bool DAGTypeLegalizer::SoftenFloatOperand(SDNode *N, unsigned OpNo) {
901-
LLVM_DEBUG(dbgs() << "Soften float operand " << OpNo << ": "; N->dump(&DAG);
902-
dbgs() << "\n");
900+
LLVM_DEBUG(dbgs() << "Soften float operand " << OpNo << ": "; N->dump(&DAG));
903901
SDValue Res = SDValue();
904902

905903
switch (N->getOpcode()) {
@@ -1265,7 +1263,7 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_LLRINT(SDNode *N) {
12651263
/// have invalid operands or may have other results that need promotion, we just
12661264
/// know that (at least) one result needs expansion.
12671265
void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) {
1268-
LLVM_DEBUG(dbgs() << "Expand float result: "; N->dump(&DAG); dbgs() << "\n");
1266+
LLVM_DEBUG(dbgs() << "Expand float result: "; N->dump(&DAG));
12691267
SDValue Lo, Hi;
12701268
Lo = Hi = SDValue();
12711269

@@ -1870,7 +1868,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
18701868
/// types of the node are known to be legal, but other operands of the node may
18711869
/// need promotion or expansion as well as the specified one.
18721870
bool DAGTypeLegalizer::ExpandFloatOperand(SDNode *N, unsigned OpNo) {
1873-
LLVM_DEBUG(dbgs() << "Expand float operand: "; N->dump(&DAG); dbgs() << "\n");
1871+
LLVM_DEBUG(dbgs() << "Expand float operand: "; N->dump(&DAG));
18741872
SDValue Res = SDValue();
18751873

18761874
// See if the target wants to custom expand this node.
@@ -2184,8 +2182,7 @@ static ISD::NodeType GetPromotionOpcode(EVT OpVT, EVT RetVT) {
21842182
}
21852183

21862184
bool DAGTypeLegalizer::PromoteFloatOperand(SDNode *N, unsigned OpNo) {
2187-
LLVM_DEBUG(dbgs() << "Promote float operand " << OpNo << ": "; N->dump(&DAG);
2188-
dbgs() << "\n");
2185+
LLVM_DEBUG(dbgs() << "Promote float operand " << OpNo << ": "; N->dump(&DAG));
21892186
SDValue R = SDValue();
21902187

21912188
if (CustomLowerNode(N, N->getOperand(OpNo).getValueType(), false)) {
@@ -2327,8 +2324,7 @@ SDValue DAGTypeLegalizer::PromoteFloatOp_STORE(SDNode *N, unsigned OpNo) {
23272324
//===----------------------------------------------------------------------===//
23282325

23292326
void DAGTypeLegalizer::PromoteFloatResult(SDNode *N, unsigned ResNo) {
2330-
LLVM_DEBUG(dbgs() << "Promote float result " << ResNo << ": "; N->dump(&DAG);
2331-
dbgs() << "\n");
2327+
LLVM_DEBUG(dbgs() << "Promote float result " << ResNo << ": "; N->dump(&DAG));
23322328
SDValue R = SDValue();
23332329

23342330
// See if the target wants to custom expand this node.
@@ -2711,7 +2707,7 @@ SDValue DAGTypeLegalizer::BitcastToInt_ATOMIC_SWAP(SDNode *N) {
27112707

27122708
void DAGTypeLegalizer::SoftPromoteHalfResult(SDNode *N, unsigned ResNo) {
27132709
LLVM_DEBUG(dbgs() << "Soft promote half result " << ResNo << ": ";
2714-
N->dump(&DAG); dbgs() << "\n");
2710+
N->dump(&DAG));
27152711
SDValue R = SDValue();
27162712

27172713
// See if the target wants to custom expand this node.
@@ -3020,7 +3016,7 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfRes_VECREDUCE_SEQ(SDNode *N) {
30203016

30213017
bool DAGTypeLegalizer::SoftPromoteHalfOperand(SDNode *N, unsigned OpNo) {
30223018
LLVM_DEBUG(dbgs() << "Soft promote half operand " << OpNo << ": ";
3023-
N->dump(&DAG); dbgs() << "\n");
3019+
N->dump(&DAG));
30243020
SDValue Res = SDValue();
30253021

30263022
if (CustomLowerNode(N, N->getOperand(OpNo).getValueType(), false)) {

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ using namespace llvm;
3939
/// may also have invalid operands or may have other results that need
4040
/// expansion, we just know that (at least) one result needs promotion.
4141
void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
42-
LLVM_DEBUG(dbgs() << "Promote integer result: "; N->dump(&DAG);
43-
dbgs() << "\n");
42+
LLVM_DEBUG(dbgs() << "Promote integer result: "; N->dump(&DAG));
4443
SDValue Res = SDValue();
4544

4645
// See if the target wants to custom expand this node.
@@ -1746,8 +1745,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_VAARG(SDNode *N) {
17461745
/// result types of the node are known to be legal, but other operands of the
17471746
/// node may need promotion or expansion as well as the specified one.
17481747
bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
1749-
LLVM_DEBUG(dbgs() << "Promote integer operand: "; N->dump(&DAG);
1750-
dbgs() << "\n");
1748+
LLVM_DEBUG(dbgs() << "Promote integer operand: "; N->dump(&DAG));
17511749
SDValue Res = SDValue();
17521750
if (CustomLowerNode(N, N->getOperand(OpNo).getValueType(), false)) {
17531751
LLVM_DEBUG(dbgs() << "Node has been custom lowered, done\n");
@@ -2560,8 +2558,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_VP_STRIDED(SDNode *N, unsigned OpNo) {
25602558
/// have invalid operands or may have other results that need promotion, we just
25612559
/// know that (at least) one result needs expansion.
25622560
void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
2563-
LLVM_DEBUG(dbgs() << "Expand integer result: "; N->dump(&DAG);
2564-
dbgs() << "\n");
2561+
LLVM_DEBUG(dbgs() << "Expand integer result: "; N->dump(&DAG));
25652562
SDValue Lo, Hi;
25662563
Lo = Hi = SDValue();
25672564

@@ -5067,8 +5064,7 @@ void DAGTypeLegalizer::ExpandIntRes_VSCALE(SDNode *N, SDValue &Lo,
50675064
/// result types of the node are known to be legal, but other operands of the
50685065
/// node may need promotion or expansion as well as the specified one.
50695066
bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
5070-
LLVM_DEBUG(dbgs() << "Expand integer operand: "; N->dump(&DAG);
5071-
dbgs() << "\n");
5067+
LLVM_DEBUG(dbgs() << "Expand integer operand: "; N->dump(&DAG));
50725068
SDValue Res = SDValue();
50735069

50745070
if (CustomLowerNode(N, N->getOperand(OpNo).getValueType(), false))

llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ bool DAGTypeLegalizer::run() {
235235
assert(N->getNodeId() == ReadyToProcess &&
236236
"Node should be ready if on worklist!");
237237

238-
LLVM_DEBUG(dbgs() << "Legalizing node: "; N->dump(&DAG));
238+
LLVM_DEBUG(dbgs() << "\nLegalizing node: "; N->dump(&DAG));
239239
if (IgnoreNodeResults(N)) {
240240
LLVM_DEBUG(dbgs() << "Ignoring node results\n");
241241
goto ScanOperands;
@@ -390,8 +390,7 @@ bool DAGTypeLegalizer::run() {
390390
}
391391

392392
if (i == NumOperands) {
393-
LLVM_DEBUG(dbgs() << "Legally typed node: "; N->dump(&DAG);
394-
dbgs() << "\n");
393+
LLVM_DEBUG(dbgs() << "Legally typed node: "; N->dump(&DAG));
395394
}
396395
}
397396
NodeDone:

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ using namespace llvm;
3838
//===----------------------------------------------------------------------===//
3939

4040
void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
41-
LLVM_DEBUG(dbgs() << "Scalarize node result " << ResNo << ": "; N->dump(&DAG);
42-
dbgs() << "\n");
41+
LLVM_DEBUG(dbgs() << "Scalarize node result " << ResNo << ": ";
42+
N->dump(&DAG));
4343
SDValue R = SDValue();
4444

4545
switch (N->getOpcode()) {
@@ -659,8 +659,8 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_IS_FPCLASS(SDNode *N) {
659659
//===----------------------------------------------------------------------===//
660660

661661
bool DAGTypeLegalizer::ScalarizeVectorOperand(SDNode *N, unsigned OpNo) {
662-
LLVM_DEBUG(dbgs() << "Scalarize node operand " << OpNo << ": "; N->dump(&DAG);
663-
dbgs() << "\n");
662+
LLVM_DEBUG(dbgs() << "Scalarize node operand " << OpNo << ": ";
663+
N->dump(&DAG));
664664
SDValue Res = SDValue();
665665

666666
switch (N->getOpcode()) {
@@ -970,7 +970,7 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_VECREDUCE_SEQ(SDNode *N) {
970970
/// invalid operands or may have other results that need legalization, we just
971971
/// know that (at least) one result needs vector splitting.
972972
void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) {
973-
LLVM_DEBUG(dbgs() << "Split node result: "; N->dump(&DAG); dbgs() << "\n");
973+
LLVM_DEBUG(dbgs() << "Split node result: "; N->dump(&DAG));
974974
SDValue Lo, Hi;
975975

976976
// See if the target wants to custom expand this node.
@@ -2897,7 +2897,7 @@ void DAGTypeLegalizer::SplitVecRes_VECTOR_INTERLEAVE(SDNode *N) {
28972897
/// the node are known to be legal, but other operands of the node may need
28982898
/// legalization as well as the specified one.
28992899
bool DAGTypeLegalizer::SplitVectorOperand(SDNode *N, unsigned OpNo) {
2900-
LLVM_DEBUG(dbgs() << "Split node operand: "; N->dump(&DAG); dbgs() << "\n");
2900+
LLVM_DEBUG(dbgs() << "Split node operand: "; N->dump(&DAG));
29012901
SDValue Res = SDValue();
29022902

29032903
// See if the target wants to custom split this node.
@@ -3983,8 +3983,7 @@ SDValue DAGTypeLegalizer::SplitVecOp_FP_TO_XINT_SAT(SDNode *N) {
39833983
//===----------------------------------------------------------------------===//
39843984

39853985
void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
3986-
LLVM_DEBUG(dbgs() << "Widen node result " << ResNo << ": "; N->dump(&DAG);
3987-
dbgs() << "\n");
3986+
LLVM_DEBUG(dbgs() << "Widen node result " << ResNo << ": "; N->dump(&DAG));
39883987

39893988
// See if the target wants to custom widen this node.
39903989
if (CustomWidenLowerNode(N, N->getValueType(ResNo)))
@@ -5932,8 +5931,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_STRICT_FSETCC(SDNode *N) {
59325931
// Widen Vector Operand
59335932
//===----------------------------------------------------------------------===//
59345933
bool DAGTypeLegalizer::WidenVectorOperand(SDNode *N, unsigned OpNo) {
5935-
LLVM_DEBUG(dbgs() << "Widen node operand " << OpNo << ": "; N->dump(&DAG);
5936-
dbgs() << "\n");
5934+
LLVM_DEBUG(dbgs() << "Widen node operand " << OpNo << ": "; N->dump(&DAG));
59375935
SDValue Res = SDValue();
59385936

59395937
// See if the target wants to custom widen this node.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
765765
BlockName =
766766
(MF->getName() + ":" + FuncInfo->MBB->getBasicBlock()->getName()).str();
767767
}
768-
LLVM_DEBUG(dbgs() << "Initial selection DAG: "
768+
LLVM_DEBUG(dbgs() << "\nInitial selection DAG: "
769769
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
770770
<< "'\n";
771771
CurDAG->dump());
@@ -785,7 +785,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
785785
CurDAG->Combine(BeforeLegalizeTypes, AA, OptLevel);
786786
}
787787

788-
LLVM_DEBUG(dbgs() << "Optimized lowered selection DAG: "
788+
LLVM_DEBUG(dbgs() << "\nOptimized lowered selection DAG: "
789789
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
790790
<< "'\n";
791791
CurDAG->dump());
@@ -807,7 +807,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
807807
Changed = CurDAG->LegalizeTypes();
808808
}
809809

810-
LLVM_DEBUG(dbgs() << "Type-legalized selection DAG: "
810+
LLVM_DEBUG(dbgs() << "\nType-legalized selection DAG: "
811811
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
812812
<< "'\n";
813813
CurDAG->dump());
@@ -831,7 +831,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
831831
CurDAG->Combine(AfterLegalizeTypes, AA, OptLevel);
832832
}
833833

834-
LLVM_DEBUG(dbgs() << "Optimized type-legalized selection DAG: "
834+
LLVM_DEBUG(dbgs() << "\nOptimized type-legalized selection DAG: "
835835
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
836836
<< "'\n";
837837
CurDAG->dump());
@@ -849,7 +849,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
849849
}
850850

851851
if (Changed) {
852-
LLVM_DEBUG(dbgs() << "Vector-legalized selection DAG: "
852+
LLVM_DEBUG(dbgs() << "\nVector-legalized selection DAG: "
853853
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
854854
<< "'\n";
855855
CurDAG->dump());
@@ -865,7 +865,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
865865
CurDAG->LegalizeTypes();
866866
}
867867

868-
LLVM_DEBUG(dbgs() << "Vector/type-legalized selection DAG: "
868+
LLVM_DEBUG(dbgs() << "\nVector/type-legalized selection DAG: "
869869
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
870870
<< "'\n";
871871
CurDAG->dump());
@@ -885,7 +885,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
885885
CurDAG->Combine(AfterLegalizeVectorOps, AA, OptLevel);
886886
}
887887

888-
LLVM_DEBUG(dbgs() << "Optimized vector-legalized selection DAG: "
888+
LLVM_DEBUG(dbgs() << "\nOptimized vector-legalized selection DAG: "
889889
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
890890
<< "'\n";
891891
CurDAG->dump());
@@ -905,7 +905,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
905905
CurDAG->Legalize();
906906
}
907907

908-
LLVM_DEBUG(dbgs() << "Legalized selection DAG: "
908+
LLVM_DEBUG(dbgs() << "\nLegalized selection DAG: "
909909
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
910910
<< "'\n";
911911
CurDAG->dump());
@@ -925,7 +925,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
925925
CurDAG->Combine(AfterLegalizeDAG, AA, OptLevel);
926926
}
927927

928-
LLVM_DEBUG(dbgs() << "Optimized legalized selection DAG: "
928+
LLVM_DEBUG(dbgs() << "\nOptimized legalized selection DAG: "
929929
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
930930
<< "'\n";
931931
CurDAG->dump());
@@ -949,7 +949,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
949949
DoInstructionSelection();
950950
}
951951

952-
LLVM_DEBUG(dbgs() << "Selected selection DAG: "
952+
LLVM_DEBUG(dbgs() << "\nSelected selection DAG: "
953953
<< printMBBReference(*FuncInfo->MBB) << " '" << BlockName
954954
<< "'\n";
955955
CurDAG->dump());

0 commit comments

Comments
 (0)