[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
This revision was automatically updated to reflect the committed changes. Closed by commit rL289686: [DebugInfo] Restore test case for long double constants. (authored by dgross). Changed prior to commit: https://reviews.llvm.org/D27597?vs=81321=81423#toc Repository: rL LLVM https://reviews.llvm.org/D27597 Files: cfe/trunk/test/CodeGen/debug-info-static-const-fp.c Index: cfe/trunk/test/CodeGen/debug-info-static-const-fp.c === --- cfe/trunk/test/CodeGen/debug-info-static-const-fp.c +++ cfe/trunk/test/CodeGen/debug-info-static-const-fp.c @@ -1,15 +1,33 @@ -// 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) static const float fVal = -147/17.0f; // -8.6470588235294117647 (-8.64705849) static const double dVal = 19637/7.0; // 2805.2857142857142857 (2805.2857142857142) -static const long double ldVal = 3/1234567.0L; // 2.4300017739012949479e-06 () +static const long double ldVal = 3/1234567.0L; // 2.4300017739012949479e-06 () int main() { return hVal + fVal + dVal + ldVal; @@ -24,8 +42,5 @@ // 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: Index: cfe/trunk/test/CodeGen/debug-info-static-const-fp.c === --- cfe/trunk/test/CodeGen/debug-info-static-const-fp.c +++ cfe/trunk/test/CodeGen/debug-info-static-const-fp.c @@ -1,15 +1,33 @@ -// 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) static const float fVal = -147/17.0f;
[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
probinson accepted this revision. probinson added a comment. This revision is now accepted and ready to land. In https://reviews.llvm.org/D27597#621618, @dgross wrote: > So would a Python equivalent of the Perl be acceptable? I think this is an > academic question -- better to explicitly test multiple triples. There are a small number of tests that run Python scripts, but they are generally doing something really unusual (I admit I haven't gone to look, but that's my recollection). If you can get proper coverage without Python, and it doesn't require standing on your head, people generally prefer that. In this case, multiple RUNs with different triples will do the job, so that's preferable. LGTM. https://reviews.llvm.org/D27597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
dgross updated this revision to Diff 81321. dgross added a comment. Incorporate code review comments. - Use %clang_cc1 not %clang - Rather than trying to determine long double size for target, compile and check multiple times, and only check behavior of long double for known targets https://reviews.llvm.org/D27597 Files: test/CodeGen/debug-info-static-const-fp.c Index: test/CodeGen/debug-info-static-const-fp.c === --- test/CodeGen/debug-info-static-const-fp.c +++ test/CodeGen/debug-info-static-const-fp.c @@ -1,15 +1,33 @@ -// 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) static const float fVal = -147/17.0f; // -8.6470588235294117647 (-8.64705849) static const double dVal = 19637/7.0; // 2805.2857142857142857 (2805.2857142857142) -static const long double ldVal = 3/1234567.0L; // 2.4300017739012949479e-06 () +static const long double ldVal = 3/1234567.0L; // 2.4300017739012949479e-06 () int main() { return hVal + fVal + dVal + ldVal; @@ -24,8 +42,5 @@ // 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: Index: test/CodeGen/debug-info-static-const-fp.c === --- test/CodeGen/debug-info-static-const-fp.c +++ test/CodeGen/debug-info-static-const-fp.c @@ -1,15 +1,33 @@ -// 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) static const float fVal = -147/17.0f; // -8.6470588235294117647 (-8.64705849) static const
[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
dgross added a comment. In https://reviews.llvm.org/D27597#621596, @probinson wrote: > As dblaikie said in email, probably better to make this X86-specific; if > long-double varies by OS you can put in a specific triple. I think with this approach I'd want two test cases that are identical except for consideration of long double size: One that specifies a target where long double is "small" and one where it is "large". Actually, I guess I could make this a single test case, but have two compile and two filecheck lines, specifying different triples, as you suggest. Or even three: One for whatever the default target is (doesn't check long double), one for a triple where long double is small, and one for a triple where long double is large. > FTR we don't rely on Perl being available everywhere, anything that does this > kind of scripty stuff uses Python. So would a Python equivalent of the Perl be acceptable? I think this is an academic question -- better to explicitly test multiple triples. https://reviews.llvm.org/D27597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
probinson added a comment. As dblaikie said in email, probably better to make this X86-specific; if long-double varies by OS you can put in a specific triple. FTR we don't rely on Perl being available everywhere, anything that does this kind of scripty stuff uses Python. Comment at: test/CodeGen/debug-info-static-const-fp.c:1 -// RUN: %clang -emit-llvm -O0 -S -g %s -o - | FileCheck %s +// RUN: %clang -emit-llvm -O0 -S -g %s -o %t +// RUN: perl <%t >%t-check-prefix -n -e \ Sorry didn't notice this before, %clang is for driver tests only; use %clang_cc1 here. https://reviews.llvm.org/D27597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D27597: [DebugInfo] Restore test case for long double constants.
On Mon, Dec 12, 2016 at 1:11 PM David Grosswrote: > I looked at what's supported by "requires", and couldn't find anything > appropriate. > > The problem is that I want the test to be sensitive to the size of long > double -- either no greater than 64 bits, or greater than 64 bits. It does > not seem practical to list all platforms (so I suspect your "xfail" > suggestion would not be suitable). I'd like to find some way to make the > determination programmatically in the test suite. It's certainly possible > that the answer is that there's no good way to do it. > I doubt there's a good way to do that. I'd probably just write it for one target (I assume this is the case on x86? A pretty good/stable/ubiquitous target - and we have a lot of DWARF test coverage that's x86-only) and move on. > > > On Mon, Dec 12, 2016 at 11:31 AM, David Blaikie > wrote: > > While it's possible to do arbitrary script things - we prefer nto to to > ensure the tests are portable. (we have some custom implementations of > common unix utilities for portability of those). > > In this case, can you xfail this on platforms that don't have the feature > you want? rather than trying to detect it at test-execution time. (or say > "requires" to opt the test in only on platforms you know have the thing you > want) > > On Fri, Dec 9, 2016 at 4:00 AM David Gross via Phabricator via cfe-commits > wrote: > > dgross added a comment. > > I don't know exactly what the RUN syntax supported by lit is. What I've > done here looks complex, but it does work for Linux. What about other > platforms? > > Is there some better way of writing a test case where the checks to be > done by FileCheck depend on some property of the file being analyzed (here, > the size of long double, as embedded in the debug metadata)? I don't see > any support for conditions in FileCheck. > > Maybe I'm going about this completely the wrong way? > > > https://reviews.llvm.org/D27597 > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D27597: [DebugInfo] Restore test case for long double constants.
I looked at what's supported by "requires", and couldn't find anything appropriate. The problem is that I want the test to be sensitive to the size of long double -- either no greater than 64 bits, or greater than 64 bits. It does not seem practical to list all platforms (so I suspect your "xfail" suggestion would not be suitable). I'd like to find some way to make the determination programmatically in the test suite. It's certainly possible that the answer is that there's no good way to do it. On Mon, Dec 12, 2016 at 11:31 AM, David Blaikiewrote: > While it's possible to do arbitrary script things - we prefer nto to to > ensure the tests are portable. (we have some custom implementations of > common unix utilities for portability of those). > > In this case, can you xfail this on platforms that don't have the feature > you want? rather than trying to detect it at test-execution time. (or say > "requires" to opt the test in only on platforms you know have the thing you > want) > > On Fri, Dec 9, 2016 at 4:00 AM David Gross via Phabricator via cfe-commits > wrote: > >> dgross added a comment. >> >> I don't know exactly what the RUN syntax supported by lit is. What I've >> done here looks complex, but it does work for Linux. What about other >> platforms? >> >> Is there some better way of writing a test case where the checks to be >> done by FileCheck depend on some property of the file being analyzed (here, >> the size of long double, as embedded in the debug metadata)? I don't see >> any support for conditions in FileCheck. >> >> Maybe I'm going about this completely the wrong way? >> >> >> https://reviews.llvm.org/D27597 >> >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D27597: [DebugInfo] Restore test case for long double constants.
While it's possible to do arbitrary script things - we prefer nto to to ensure the tests are portable. (we have some custom implementations of common unix utilities for portability of those). In this case, can you xfail this on platforms that don't have the feature you want? rather than trying to detect it at test-execution time. (or say "requires" to opt the test in only on platforms you know have the thing you want) On Fri, Dec 9, 2016 at 4:00 AM David Gross via Phabricator via cfe-commits < cfe-commits@lists.llvm.org> wrote: > dgross added a comment. > > I don't know exactly what the RUN syntax supported by lit is. What I've > done here looks complex, but it does work for Linux. What about other > platforms? > > Is there some better way of writing a test case where the checks to be > done by FileCheck depend on some property of the file being analyzed (here, > the size of long double, as embedded in the debug metadata)? I don't see > any support for conditions in FileCheck. > > Maybe I'm going about this completely the wrong way? > > > https://reviews.llvm.org/D27597 > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
dgross added a comment. I don't know exactly what the RUN syntax supported by lit is. What I've done here looks complex, but it does work for Linux. What about other platforms? Is there some better way of writing a test case where the checks to be done by FileCheck depend on some property of the file being analyzed (here, the size of long double, as embedded in the debug metadata)? I don't see any support for conditions in FileCheck. Maybe I'm going about this completely the wrong way? https://reviews.llvm.org/D27597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27597: [DebugInfo] Restore test case for long double constants.
dgross created this revision. dgross added reviewers: cfe-commits, probinson. https://reviews.llvm.org/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. https://reviews.llvm.org/D27597 Files: test/CodeGen/debug-info-static-const-fp.c Index: test/CodeGen/debug-info-static-const-fp.c === --- test/CodeGen/debug-info-static-const-fp.c +++ test/CodeGen/debug-info-static-const-fp.c @@ -1,7 +1,23 @@ -// RUN: %clang -emit-llvm -O0 -S -g %s -o - | FileCheck %s +// RUN: %clang -emit-llvm -O0 -S -g %s -o %t +// RUN: perl <%t >%t-check-prefix -n -e \ +// RUN: 'if (/"long double".*size:\s+(\d+)/) { \ +// RUN: printf "--check-prefix CHECK-LD%%s", ($1 <= 64 ? "sm" : "lg"); \ +// RUN: last; \ +// RUN:}' +// RUN: FileCheck --check-prefix CHECK $(cat %t-check-prefix) %s <%t // 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 test 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) @@ -24,8 +40,5 @@ // 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: Index: test/CodeGen/debug-info-static-const-fp.c === --- test/CodeGen/debug-info-static-const-fp.c +++ test/CodeGen/debug-info-static-const-fp.c @@ -1,7 +1,23 @@ -// RUN: %clang -emit-llvm -O0 -S -g %s -o - | FileCheck %s +// RUN: %clang -emit-llvm -O0 -S -g %s -o %t +// RUN: perl <%t >%t-check-prefix -n -e \ +// RUN: 'if (/"long double".*size:\s+(\d+)/) { \ +// RUN: printf "--check-prefix CHECK-LD%%s", ($1 <= 64 ? "sm" : "lg"); \ +// RUN: last; \ +// RUN:}' +// RUN: FileCheck --check-prefix CHECK $(cat %t-check-prefix) %s <%t // 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 test 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) @@ -24,8 +40,5 @@ // 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: