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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 19:32:46 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Andrew Rogers (andrurogerz)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/144621.diff


1 Files Affected:

- (modified) llvm/include/llvm/Analysis/LoopInfo.h (+1-1) 


``````````diff
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>
 

``````````

</details>


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


More information about the llvm-commits mailing list