Skip to content

Commit

Permalink
Revert "[DebugInfo] Emit DW_OP_implicit_value for Floating point cons…
Browse files Browse the repository at this point in the history
…tants"

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`
  • Loading branch information
SouraVX committed Jul 23, 2020
1 parent c0185dc commit 9d2da67
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 252 deletions.
16 changes: 2 additions & 14 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Expand Up @@ -2512,20 +2512,8 @@ void DwarfDebug::emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
// encoding is supported.
DwarfExpr.addWasmLocation(Loc.Index, static_cast<uint64_t>(Loc.Offset));
} else if (Value.isConstantFP()) {
if (AP.getDwarfVersion() >= 4 && AP.getDwarfDebug()->tuneForGDB())
DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF());
else if (Value.getConstantFP()
->getValueAPF()
.bitcastToAPInt()
.getBitWidth() <= 64 /*bits*/)
DwarfExpr.addUnsignedConstant(
Value.getConstantFP()->getValueAPF().bitcastToAPInt());
else
LLVM_DEBUG(
dbgs()
<< "Skipped DwarfExpression creation for ConstantFP of size"
<< Value.getConstantFP()->getValueAPF().bitcastToAPInt().getBitWidth()
<< " bits\n");
APInt RawBytes = Value.getConstantFP()->getValueAPF().bitcastToAPInt();
DwarfExpr.addUnsignedConstant(RawBytes);
}
DwarfExpr.addExpression(std::move(ExprCursor));
}
Expand Down
32 changes: 0 additions & 32 deletions llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
Expand Up @@ -25,8 +25,6 @@

using namespace llvm;

#define DEBUG_TYPE "dwarfdebug"

void DwarfExpression::emitConstu(uint64_t Value) {
if (Value < 32)
emitOp(dwarf::DW_OP_lit0 + Value);
Expand Down Expand Up @@ -221,36 +219,6 @@ void DwarfExpression::addUnsignedConstant(const APInt &Value) {
}
}

void DwarfExpression::addConstantFP(const APFloat &Value) {
assert(isImplicitLocation() || isUnknownLocation());
APInt RawBytes = Value.bitcastToAPInt();
int NumBytes = RawBytes.getBitWidth() / 8;
const char *Data = (const char *)RawBytes.getRawData();
emitOp(dwarf::DW_OP_implicit_value);
if (NumBytes == 4 /*float*/ || NumBytes == 8 /*double*/) {
emitUnsigned(NumBytes /*Size of the block in bytes*/);
for (int i = 0; i < NumBytes; ++i)
emitData1(Data[i]);
return;
}
if (NumBytes == 10 /*long double*/) {
// long double IEEE representation uses 80 bits(10 bytes).
// 6 bytes are padded to make it 128 bits(16 bytes) due to
// addressing restrictions.
emitUnsigned(16 /*Size of the block in bytes*/);
// Emit the block of bytes.
for (int i = 0; i < NumBytes; ++i)
emitData1(Data[i]);
// Emit the rest as padding bytes.
for (int i = 0; i < 16 - NumBytes; ++i)
emitData1(0);
return;
}
LLVM_DEBUG(
dbgs() << "Skipped DW_OP_implicit_value creation for ConstantFP of size"
<< RawBytes.getBitWidth() << " bits\n");
}

bool DwarfExpression::addMachineRegExpression(const TargetRegisterInfo &TRI,
DIExpressionCursor &ExprCursor,
unsigned MachineReg,
Expand Down
3 changes: 0 additions & 3 deletions llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
Expand Up @@ -299,9 +299,6 @@ class DwarfExpression {
/// Emit an unsigned constant.
void addUnsignedConstant(const APInt &Value);

/// Emit floating point constant.
void addConstantFP(const APFloat &Value);

/// Lock this down to become a memory location description.
void setMemoryLocationKind() {
assert(isUnknownLocation());
Expand Down
4 changes: 3 additions & 1 deletion llvm/test/DebugInfo/X86/float_const_loclist.ll
Expand Up @@ -20,10 +20,12 @@
;
; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} (
; CHECK-NEXT: [0x[[START:.*]], 0x[[END:.*]]): DW_OP_constu 0xc8f5c28f5c28f800, DW_OP_piece 0x8, DW_OP_constu 0x4000, DW_OP_bit_piece 0x10 0x40)
; CHECK-NEXT: DW_AT_name {{.*}}"ld"
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} (
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4048f5c3)
; CHECK-NEXT: [0x[[START]], 0x[[END]]): DW_OP_constu 0x4048f5c3)
; CHECK-NEXT: DW_AT_name {{.*}}"f"

source_filename = "test.c"
Expand Down
66 changes: 0 additions & 66 deletions llvm/test/DebugInfo/X86/implicit_value-double.ll

This file was deleted.

65 changes: 0 additions & 65 deletions llvm/test/DebugInfo/X86/implicit_value-float.ll

This file was deleted.

71 changes: 0 additions & 71 deletions llvm/test/DebugInfo/X86/implicit_value-ld.ll

This file was deleted.

0 comments on commit 9d2da67

Please sign in to comment.