diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/slang-performance-profiler.cpp | 2 | ||||
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 6 | ||||
| -rw-r--r-- | source/slang/slang-options.cpp | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/source/core/slang-performance-profiler.cpp b/source/core/slang-performance-profiler.cpp index f5f74f99d..5b62cbf73 100644 --- a/source/core/slang-performance-profiler.cpp +++ b/source/core/slang-performance-profiler.cpp @@ -46,7 +46,7 @@ namespace Slang PerformanceProfiler* Slang::PerformanceProfiler::getProfiler() { - static PerformanceProfilerImpl profiler = PerformanceProfilerImpl(); + thread_local static PerformanceProfilerImpl profiler = PerformanceProfilerImpl(); return &profiler; } } diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 429660cac..9de1833a0 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -10839,8 +10839,10 @@ RefPtr<IRModule> generateIRForTranslationUnit( // - If sccp is unable to eliminate the outer 'if' then we end up with // duplicated code the the conditional value. Users don't tend to put // huge gobs of code in the conditional expression in loops however. - - invertLoops(module); + if (compileRequest->getLinkage()->m_optionSet.getBoolOption(CompilerOptionName::LoopInversion)) + { + invertLoops(module); + } // Next, attempt to promote local variables to SSA // temporaries and do basic simplifications. diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index fc2fd42c2..1f27c5efa 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -542,6 +542,7 @@ void initCommandOptions(CommandOptions& options) { OptionKind::SaveStdLibBinSource, "-save-stdlib-bin-source","-save-stdlib-bin-source <filename>", "Same as -save-stdlib but output " "the data as a C array.\n"}, { OptionKind::TrackLiveness, "-track-liveness", nullptr, "Enable liveness tracking. Places SLANG_LIVE_START, and SLANG_LIVE_END in output source to indicate value liveness." }, + { OptionKind::LoopInversion, "-loop-inversion", nullptr, "Enable loop inversion in the code-gen optimization. Default is off" }, }; _addOptions(makeConstArrayView(internalOpts), options); @@ -1689,6 +1690,7 @@ SlangResult OptionsParser::_parse( case OptionKind::IncompleteLibrary: case OptionKind::NoHLSLBinding: case OptionKind::NoHLSLPackConstantBufferElements: + case OptionKind::LoopInversion: linkage->m_optionSet.set(optionKind, true); break; break; case OptionKind::MatrixLayoutRow: |
