Skip to content

Commit 9d2da67

Browse files
committed
Revert "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"
This reverts commit 6b55a95. Temporal revert due to a failing/assertion in test case in Sparc backend. `test/DebugInfo/Sparc/subreg.ll` Seen in lot of bots, for instance in: `http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/24679`
1 parent c0185dc commit 9d2da67

7 files changed

Lines changed: 5 additions & 252 deletions

File tree

‎llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,20 +2512,8 @@ void DwarfDebug::emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
25122512
// encoding is supported.
25132513
DwarfExpr.addWasmLocation(Loc.Index, static_cast<uint64_t>(Loc.Offset));
25142514
} else if (Value.isConstantFP()) {
2515-
if (AP.getDwarfVersion() >= 4 && AP.getDwarfDebug()->tuneForGDB())
2516-
DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF());
2517-
else if (Value.getConstantFP()
2518-
->getValueAPF()
2519-
.bitcastToAPInt()
2520-
.getBitWidth() <= 64 /*bits*/)
2521-
DwarfExpr.addUnsignedConstant(
2522-
Value.getConstantFP()->getValueAPF().bitcastToAPInt());
2523-
else
2524-
LLVM_DEBUG(
2525-
dbgs()
2526-
<< "Skipped DwarfExpression creation for ConstantFP of size"
2527-
<< Value.getConstantFP()->getValueAPF().bitcastToAPInt().getBitWidth()
2528-
<< " bits\n");
2515+
APInt RawBytes = Value.getConstantFP()->getValueAPF().bitcastToAPInt();
2516+
DwarfExpr.addUnsignedConstant(RawBytes);
25292517
}
25302518
DwarfExpr.addExpression(std::move(ExprCursor));
25312519
}

‎llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
using namespace llvm;
2727

28-
#define DEBUG_TYPE "dwarfdebug"
29-
3028
void DwarfExpression::emitConstu(uint64_t Value) {
3129
if (Value < 32)
3230
emitOp(dwarf::DW_OP_lit0 + Value);
@@ -221,36 +219,6 @@ void DwarfExpression::addUnsignedConstant(const APInt &Value) {
221219
}
222220
}
223221

224-
void DwarfExpression::addConstantFP(const APFloat &Value) {
225-
assert(isImplicitLocation() || isUnknownLocation());
226-
APInt RawBytes = Value.bitcastToAPInt();
227-
int NumBytes = RawBytes.getBitWidth() / 8;
228-
const char *Data = (const char *)RawBytes.getRawData();
229-
emitOp(dwarf::DW_OP_implicit_value);
230-
if (NumBytes == 4 /*float*/ || NumBytes == 8 /*double*/) {
231-
emitUnsigned(NumBytes /*Size of the block in bytes*/);
232-
for (int i = 0; i < NumBytes; ++i)
233-
emitData1(Data[i]);
234-
return;
235-
}
236-
if (NumBytes == 10 /*long double*/) {
237-
// long double IEEE representation uses 80 bits(10 bytes).
238-
// 6 bytes are padded to make it 128 bits(16 bytes) due to
239-
// addressing restrictions.
240-
emitUnsigned(16 /*Size of the block in bytes*/);
241-
// Emit the block of bytes.
242-
for (int i = 0; i < NumBytes; ++i)
243-
emitData1(Data[i]);
244-
// Emit the rest as padding bytes.
245-
for (int i = 0; i < 16 - NumBytes; ++i)
246-
emitData1(0);
247-
return;
248-
}
249-
LLVM_DEBUG(
250-
dbgs() << "Skipped DW_OP_implicit_value creation for ConstantFP of size"
251-
<< RawBytes.getBitWidth() << " bits\n");
252-
}
253-
254222
bool DwarfExpression::addMachineRegExpression(const TargetRegisterInfo &TRI,
255223
DIExpressionCursor &ExprCursor,
256224
unsigned MachineReg,

‎llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ class DwarfExpression {
299299
/// Emit an unsigned constant.
300300
void addUnsignedConstant(const APInt &Value);
301301

302-
/// Emit floating point constant.
303-
void addConstantFP(const APFloat &Value);
304-
305302
/// Lock this down to become a memory location description.
306303
void setMemoryLocationKind() {
307304
assert(isUnknownLocation());

‎llvm/test/DebugInfo/X86/float_const_loclist.ll‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
;
2121
; CHECK: .debug_info contents:
2222
; CHECK: DW_TAG_variable
23+
; CHECK-NEXT: DW_AT_location {{.*}} (
24+
; CHECK-NEXT: [0x[[START:.*]], 0x[[END:.*]]): DW_OP_constu 0xc8f5c28f5c28f800, DW_OP_piece 0x8, DW_OP_constu 0x4000, DW_OP_bit_piece 0x10 0x40)
2325
; CHECK-NEXT: DW_AT_name {{.*}}"ld"
2426
; CHECK: DW_TAG_variable
2527
; CHECK-NEXT: DW_AT_location {{.*}} (
26-
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4048f5c3)
28+
; CHECK-NEXT: [0x[[START]], 0x[[END]]): DW_OP_constu 0x4048f5c3)
2729
; CHECK-NEXT: DW_AT_name {{.*}}"f"
2830

2931
source_filename = "test.c"

‎llvm/test/DebugInfo/X86/implicit_value-double.ll‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

‎llvm/test/DebugInfo/X86/implicit_value-float.ll‎

Lines changed: 0 additions & 65 deletions
This file was deleted.

‎llvm/test/DebugInfo/X86/implicit_value-ld.ll‎

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)