mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 22:50:53 +03:00
Rename -ir2obj-cache-*
cmdline flags to -cache-*
, because the cache can be used for more things than just ir2obj caching.
Rename "ir2obj" namespace to "cache".
This commit is contained in:
parent
a90fdfe624
commit
e0c78fa198
14 changed files with 104 additions and 103 deletions
|
@ -200,7 +200,8 @@ static cl::opt<bool, true> unittest("unittest",
|
|||
cl::location(global.params.useUnitTests));
|
||||
|
||||
cl::opt<std::string>
|
||||
ir2objCacheDir("ir2obj-cache", cl::desc("Use <cache dir> to cache object files for whole IR modules (experimental)"),
|
||||
cacheDir("cache", cl::desc("Enable compilation cache, using <cache dir> to "
|
||||
"store cache files (experimental)"),
|
||||
cl::value_desc("cache dir"));
|
||||
|
||||
static StringsAdapter strImpPathStore("J", global.params.fileImppath);
|
||||
|
|
|
@ -59,7 +59,7 @@ extern cl::opt<std::string> hdrFile;
|
|||
extern cl::list<std::string> versions;
|
||||
extern cl::list<std::string> transitions;
|
||||
extern cl::opt<std::string> moduleDeps;
|
||||
extern cl::opt<std::string> ir2objCacheDir;
|
||||
extern cl::opt<std::string> cacheDir;
|
||||
|
||||
extern cl::opt<std::string> mArch;
|
||||
extern cl::opt<bool> m32bits;
|
||||
|
|
|
@ -52,31 +52,31 @@
|
|||
namespace {
|
||||
|
||||
// Options for the cache pruning algorithm
|
||||
llvm::cl::opt<bool> pruneEnabled("ir2obj-cache-prune",
|
||||
llvm::cl::opt<bool> pruneEnabled("cache-prune",
|
||||
llvm::cl::desc("Enable cache pruning."),
|
||||
llvm::cl::ZeroOrMore);
|
||||
llvm::cl::opt<unsigned long long> pruneSizeLimitInBytes(
|
||||
"ir2obj-cache-prune-maxbytes",
|
||||
"cache-prune-maxbytes",
|
||||
llvm::cl::desc("Sets the maximum cache size to <size> bytes. Implies "
|
||||
"-ir2obj-cache-prune."),
|
||||
"-cache-prune."),
|
||||
llvm::cl::value_desc("size"), llvm::cl::init(0));
|
||||
llvm::cl::opt<unsigned> pruneInterval(
|
||||
"ir2obj-cache-prune-interval",
|
||||
"cache-prune-interval",
|
||||
llvm::cl::desc("Sets the cache pruning interval to <dur> seconds "
|
||||
"(default: 20 min). Set to 0 to force pruning. Implies "
|
||||
"-ir2obj-cache-prune."),
|
||||
"-cache-prune."),
|
||||
llvm::cl::value_desc("dur"), llvm::cl::init(20 * 60));
|
||||
llvm::cl::opt<unsigned> pruneExpiration(
|
||||
"ir2obj-cache-prune-expiration",
|
||||
"cache-prune-expiration",
|
||||
llvm::cl::desc(
|
||||
"Sets the pruning expiration time of cache files to "
|
||||
"<dur> seconds (default: 1 week). Implies -ir2obj-cache-prune."),
|
||||
"<dur> seconds (default: 1 week). Implies -cache-prune."),
|
||||
llvm::cl::value_desc("dur"), llvm::cl::init(7 * 24 * 3600));
|
||||
llvm::cl::opt<unsigned> pruneSizeLimitPercentage(
|
||||
"ir2obj-cache-prune-maxpercentage",
|
||||
"cache-prune-maxpercentage",
|
||||
llvm::cl::desc(
|
||||
"Sets the cache size limit to <perc> percent of the available "
|
||||
"space (default: 75%). Implies -ir2obj-cache-prune."),
|
||||
"space (default: 75%). Implies -cache-prune."),
|
||||
llvm::cl::value_desc("perc"), llvm::cl::init(75));
|
||||
|
||||
bool isPruningEnabled() {
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
void storeCacheFileName(llvm::StringRef cacheObjectHash,
|
||||
llvm::SmallString<128> &filePath) {
|
||||
filePath = opts::ir2objCacheDir;
|
||||
filePath = opts::cacheDir;
|
||||
llvm::sys::path::append(filePath, llvm::Twine("ircache_") + cacheObjectHash +
|
||||
"." + global.obj_ext);
|
||||
}
|
||||
|
@ -186,8 +186,8 @@ void outputIR2ObjRelevantCmdlineArgs(llvm::raw_ostream &hash_os)
|
|||
// "-od..." can be ignored
|
||||
if (arg[1] == 'o' && arg[2] == 'd')
|
||||
continue;
|
||||
// All "-ir2..." options can be ignored
|
||||
if (arg[1] == 'i' && arg[2] == 'r' && arg[3] == '2')
|
||||
// All "-cache..." options can be ignored
|
||||
if (strncmp(arg+1, "cache", 5) == 0)
|
||||
continue;
|
||||
// Ignore "-lib"
|
||||
if (arg[1] == 'l' && arg[2] == 'i' && arg[3] == 'b' && !arg[4])
|
||||
|
@ -234,9 +234,9 @@ void outputIR2ObjRelevantEnvironmentOpts(llvm::raw_ostream &hash_os)
|
|||
// There are no relevant environment options at the moment.
|
||||
}
|
||||
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
namespace ir2obj {
|
||||
namespace cache {
|
||||
|
||||
void calculateModuleHash(llvm::Module *m, llvm::SmallString<32> &str) {
|
||||
raw_hash_ostream hash_os;
|
||||
|
@ -257,10 +257,10 @@ void calculateModuleHash(llvm::Module *m, llvm::SmallString<32> &str) {
|
|||
}
|
||||
|
||||
std::string cacheLookup(llvm::StringRef cacheObjectHash) {
|
||||
if (opts::ir2objCacheDir.empty())
|
||||
if (opts::cacheDir.empty())
|
||||
return "";
|
||||
|
||||
if (!llvm::sys::fs::exists(opts::ir2objCacheDir)) {
|
||||
if (!llvm::sys::fs::exists(opts::cacheDir)) {
|
||||
IF_LOG Logger::println("Cache directory does not exist, no object found.");
|
||||
return "";
|
||||
}
|
||||
|
@ -278,13 +278,13 @@ std::string cacheLookup(llvm::StringRef cacheObjectHash) {
|
|||
|
||||
void cacheObjectFile(llvm::StringRef objectFile,
|
||||
llvm::StringRef cacheObjectHash) {
|
||||
if (opts::ir2objCacheDir.empty())
|
||||
if (opts::cacheDir.empty())
|
||||
return;
|
||||
|
||||
if (!llvm::sys::fs::exists(opts::ir2objCacheDir) &&
|
||||
llvm::sys::fs::create_directories(opts::ir2objCacheDir)) {
|
||||
if (!llvm::sys::fs::exists(opts::cacheDir) &&
|
||||
llvm::sys::fs::create_directories(opts::cacheDir)) {
|
||||
error(Loc(), "Unable to create cache directory: %s",
|
||||
opts::ir2objCacheDir.c_str());
|
||||
opts::cacheDir.c_str());
|
||||
fatal();
|
||||
}
|
||||
|
||||
|
@ -342,10 +342,10 @@ void recoverObjectFile(llvm::StringRef cacheObjectHash,
|
|||
}
|
||||
|
||||
void pruneCache() {
|
||||
if (!opts::ir2objCacheDir.empty() && isPruningEnabled()) {
|
||||
::pruneCache(opts::ir2objCacheDir.data(), opts::ir2objCacheDir.size(),
|
||||
if (!opts::cacheDir.empty() && isPruningEnabled()) {
|
||||
::pruneCache(opts::cacheDir.data(), opts::cacheDir.size(),
|
||||
pruneInterval, pruneExpiration, pruneSizeLimitInBytes,
|
||||
pruneSizeLimitPercentage);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace cache
|
||||
|
|
|
@ -18,7 +18,7 @@ class StringRef;
|
|||
template <unsigned> class SmallString;
|
||||
}
|
||||
|
||||
namespace ir2obj {
|
||||
namespace cache {
|
||||
|
||||
void calculateModuleHash(llvm::Module *m, llvm::SmallString<32> &str);
|
||||
std::string cacheLookup(llvm::StringRef cacheObjectHash);
|
||||
|
|
|
@ -1131,7 +1131,7 @@ void codegenModules(Modules &modules) {
|
|||
}
|
||||
}
|
||||
|
||||
ir2obj::pruneCache();
|
||||
cache::pruneCache();
|
||||
|
||||
freeRuntime();
|
||||
llvm::llvm_shutdown();
|
||||
|
|
|
@ -375,21 +375,21 @@ void writeModule(llvm::Module *m, std::string filename) {
|
|||
global.params.targetTriple->getOS() == llvm::Triple::AIX);
|
||||
|
||||
// Use cached object code if possible
|
||||
bool useIR2ObjCache = !opts::ir2objCacheDir.empty();
|
||||
bool useIR2ObjCache = !opts::cacheDir.empty();
|
||||
llvm::SmallString<32> moduleHash;
|
||||
if (useIR2ObjCache && global.params.output_o && !assembleExternally) {
|
||||
llvm::SmallString<128> cacheDir(opts::ir2objCacheDir.c_str());
|
||||
llvm::SmallString<128> cacheDir(opts::cacheDir.c_str());
|
||||
llvm::sys::fs::make_absolute(cacheDir);
|
||||
opts::ir2objCacheDir = cacheDir.c_str();
|
||||
opts::cacheDir = cacheDir.c_str();
|
||||
|
||||
IF_LOG Logger::println("Use IR-to-Object cache in %s",
|
||||
opts::ir2objCacheDir.c_str());
|
||||
opts::cacheDir.c_str());
|
||||
LOG_SCOPE
|
||||
|
||||
ir2obj::calculateModuleHash(m, moduleHash);
|
||||
std::string cacheFile = ir2obj::cacheLookup(moduleHash);
|
||||
cache::calculateModuleHash(m, moduleHash);
|
||||
std::string cacheFile = cache::cacheLookup(moduleHash);
|
||||
if (!cacheFile.empty()) {
|
||||
ir2obj::recoverObjectFile(moduleHash, filename);
|
||||
cache::recoverObjectFile(moduleHash, filename);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ void writeModule(llvm::Module *m, std::string filename) {
|
|||
if (global.params.output_o && !assembleExternally) {
|
||||
writeObjectFile(m, filename);
|
||||
if (useIR2ObjCache) {
|
||||
ir2obj::cacheObjectFile(filename, moduleHash);
|
||||
cache::cacheObjectFile(filename, moduleHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// Test value name discarding in conjunction with the ir2obj cache: local variable name changes should still give a cache hit.
|
||||
// Test value name discarding in conjunction with the compile 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: %ldc %s -c -of=%t%obj -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
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/dvni2oc -d-version=FIRST -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/dvni2oc -vv | FileCheck --check-prefix=MUST_HIT %s
|
||||
|
||||
// MUST_HIT: Cache object found!
|
||||
// NO_HIT-NOT: Cache object found!
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// Test recognition of -ir2obj-cache-prune-* commandline flags
|
||||
// Test recognition of -cache-prune-* commandline flags
|
||||
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune-interval=10 -ir2obj-cache-prune-maxbytes=10000
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune -ir2obj-cache-prune-interval=0
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune -ir2obj-cache-prune-maxbytes=10000
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune -ir2obj-cache-prune-expiration=10000
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune-maxpercentage=50
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache1 -ir2obj-cache-prune -ir2obj-cache-prune-maxpercentage=150
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune-interval=10 -cache-prune-maxbytes=10000
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune -cache-prune-interval=0
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune -cache-prune-maxbytes=10000
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune -cache-prune-expiration=10000
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune-maxpercentage=50
|
||||
// RUN: %ldc %s -cache=%T/prunecache1 -cache-prune -cache-prune-maxpercentage=150
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
// Test ir2obj-cache pruning for size
|
||||
// Test cache pruning for size
|
||||
|
||||
// This test assumes that the `void main(){}` object file size is below 200_000 bytes and above 200_000/2,
|
||||
// such that rebuilding with version(NEW_OBJ_FILE) will clear the cache of all but the latest object file.
|
||||
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/prunecache2 \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune -ir2obj-cache-prune-interval=0 -d-version=SLEEP \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune -ir2obj-cache-prune-interval=0 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune -ir2obj-cache-prune-interval=0 -vv -d-version=NEW_OBJ_FILE | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune -ir2obj-cache-prune-interval=0 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: %ldc %s -cache=%T/prunecache2 \
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -cache-prune -cache-prune-interval=0 -d-version=SLEEP \
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -cache-prune -cache-prune-interval=0 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -cache-prune -cache-prune-interval=0 -vv -d-version=NEW_OBJ_FILE | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -cache-prune -cache-prune-interval=0 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc -d-version=SLEEP -run %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune-interval=0 -ir2obj-cache-prune-maxbytes=200000 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/prunecache2 -cache-prune-interval=0 -cache-prune-maxbytes=200000 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %t%obj \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -d-version=SLEEP -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -d-version=SLEEP -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc -d-version=SLEEP -run %s \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune-interval=1 -ir2obj-cache-prune-maxbytes=200000 -d-version=NEW_OBJ_FILE \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/prunecache2 -ir2obj-cache-prune -ir2obj-cache-prune-interval=0 -vv | FileCheck --check-prefix=NO_HIT %s
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -cache-prune-interval=1 -cache-prune-maxbytes=200000 -d-version=NEW_OBJ_FILE \
|
||||
// RUN: && %ldc %s -cache=%T/prunecache2 -cache-prune -cache-prune-interval=0 -vv | FileCheck --check-prefix=NO_HIT %s
|
||||
|
||||
// MUST_HIT: Cache object found!
|
||||
// NO_HIT-NOT: Cache object found!
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Test recognition of -ir2obj-cache commandline flag
|
||||
// Test recognition of -cache commandline flag
|
||||
|
||||
// RUN: %ldc -ir2obj-cache=%T/cachedirectory %s -vv | FileCheck --check-prefix=FIRST %s \
|
||||
// RUN: && %ldc -ir2obj-cache=%T/cachedirectory %s -vv | FileCheck --check-prefix=SECOND %s
|
||||
// RUN: %ldc -cache=%T/cachedirectory %s -vv | FileCheck --check-prefix=FIRST %s \
|
||||
// RUN: && %ldc -cache=%T/cachedirectory %s -vv | FileCheck --check-prefix=SECOND %s
|
||||
|
||||
|
||||
// FIRST: Use IR-to-Object cache in {{.*}}cachedirectory
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
// Test that certain cmdline flags result in different ir2obj cache objects, even though the LLVM IR may be the same.
|
||||
// Test that certain cmdline flags result in different cache objects, even though the LLVM IR may be the same.
|
||||
|
||||
// Note that the NO_HIT tests should change the default setting of the tested flag.
|
||||
|
||||
// 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/flag1cache \
|
||||
// RUN: %ldc %s -c -of=%t%obj -cache=%T/flag1cache \
|
||||
// RUN: && %prunecache -f %T/flag1cache --max-bytes=1 \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -g -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -O -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -O3 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -O2 -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -O4 -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc -O5 %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -Os -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -Oz -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-d-passes -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-simplify-drtcalls -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-simplify-libcalls -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-gc2stack -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -enable-inlining -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -unit-at-a-time=false -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -strip-debug -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-loop-unrolling -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-loop-vectorization -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -disable-slp-vectorization -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -vectorize-loops -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -v -wi -d -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -D -H -I. -J. -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -d-version=Irrelevant -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -unittest -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/flag1cache -lib -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc -ir2obj-cache=%T/flag1cache -vv -run %s | FileCheck --check-prefix=COULD_HIT %s \
|
||||
// RUN: && %ldc -ir2obj-cache=%T/flag1cache -vv -run %s a b | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/flag1cache -g -vv | FileCheck --check-prefix=MUST_HIT %s
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -g -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -O -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -O3 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -O2 -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -O4 -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc -O5 %s -c -of=%t%obj -cache=%T/flag1cache -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -Os -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -Oz -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-d-passes -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-simplify-drtcalls -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-simplify-libcalls -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-gc2stack -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -enable-inlining -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -unit-at-a-time=false -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -strip-debug -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-loop-unrolling -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-loop-vectorization -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -disable-slp-vectorization -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -vectorize-loops -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -v -wi -d -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -D -H -I. -J. -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -d-version=Irrelevant -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -unittest -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/flag1cache -lib -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc -cache=%T/flag1cache -vv -run %s | FileCheck --check-prefix=COULD_HIT %s \
|
||||
// RUN: && %ldc -cache=%T/flag1cache -vv -run %s a b | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/flag1cache -g -vv | FileCheck --check-prefix=MUST_HIT %s
|
||||
// The last test is a MUST_HIT test (hits with the first compile invocation), to make sure that the cache wasn't pruned somehow which could effectively disable some NO_HIT tests.
|
||||
|
||||
// MUST_HIT: Cache object found!
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
// This test assumes that the `void main(){}` object file size is below 200_000 bytes and above 200_000/2,
|
||||
// such that rebuilding with version(NEW_OBJ_FILE) will clear the cache of all but the latest object file.
|
||||
|
||||
// RUN: %ldc %s -ir2obj-cache=%T/tempcache1 \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -d-version=SLEEP \
|
||||
// RUN: %ldc %s -cache=%T/tempcache1 \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -d-version=SLEEP \
|
||||
// RUN: && %prunecache -f %T/tempcache1 \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -vv -d-version=NEW_OBJ_FILE | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -vv -d-version=NEW_OBJ_FILE | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %prunecache %T/tempcache1 -f \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc -d-version=SLEEP -run %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -ir2obj-cache=%T/tempcache1 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %ldc %s -c -of=%t%obj -cache=%T/tempcache1 -vv | FileCheck --check-prefix=MUST_HIT %s \
|
||||
// RUN: && %prunecache --force --max-bytes=200000 %T/tempcache1 \
|
||||
// RUN: && %ldc %t%obj \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -d-version=SLEEP -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -d-version=SLEEP -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc -d-version=SLEEP -run %s \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -d-version=NEW_OBJ_FILE \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -d-version=NEW_OBJ_FILE \
|
||||
// RUN: && %prunecache --interval=0 %T/tempcache1 --max-bytes=200000 \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -vv | FileCheck --check-prefix=NO_HIT %s \
|
||||
// RUN: && %ldc -d-version=SLEEP -run %s \
|
||||
// RUN: && %ldc -d-version=SLEEP -run %s \
|
||||
// RUN: && %prunecache %T/tempcache1 -f --expiry=2 \
|
||||
// RUN: && %ldc %s -ir2obj-cache=%T/tempcache1 -vv | FileCheck --check-prefix=NO_HIT %s
|
||||
// RUN: && %ldc %s -cache=%T/tempcache1 -vv | FileCheck --check-prefix=NO_HIT %s
|
||||
|
||||
// MUST_HIT: Cache object found!
|
||||
// NO_HIT-NOT: Cache object found!
|
||||
|
|
|
@ -3,6 +3,6 @@ LDC – Tools
|
|||
|
||||
The `/tools` directory contains user tools that accompany LDC and that should be part of LDC packages.
|
||||
|
||||
`ldc-prune-cache` helps keeping the size of LDC's object file cache (`-ir2obj-cache`) in check. See [the original PR](https://github.com/ldc-developers/ldc/pull/1753) for more details.
|
||||
`ldc-prune-cache` helps keeping the size of LDC's object file cache (`-cache`) in check. See [the original PR](https://github.com/ldc-developers/ldc/pull/1753) for more details.
|
||||
|
||||
`ldc-profdata` converts raw profiling data to a profile data format that can be used by LDC. The source is copied from LLVM (`llvm-profdata`), and is versioned for each LLVM version that we support because the version has to match exactly with LDC's LLVM version.
|
||||
|
|
|
@ -65,7 +65,7 @@ OVERVIEW: LDC-PRUNE-CACHE
|
|||
|
||||
USAGE: ldc-prune-cache [OPTION]... PATH
|
||||
PATH should be a directory where LDC has placed its object files cache (see
|
||||
LDC's --ir2obj-cache option).
|
||||
LDC's -cache option).
|
||||
|
||||
OPTIONS:
|
||||
--expiration=<dur> Sets the pruning expiration time of cache files to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue