Skip to content

Commit 7c18266

Browse files
committed
Revert "Re-apply:" Emit DW_OP_implicit_value for Floating point constants""
This patch reverts commit `59a76d957a26` as it has caused failure on the big endian PowerPC buildbots (as well as the SystemZ buildbots).
1 parent 343ffa7 commit 7c18266

File tree

7 files changed

+6
-256
lines changed

7 files changed

+6
-256
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,6 @@ void DwarfDebug::emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
24882488
DwarfExpr.addSignedConstant(Value.getInt());
24892489
else
24902490
DwarfExpr.addUnsignedConstant(Value.getInt());
2491-
DwarfExpr.addExpression(std::move(ExprCursor));
24922491
} else if (Value.isLocation()) {
24932492
MachineLocation Location = Value.getLoc();
24942493
DwarfExpr.setLocation(Location, DIExpr);
@@ -2509,24 +2508,10 @@ void DwarfDebug::emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
25092508
DwarfExpr.addExpression(std::move(ExprCursor));
25102509
return;
25112510
} else if (Value.isConstantFP()) {
2512-
if (AP.getDwarfVersion() >= 4 && AP.getDwarfDebug()->tuneForGDB()) {
2513-
DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF());
2514-
return;
2515-
} else if (Value.getConstantFP()
2516-
->getValueAPF()
2517-
.bitcastToAPInt()
2518-
.getBitWidth() <= 64 /*bits*/) {
2519-
DwarfExpr.addUnsignedConstant(
2520-
Value.getConstantFP()->getValueAPF().bitcastToAPInt());
2521-
DwarfExpr.addExpression(std::move(ExprCursor));
2522-
return;
2523-
}
2524-
LLVM_DEBUG(
2525-
dbgs()
2526-
<< "Skipped DwarfExpression creation for ConstantFP of size: "
2527-
<< Value.getConstantFP()->getValueAPF().bitcastToAPInt().getBitWidth()
2528-
<< " bits\n");
2511+
APInt RawBytes = Value.getConstantFP()->getValueAPF().bitcastToAPInt();
2512+
DwarfExpr.addUnsignedConstant(RawBytes);
25292513
}
2514+
DwarfExpr.addExpression(std::move(ExprCursor));
25302515
}
25312516

25322517
void DebugLocEntry::finalize(const AsmPrinter &AP,

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)