Small fixes for LLVM AOT backend on Windows. (#3786)

* Fix handling when IREE_LLVMAOT_LINKER_PATH is not set.

* Intentionally leak dylib libraries on exit when tracing.
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/AOT/LinkerTool.cpp b/iree/compiler/Dialect/HAL/Target/LLVM/AOT/LinkerTool.cpp
index 033fe0e..083d281 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/AOT/LinkerTool.cpp
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/AOT/LinkerTool.cpp
@@ -78,7 +78,12 @@
 }
 
 std::string LinkerTool::getToolPath() const {
-  return std::string(std::getenv("IREE_LLVMAOT_LINKER_PATH"));
+  char *linkerPath = std::getenv("IREE_LLVMAOT_LINKER_PATH");
+  if (linkerPath) {
+    return std::string(linkerPath);
+  } else {
+    return "";
+  }
 }
 
 LogicalResult LinkerTool::runLinkCommand(const std::string &commandLine) {
diff --git a/iree/hal/dylib/dylib_executable.cc b/iree/hal/dylib/dylib_executable.cc
index f3d79cf..3d3ff01 100644
--- a/iree/hal/dylib/dylib_executable.cc
+++ b/iree/hal/dylib/dylib_executable.cc
@@ -34,9 +34,13 @@
 
 DyLibExecutable::~DyLibExecutable() {
   IREE_TRACE_SCOPE0("DyLibExecutable::dtor");
-  // TODO(benvanik): move to an atexit handler when tracing is enabled.
-  // executable_library_.release();
+#if IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_INSTRUMENTATION
+  // Leak the library when tracing, since the profiler may still be reading it.
+  // TODO(benvanik): move to an atexit handler instead, verify with ASAN/MSAN
+  executable_library_.release();
+#else
   executable_library_.reset();
+#endif  // IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_INSTRUMENTATION
   for (const auto& file_path : temp_file_paths_) {
     file_io::DeleteFile(file_path).IgnoreError();
   }