[pkg-d-commits] [ldc] 15/211: Add extra ir2obj cache test: with local value name discarding, the IR and IR hash do not depend on the actual local variable name. So a name change should not result in a cache miss.

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 1fa635932e7d0d5245c7e0320712eb96c525c3ee
Author: Johan Engelen <jbc.engelen at gmail.com>
Date:   Fri Sep 16 17:48:11 2016 +0200

    Add extra ir2obj cache test: with local value name discarding, the IR and IR hash do not depend on the actual local variable name. So a name change should not result in a cache miss.
---
 tests/codegen/discard_value_names_ir2obj_cache.d | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/codegen/discard_value_names_ir2obj_cache.d b/tests/codegen/discard_value_names_ir2obj_cache.d
new file mode 100644
index 0000000..836e39a
--- /dev/null
+++ b/tests/codegen/discard_value_names_ir2obj_cache.d
@@ -0,0 +1,27 @@
+// Test value name discarding in conjunction with the ir2obj cache: local variable name changes should still give a cache hit.
+
+// REQUIRES: atleast_llvm309
+
+// Create and then empty the cache for correct testing when running the test multiple times.
+// RUN: %ldc %s -c -of=%t%obj -ir2obj-cache=%T/dvni2oc \
+// RUN:   && %prunecache -f %T/dvni2oc --max-bytes=1 \
+// RUN:   && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/dvni2oc -d-version=FIRST -vv | FileCheck --check-prefix=NO_HIT %s \
+// RUN:   && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/dvni2oc -vv | FileCheck --check-prefix=MUST_HIT %s
+
+// MUST_HIT: Cache object found!
+// NO_HIT-NOT: Cache object found!
+
+version (FIRST)
+{
+    int foo(int a)
+    {
+        return a + 2;
+    }
+}
+else
+{
+    int foo(int differentname)
+    {
+        return differentname + 2;
+    }
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list