Skip to content

Commit cfe02c9

Browse files
committed
adjust if blocks
1 parent db9e307 commit cfe02c9

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,21 +1322,23 @@ void DwarfDebug::finalizeModuleInfo() {
13221322
// ranges for all subprogram DIEs for mach-o.
13231323
DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;
13241324

1325-
if (Asm->TM.getTargetTriple().isNVPTX() && tuneForGDB()) {
1325+
if (unsigned NumRanges = TheCU.getRanges().size()) {
13261326
// PTX does not support subtracting labels from the code section in the
13271327
// debug_loc section. To work around this, the NVPTX backend needs the
13281328
// compile unit to have no low_pc in order to have a zero base_address
13291329
// when handling debug_loc in cuda-gdb.
1330-
} else if (unsigned NumRanges = TheCU.getRanges().size()) {
1331-
if (NumRanges > 1 && useRangesSection())
1332-
// A DW_AT_low_pc attribute may also be specified in combination with
1333-
// DW_AT_ranges to specify the default base address for use in
1334-
// location lists (see Section 2.6.2) and range lists (see Section
1335-
// 2.17.3).
1336-
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 0);
1337-
else
1338-
U.setBaseAddress(TheCU.getRanges().front().Begin);
1339-
U.attachRangesOrLowHighPC(U.getUnitDie(), TheCU.takeRanges());
1330+
if (!(Asm->TM.getTargetTriple().isNVPTX() && tuneForGDB())) {
1331+
if (NumRanges > 1 && useRangesSection())
1332+
// A DW_AT_low_pc attribute may also be specified in combination with
1333+
// DW_AT_ranges to specify the default base address for use in
1334+
// location lists (see Section 2.6.2) and range lists (see Section
1335+
// 2.17.3).
1336+
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
1337+
0);
1338+
else
1339+
U.setBaseAddress(TheCU.getRanges().front().Begin);
1340+
U.attachRangesOrLowHighPC(U.getUnitDie(), TheCU.takeRanges());
1341+
}
13401342
}
13411343

13421344
// We don't keep track of which addresses are used in which CU so this

0 commit comments

Comments
 (0)