r289686 - [DebugInfo] Restore test case for long double constants.

David Gross via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 10:52:33 PST 2016


Author: dgross
Date: Wed Dec 14 12:52:33 2016
New Revision: 289686

URL: http://llvm.org/viewvc/llvm-project?rev=289686&view=rev
Log:
[DebugInfo] Restore test case for long double constants.

Summary:
D27549 (partial fix for PR26619) emits a constant value in the debug
metadata for a floating-point static const that does not exceed 64
bits in size.  Whether or not a long double exceeds 64 bits in size
depends on the target.  Modify the test case so that it expects a
constant value for long double if and only if the long double is no
larger than 64 bits.

Reviewers: cfe-commits, probinson

Differential Revision: https://reviews.llvm.org/D27597

Modified:
    cfe/trunk/test/CodeGen/debug-info-static-const-fp.c

Modified: cfe/trunk/test/CodeGen/debug-info-static-const-fp.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-static-const-fp.c?rev=289686&r1=289685&r2=289686&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-static-const-fp.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-static-const-fp.c Wed Dec 14 12:52:33 2016
@@ -1,7 +1,25 @@
-// RUN: %clang -emit-llvm -O0 -S -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O0 -debug-info-kind=limited %s -o - | \
+// RUN:   FileCheck --check-prefixes CHECK %s
+
+// RUN: %clang_cc1 -triple hexagon-unknown--elf -emit-llvm -O0 -debug-info-kind=limited %s -o - | \
+// RUN:   FileCheck --check-prefixes CHECK,CHECK-LDsm %s
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -debug-info-kind=limited %s -o - | \
+// RUN:   FileCheck --check-prefixes CHECK,CHECK-LDlg %s
 
 // Per PR26619, check that for referenced static const of floating-point type,
-// we emit its constant value in debug info.  NOTE that PR26619 is not yet fixed for long double.
+// we emit its constant value in debug info.
+//
+// NOTE that __fp16 is assumed to be 16 bits, float is assumed to be
+// 32 bits, and double is assumed to be 64 bits.  Size of long double
+// is not known (for example, it is 64 bits for hexagon-unknown--elf,
+// but 128 bits for x86_64-unknown-linux-gnu).  Therefore, we specify
+// target triples where it has a known size, and check accordingly:
+// for the absence of a constant (CHECK-LDlg) when the size exceeds 64
+// bits, and for the presence of a constant (CHECK-LDsm) but not its
+// value when the size does not exceed 64 bits.
+//
+// NOTE that PR26619 is not yet fixed for types greater than 64 bits.
 
 static const __fp16 hVal = 29/13.0f;            //    2.2307692307692307692     (2.23046875)
 
@@ -9,7 +27,7 @@ static const float fVal = -147/17.0f;
 
 static const double dVal = 19637/7.0;           // 2805.2857142857142857        (2805.2857142857142)
 
-static const long double ldVal = 3/1234567.0L;  //    2.4300017739012949479e-06 (<optimized out>)
+static const long double ldVal = 3/1234567.0L;  //    2.4300017739012949479e-06 (<depends on size of long double>)
 
 int main() {
   return hVal + fVal + dVal + ldVal;
@@ -24,8 +42,5 @@ int main() {
 // CHECK: !DIGlobalVariable(name: "dVal", {{.*}}, isLocal: true, isDefinition: true, expr: ![[DEXPR:[0-9]+]]
 // CHECK: ![[DEXPR]] = !DIExpression(DW_OP_constu, 4658387303597904457, DW_OP_stack_value)
 
-// Temporarily removing this check -- for some targets (such as
-// "--target=hexagon-unknown-elf"), long double does not exceed 64
-// bits, and so we actually do get the constant value (expr) emitted.
-//
-// DO-NOT-CHECK: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true)
+// CHECK-LDlg: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true)
+// CHECK-LDsm: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true, expr:




More information about the cfe-commits mailing list