[llvm] [llvm] include GenericLoopInfoImpl for full implementation (PR #144621)

Andrew Rogers via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 17:13:19 PDT 2025


https://github.com/andrurogerz created https://github.com/llvm/llvm-project/pull/144621

MSVC issues a warning when a an `extern` template instantiation is annotated for DLL export but it does not have the complete template definition. Because the full implementation of `LoopBase` is in `GenericLoopInfoImpl.h` rather than `GenericLoopInfo.h`, MSVC complains whenever `LoopInfo.h` is included. 
```
S:\llvm\llvm-project\llvm\include\llvm/Support/GenericLoopInfo.h(342): warning C4661: 'BlockT *llvm::LoopBase<BlockT,llvm::Loop>::getLoopLatch(void) const': no suitable definition provided for explicit template instantiation request
        with
        [
            BlockT=llvm::BasicBlock
        ]
S:\llvm\llvm-project\llvm\include\llvm/Support/GenericLoopInfo.h(326): note: see declaration of 'llvm::LoopBase<llvm::BasicBlock,llvm::Loop>::getLoopLatch'
```
Everything links fine but the warning is very noisy when building LLVM as a Windows DLL. Interestingly, `clang-cl` does not warn here and is fine with the code as-is.

>From 811ee647928fe6c720f09a6687ee3318f3d54208 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Tue, 17 Jun 2025 16:39:27 -0700
Subject: [PATCH] [llvm] include GenericLoopInfoImpl for full implementation

---
 llvm/include/llvm/Analysis/LoopInfo.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h
index 072ddad546bf3..a7a6a2753709c 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/include/llvm/Analysis/LoopInfo.h
@@ -18,7 +18,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/GenericLoopInfo.h"
+#include "llvm/Support/GenericLoopInfoImpl.h"
 #include <optional>
 #include <utility>
 



More information about the llvm-commits mailing list