Skip to content

[llvm] include GenericLoopInfoImpl for full implementation #144621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrurogerz
Copy link
Contributor

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.

@andrurogerz andrurogerz marked this pull request as ready for review June 18, 2025 02:32
@llvmbot
Copy link
Member

llvmbot commented Jun 18, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Andrew Rogers (andrurogerz)

Changes

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&lt;BlockT,llvm::Loop&gt;::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&lt;llvm::BasicBlock,llvm::Loop&gt;::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 --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>
 

@andrurogerz
Copy link
Contributor Author

@compnerd, @vgvassilev another one that should be straight-forward, but I thought it was worth making into its own PR for discussion. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants