Skip to content

Commit 7e613bd

Browse files
authored
Cleanup compiler warnings and fix failing NVPTX tests (#3238)
1 parent 42fbe83 commit 7e613bd

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ void DwarfExpression::addExpression(DIExpression::NewElementsRef Expr,
756756
IsFragment = false;
757757
ASTRoot.reset();
758758
this->TRI = nullptr;
759-
this->ArgLocEntries = std::nullopt;
759+
this->ArgLocEntries = {};
760760
}
761761

762762
/// add masking operations to stencil out a subregister.

llvm/lib/DWARFCFIChecker/DWARFCFIState.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ dwarf::CFIProgram DWARFCFIState::convert(MCCFIInstruction Directive) {
161161
CFIP.addInstruction(dwarf::DW_CFA_val_offset, Directive.getRegister(),
162162
Directive.getOffset());
163163
break;
164+
case MCCFIInstruction::OpLLVMRegisterPair:
165+
case MCCFIInstruction::OpLLVMVectorRegisters:
166+
case MCCFIInstruction::OpLLVMVectorOffset:
167+
case MCCFIInstruction::OpLLVMVectorRegisterMask:
168+
// TODO: These should be pretty straightforward to support, but is low
169+
// priority. Similarly the implementation of OpLLVMDefAspaceCfa above
170+
// seem incomplete and should be fixed.
171+
Context->reportWarning(Directive.getLoc(),
172+
"this directive is not supported, ignoring it");
173+
break;
164174
}
165175

166176
return CFIP;

llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,11 @@ Value *InferAddressSpacesImpl::cloneValueWithNewAddressSpace(
873873
NewI->setDebugLoc(I->getDebugLoc());
874874
}
875875
}
876-
if (NewV) {
876+
// Move debug markers to the inferred aspace, unless they already refer
877+
// directly to an alloca. The alloca should reflect the "true" location
878+
// anyway, and if it is optimized out later and infer-address-spaces runs
879+
// again we should be no worse off.
880+
if (NewV && !isa<AllocaInst>(I)) {
877881
Instruction *DomPoint =
878882
isa<Instruction>(NewV) ? cast<Instruction>(NewV) : I;
879883
replaceAllDbgUsesWith(*I, *NewV, *DomPoint, *DT);

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,11 +2817,6 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
28172817
if (FromTy->isPointerTy() && ToTy->isPointerTy()) {
28182818
// Non-bitcast address space conversions are only supported on
28192819
// DIOp-DIExpressions.
2820-
auto IdentityNew = [&](DbgVariableIntrinsic &DII) -> DbgValReplacement {
2821-
if (DII.getExpression()->holdsNewElements())
2822-
return updateNewDIExpressionArgType(DII, &From, ToTy);
2823-
return std::nullopt;
2824-
};
28252820
auto IdentityNewDVR = [&](DbgVariableRecord &DVR) -> DbgValReplacement {
28262821
if (DVR.getExpression()->holdsNewElements())
28272822
return updateNewDIExpressionArgType(DVR, &From, ToTy);

llvm/test/DebugInfo/NVPTX/debug-info.ll

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,12 @@ if.end: ; preds = %if.then, %entry
585585
; CHECK-NEXT: }
586586
; CHECK-NEXT: .section .debug_info
587587
; CHECK-NEXT: {
588-
; CHECK-NEXT: .b32 2404 // Length of Unit
588+
; CHECK-NEXT: .b32 2417 // Length of Unit
589589
; CHECK-NEXT: .b8 2 // DWARF version number
590590
; CHECK-NEXT: .b8 0
591591
; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
592592
; CHECK-NEXT: .b8 8 // Address Size (in bytes)
593-
; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0x95d DW_TAG_compile_unit
593+
; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0x96a DW_TAG_compile_unit
594594
; CHECK-NEXT: .b8 0 // DW_AT_producer
595595
; CHECK-NEXT: .b8 4 // DW_AT_language
596596
; CHECK-NEXT: .b8 0
@@ -2480,7 +2480,7 @@ if.end: ; preds = %if.then, %entry
24802480
; CHECK-NEXT: .b8 4 // DW_AT_byte_size
24812481
; CHECK-NEXT: .b8 12 // Abbrev [12] 0x83d:0x5 DW_TAG_pointer_type
24822482
; CHECK-NEXT: .b32 2100 // DW_AT_type
2483-
; CHECK-NEXT: .b8 23 // Abbrev [23] 0x842:0xe5 DW_TAG_subprogram
2483+
; CHECK-NEXT: .b8 23 // Abbrev [23] 0x842:0xf2 DW_TAG_subprogram
24842484
; CHECK-NEXT: .b64 $L__func_begin0 // DW_AT_low_pc
24852485
; CHECK-NEXT: .b64 $L__func_end0 // DW_AT_high_pc
24862486
; CHECK-NEXT: .b8 1 // DW_AT_frame_base
@@ -2521,7 +2521,7 @@ if.end: ; preds = %if.then, %entry
25212521
; CHECK-NEXT: .b8 0
25222522
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
25232523
; CHECK-NEXT: .b8 5 // DW_AT_decl_line
2524-
; CHECK-NEXT: .b32 2400 // DW_AT_type
2524+
; CHECK-NEXT: .b32 2413 // DW_AT_type
25252525
; CHECK-NEXT: .b8 25 // Abbrev [25] 0x87d:0xd DW_TAG_formal_parameter
25262526
; CHECK-NEXT: .b32 $L__debug_loc0 // DW_AT_location
25272527
; CHECK-NEXT: .b8 97 // DW_AT_name
@@ -2563,7 +2563,7 @@ if.end: ; preds = %if.then, %entry
25632563
; CHECK-NEXT: .b8 0
25642564
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
25652565
; CHECK-NEXT: .b8 6 // DW_AT_decl_line
2566-
; CHECK-NEXT: .b32 2400 // DW_AT_type
2566+
; CHECK-NEXT: .b32 2413 // DW_AT_type
25672567
; CHECK-NEXT: .b8 27 // Abbrev [27] 0x8b9:0x18 DW_TAG_inlined_subroutine
25682568
; CHECK-NEXT: .b32 691 // DW_AT_abstract_origin
25692569
; CHECK-NEXT: .b64 $L__tmp3 // DW_AT_low_pc
@@ -2585,7 +2585,7 @@ if.end: ; preds = %if.then, %entry
25852585
; CHECK-NEXT: .b8 1 // DW_AT_call_file
25862586
; CHECK-NEXT: .b8 6 // DW_AT_call_line
25872587
; CHECK-NEXT: .b8 37 // DW_AT_call_column
2588-
; CHECK-NEXT: .b8 28 // Abbrev [28] 0x901:0x25 DW_TAG_inlined_subroutine
2588+
; CHECK-NEXT: .b8 28 // Abbrev [28] 0x901:0x32 DW_TAG_inlined_subroutine
25892589
; CHECK-NEXT: .b32 2050 // DW_AT_abstract_origin
25902590
; CHECK-NEXT: .b64 $L__tmp11 // DW_AT_low_pc
25912591
; CHECK-NEXT: .b64 $L__tmp12 // DW_AT_high_pc
@@ -2601,19 +2601,29 @@ if.end: ; preds = %if.then, %entry
26012601
; CHECK-NEXT: .b8 149
26022602
; CHECK-NEXT: .b8 1
26032603
; CHECK-NEXT: .b32 2079 // DW_AT_abstract_origin
2604+
; CHECK-NEXT: .b8 29 // Abbrev [29] 0x925:0xd DW_TAG_formal_parameter
2605+
; CHECK-NEXT: .b8 2 // DW_AT_address_class
2606+
; CHECK-NEXT: .b8 6 // DW_AT_location
2607+
; CHECK-NEXT: .b8 144
2608+
; CHECK-NEXT: .b8 183
2609+
; CHECK-NEXT: .b8 200
2610+
; CHECK-NEXT: .b8 201
2611+
; CHECK-NEXT: .b8 171
2612+
; CHECK-NEXT: .b8 2
2613+
; CHECK-NEXT: .b32 2088 // DW_AT_abstract_origin
26042614
; CHECK-NEXT: .b8 0 // End Of Children Mark
26052615
; CHECK-NEXT: .b8 0 // End Of Children Mark
2606-
; CHECK-NEXT: .b8 30 // Abbrev [30] 0x927:0xd DW_TAG_namespace
2616+
; CHECK-NEXT: .b8 30 // Abbrev [30] 0x934:0xd DW_TAG_namespace
26072617
; CHECK-NEXT: .b8 115 // DW_AT_name
26082618
; CHECK-NEXT: .b8 116
26092619
; CHECK-NEXT: .b8 100
26102620
; CHECK-NEXT: .b8 0
2611-
; CHECK-NEXT: .b8 31 // Abbrev [31] 0x92c:0x7 DW_TAG_imported_declaration
2621+
; CHECK-NEXT: .b8 31 // Abbrev [31] 0x939:0x7 DW_TAG_imported_declaration
26122622
; CHECK-NEXT: .b8 4 // DW_AT_decl_file
26132623
; CHECK-NEXT: .b8 202 // DW_AT_decl_line
2614-
; CHECK-NEXT: .b32 2356 // DW_AT_import
2624+
; CHECK-NEXT: .b32 2369 // DW_AT_import
26152625
; CHECK-NEXT: .b8 0 // End Of Children Mark
2616-
; CHECK-NEXT: .b8 32 // Abbrev [32] 0x934:0x1b DW_TAG_subprogram
2626+
; CHECK-NEXT: .b8 32 // Abbrev [32] 0x941:0x1b DW_TAG_subprogram
26172627
; CHECK-NEXT: .b8 95 // DW_AT_MIPS_linkage_name
26182628
; CHECK-NEXT: .b8 90
26192629
; CHECK-NEXT: .b8 76
@@ -2629,12 +2639,12 @@ if.end: ; preds = %if.then, %entry
26292639
; CHECK-NEXT: .b8 0
26302640
; CHECK-NEXT: .b8 4 // DW_AT_decl_file
26312641
; CHECK-NEXT: .b8 44 // DW_AT_decl_line
2632-
; CHECK-NEXT: .b32 2383 // DW_AT_type
2642+
; CHECK-NEXT: .b32 2396 // DW_AT_type
26332643
; CHECK-NEXT: .b8 1 // DW_AT_declaration
2634-
; CHECK-NEXT: .b8 7 // Abbrev [7] 0x949:0x5 DW_TAG_formal_parameter
2635-
; CHECK-NEXT: .b32 2383 // DW_AT_type
2644+
; CHECK-NEXT: .b8 7 // Abbrev [7] 0x956:0x5 DW_TAG_formal_parameter
2645+
; CHECK-NEXT: .b32 2396 // DW_AT_type
26362646
; CHECK-NEXT: .b8 0 // End Of Children Mark
2637-
; CHECK-NEXT: .b8 10 // Abbrev [10] 0x94f:0x11 DW_TAG_base_type
2647+
; CHECK-NEXT: .b8 10 // Abbrev [10] 0x95c:0x11 DW_TAG_base_type
26382648
; CHECK-NEXT: .b8 108 // DW_AT_name
26392649
; CHECK-NEXT: .b8 111
26402650
; CHECK-NEXT: .b8 110
@@ -2651,7 +2661,7 @@ if.end: ; preds = %if.then, %entry
26512661
; CHECK-NEXT: .b8 0
26522662
; CHECK-NEXT: .b8 5 // DW_AT_encoding
26532663
; CHECK-NEXT: .b8 8 // DW_AT_byte_size
2654-
; CHECK-NEXT: .b8 10 // Abbrev [10] 0x960:0x7 DW_TAG_base_type
2664+
; CHECK-NEXT: .b8 10 // Abbrev [10] 0x96d:0x7 DW_TAG_base_type
26552665
; CHECK-NEXT: .b8 105 // DW_AT_name
26562666
; CHECK-NEXT: .b8 110
26572667
; CHECK-NEXT: .b8 116

0 commit comments

Comments
 (0)