Skip to content

[llvm] annotate interfaces in llvm/Transforms for DLL export #143413

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

Merged
merged 3 commits into from
Jun 10, 2025

Conversation

andrurogerz
Copy link
Contributor

@andrurogerz andrurogerz commented Jun 9, 2025

Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the llvm/Transforms library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

Background

This effort is tracked in #109483. Additional context is provided in this discourse, and documentation for LLVM_ABI and related annotations is found in the LLVM repo here.

The bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with git clang-format.

The following manual adjustments were also applied after running IDS on Linux:

  • Removed a redundant operator<< from Attributor.h. IDS only auto-annotates the 1st declaration, and the 2nd declaration being un-annotated resulted in an "inconsistent linkage" error on Windows when building LLVM as a DLL.
  • #include the VirtualFileSystem.h in PGOInstrumentation.h and remove the local declaration of the vfs::FileSystem class. This is required because exporting the PGOInstrumentationUse constructor requires the class be fully defined because it is used by an argument.
  • Add #include "llvm/Support/Compiler.h" to files where it was not auto-added by IDS due to no pre-existing block of include statements.
  • Add LLVM_TEMPLATE_ABI and LLVM_EXPORT_TEMPLATE to exported instantiated templates.

Validation

Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:

  • Windows with MSVC
  • Windows with Clang
  • Linux with GCC
  • Linux with Clang
  • Darwin with Clang

@andrurogerz andrurogerz force-pushed the llvmdll-lib-Transforms branch from 3492e66 to 16724fd Compare June 9, 2025 19:54
@andrurogerz andrurogerz marked this pull request as ready for review June 9, 2025 21:13
@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-vectorizers
@llvm/pr-subscribers-debuginfo
@llvm/pr-subscribers-coroutines

@llvm/pr-subscribers-pgo

Author: Andrew Rogers (andrurogerz)

Changes

Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the llvm/Transforms library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

Background

This effort is tracked in #109483. Additional context is provided in this discourse, and documentation for LLVM_ABI and related annotations is found in the LLVM repo here.

The bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with git clang-format.

The following manual adjustments were also applied after running IDS on Linux:

  • Removed a redundant operator&lt;&lt; from Attributor.h. IDS only auto-annotates the 1st declaration, and the 2nd declaration being un-annotated resulted in an "inconsistent linkage" error on Windows when building LLVM as a DLL.
  • #include the VirtualFileSystem.h in PGOInstrumentation.h and remove the local declaration of the vfs::FileSystem class. This is required because exporting the PGOInstrumentationUse constructor requires the class be fully defined because it is used by an argument.
  • Add #include "llvm/Support/Compiler.h" to files where it was not auto-added by IDS due to no pre-existing block of include statements.
  • Add LLVM_TEMPLATE_ABI and LLVM_EXPORT_TEMPLATE to exported instantiated templates.

Validation

Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:

  • Windows with MSVC
  • Windows with Clang
  • Linux with GCC
  • Linux with Clang
  • Darwin with Clang

Patch is 449.44 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/143413.diff

110 Files Affected:

  • (modified) llvm/include/llvm/Transforms/Coroutines/ABI.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroInstr.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroShape.h (+16-11)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroSplit.h (+9-5)
  • (modified) llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h (+6-3)
  • (modified) llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/IPO.h (+5-5)
  • (modified) llvm/include/llvm/Transforms/IPO/AlwaysInliner.h (+3-3)
  • (modified) llvm/include/llvm/Transforms/IPO/Attributor.h (+334-290)
  • (modified) llvm/include/llvm/Transforms/IPO/BlockExtractor.h (+3-1)
  • (modified) llvm/include/llvm/Transforms/IPO/EmbedBitcodePass.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/ExtractGV.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/IPO/FunctionAttrs.h (+11-7)
  • (modified) llvm/include/llvm/Transforms/IPO/FunctionImport.h (+25-22)
  • (modified) llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h (+6-5)
  • (modified) llvm/include/llvm/Transforms/IPO/GlobalDCE.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/IPO/Inliner.h (+12-8)
  • (modified) llvm/include/llvm/Transforms/IPO/Internalize.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/IPO/LowerTypeTests.h (+10-9)
  • (modified) llvm/include/llvm/Transforms/IPO/MergeFunctions.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/IPO/ModuleInliner.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/SampleContextTracker.h (+46-40)
  • (modified) llvm/include/llvm/Transforms/IPO/SampleProfile.h (+9-8)
  • (modified) llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h (+8-7)
  • (modified) llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/StripSymbols.h (+6-5)
  • (modified) llvm/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h (+20-18)
  • (modified) llvm/include/llvm/Transforms/InstCombine/InstCombine.h (+8-6)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h (+9-5)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/GCOVProfiler.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/KCFI.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h (+6-4)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfInstrumentation.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfUse.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h (+13-13)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/RealtimeSanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/TypeSanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/ObjCARC.h (+7-6)
  • (modified) llvm/include/llvm/Transforms/Scalar.h (+35-32)
  • (modified) llvm/include/llvm/Transforms/Scalar/EarlyCSE.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Scalar/GVN.h (+37-34)
  • (modified) llvm/include/llvm/Transforms/Scalar/JumpThreading.h (+54-46)
  • (modified) llvm/include/llvm/Transforms/Scalar/LoopPassManager.h (+22-18)
  • (modified) llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Scalar/SCCP.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Scalar/Scalarizer.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Utils.h (+19-17)
  • (modified) llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Utils/ASanStackFrameLayout.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h (+15-14)
  • (modified) llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h (+118-117)
  • (modified) llvm/include/llvm/Transforms/Utils/BuildLibCalls.h (+138-113)
  • (modified) llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h (+6-5)
  • (modified) llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h (+16-14)
  • (modified) llvm/include/llvm/Transforms/Utils/Cloning.h (+91-90)
  • (modified) llvm/include/llvm/Transforms/Utils/CodeExtractor.h (+23-18)
  • (modified) llvm/include/llvm/Transforms/Utils/CodeLayout.h (+11-9)
  • (modified) llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h (+35-28)
  • (modified) llvm/include/llvm/Transforms/Utils/Debugify.h (+27-22)
  • (modified) llvm/include/llvm/Transforms/Utils/FunctionComparator.h (+19-16)
  • (modified) llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Utils/Instrumentation.h (+16-14)
  • (modified) llvm/include/llvm/Transforms/Utils/IntegerDivision.h (+34-32)
  • (modified) llvm/include/llvm/Transforms/Utils/LCSSA.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Utils/Local.h (+149-122)
  • (modified) llvm/include/llvm/Transforms/Utils/LoopRotationUtils.h (+8-5)
  • (modified) llvm/include/llvm/Transforms/Utils/LoopSimplify.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Utils/LoopUtils.h (+143-117)
  • (modified) llvm/include/llvm/Transforms/Utils/LowerMemIntrinsics.h (+13-10)
  • (modified) llvm/include/llvm/Transforms/Utils/ModuleUtils.h (+35-28)
  • (modified) llvm/include/llvm/Transforms/Utils/PredicateInfo.h (+9-8)
  • (modified) llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h (+3-3)
  • (modified) llvm/include/llvm/Transforms/Utils/SCCPSolver.h (+53-46)
  • (modified) llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Utils/SanitizerStats.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+45-37)
  • (modified) llvm/include/llvm/Transforms/Utils/SizeOpts.h (+18-15)
  • (modified) llvm/include/llvm/Transforms/Utils/SplitModule.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Utils/SymbolRewriter.h (+6-4)
  • (modified) llvm/include/llvm/Transforms/Utils/UnrollLoop.h (+42-42)
  • (modified) llvm/include/llvm/Transforms/Utils/ValueMapper.h (+38-34)
  • (modified) llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h (+3-3)
  • (modified) llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h (+13-11)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h (+22-19)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h (+4)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Scheduler.h (+8-6)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h (+12-5)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h (+2-1)
  • (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+1)
  • (modified) llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp (+2-1)
  • (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+3-1)
  • (modified) llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp (+2-1)
  • (modified) llvm/lib/Transforms/Utils/Local.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/LoopUtils.cpp (+4-2)
  • (modified) llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp (+3-2)
  • (modified) llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp (+4-2)
diff --git a/llvm/include/llvm/Transforms/Coroutines/ABI.h b/llvm/include/llvm/Transforms/Coroutines/ABI.h
index 0b2d405f3caec..30d0e214d6195 100644
--- a/llvm/include/llvm/Transforms/Coroutines/ABI.h
+++ b/llvm/include/llvm/Transforms/Coroutines/ABI.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_COROUTINES_ABI_H
 
 #include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroShape.h"
 #include "llvm/Transforms/Coroutines/MaterializationUtils.h"
 #include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
@@ -37,7 +38,7 @@ namespace coro {
 // index of an ABI generator for the custom ABI object in a SmallVector passed
 // to CoroSplitPass ctor.
 
-class BaseABI {
+class LLVM_ABI BaseABI {
 public:
   BaseABI(Function &F, coro::Shape &S,
           std::function<bool(Instruction &)> IsMaterializable)
@@ -63,7 +64,7 @@ class BaseABI {
   std::function<bool(Instruction &I)> IsMaterializable;
 };
 
-class SwitchABI : public BaseABI {
+class LLVM_ABI SwitchABI : public BaseABI {
 public:
   SwitchABI(Function &F, coro::Shape &S,
             std::function<bool(Instruction &)> IsMaterializable)
@@ -76,7 +77,7 @@ class SwitchABI : public BaseABI {
                       TargetTransformInfo &TTI) override;
 };
 
-class AsyncABI : public BaseABI {
+class LLVM_ABI AsyncABI : public BaseABI {
 public:
   AsyncABI(Function &F, coro::Shape &S,
            std::function<bool(Instruction &)> IsMaterializable)
@@ -89,7 +90,7 @@ class AsyncABI : public BaseABI {
                       TargetTransformInfo &TTI) override;
 };
 
-class AnyRetconABI : public BaseABI {
+class LLVM_ABI AnyRetconABI : public BaseABI {
 public:
   AnyRetconABI(Function &F, coro::Shape &S,
                std::function<bool(Instruction &)> IsMaterializable)
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
index b8c846596c994..0688068167ae6 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
@@ -27,6 +27,7 @@
 
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/IntrinsicInst.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
@@ -237,7 +238,7 @@ class AnyCoroIdRetconInst : public AnyCoroIdInst {
   enum { SizeArg, AlignArg, StorageArg, PrototypeArg, AllocArg, DeallocArg };
 
 public:
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   uint64_t getStorageSize() const {
     return cast<ConstantInt>(getArgOperand(SizeArg))->getZExtValue();
@@ -306,7 +307,7 @@ class CoroIdAsyncInst : public AnyCoroIdInst {
   enum { SizeArg, AlignArg, StorageArg, AsyncFuncPtrArg };
 
 public:
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   /// The initial async function context size. The fields of which are reserved
   /// for use by the frontend. The frame will be allocated as a tail of this
@@ -568,7 +569,7 @@ class CoroSuspendAsyncInst : public AnyCoroSuspendInst {
     MustTailCallFuncArg
   };
 
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   unsigned getStorageArgumentIndex() const {
     auto *Arg = cast<ConstantInt>(getArgOperand(StorageArgNoArg));
@@ -722,7 +723,7 @@ class CoroAsyncEndInst : public AnyCoroEndInst {
   enum { FrameArg, UnwindArg, MustTailCallFuncArg };
 
 public:
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   Function *getMustTailCallFunction() const {
     if (arg_size() < 3)
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
index 891774b446571..c54081de2d9da 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
@@ -14,6 +14,7 @@
 
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroInstr.h"
 
 namespace llvm {
@@ -78,18 +79,20 @@ struct Shape {
   }
 
   // Scan the function and collect the above intrinsics for later processing
-  void analyze(Function &F, SmallVectorImpl<CoroFrameInst *> &CoroFrames,
-               SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
-               CoroPromiseInst *&CoroPromise);
+  LLVM_ABI void analyze(Function &F,
+                        SmallVectorImpl<CoroFrameInst *> &CoroFrames,
+                        SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
+                        CoroPromiseInst *&CoroPromise);
   // If for some reason, we were not able to find coro.begin, bailout.
-  void invalidateCoroutine(Function &F,
-                           SmallVectorImpl<CoroFrameInst *> &CoroFrames);
+  LLVM_ABI void
+  invalidateCoroutine(Function &F,
+                      SmallVectorImpl<CoroFrameInst *> &CoroFrames);
   // Perform ABI related initial transformation
-  void initABI();
+  LLVM_ABI void initABI();
   // Remove orphaned and unnecessary intrinsics
-  void cleanCoroutine(SmallVectorImpl<CoroFrameInst *> &CoroFrames,
-                      SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
-                      CoroPromiseInst *CoroPromise);
+  LLVM_ABI void cleanCoroutine(SmallVectorImpl<CoroFrameInst *> &CoroFrames,
+                               SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
+                               CoroPromiseInst *CoroPromise);
 
   // Field indexes for special fields in the switch lowering.
   struct SwitchFieldIndex {
@@ -256,12 +259,14 @@ struct Shape {
   /// Allocate memory according to the rules of the active lowering.
   ///
   /// \param CG - if non-null, will be updated for the new call
-  Value *emitAlloc(IRBuilder<> &Builder, Value *Size, CallGraph *CG) const;
+  LLVM_ABI Value *emitAlloc(IRBuilder<> &Builder, Value *Size,
+                            CallGraph *CG) const;
 
   /// Deallocate memory according to the rules of the active lowering.
   ///
   /// \param CG - if non-null, will be updated for the new call
-  void emitDealloc(IRBuilder<> &Builder, Value *Ptr, CallGraph *CG) const;
+  LLVM_ABI void emitDealloc(IRBuilder<> &Builder, Value *Ptr,
+                            CallGraph *CG) const;
 
   Shape() = default;
   explicit Shape(Function &F) {
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
index 6c6a982e82805..f7cc6f29879f9 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
@@ -18,6 +18,7 @@
 #include "llvm/Analysis/CGSCCPassManager.h"
 #include "llvm/Analysis/LazyCallGraph.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/ABI.h"
 
 namespace llvm {
@@ -31,20 +32,23 @@ struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
   using BaseABITy =
       std::function<std::unique_ptr<coro::BaseABI>(Function &, coro::Shape &)>;
 
-  CoroSplitPass(bool OptimizeFrame = false);
+  LLVM_ABI CoroSplitPass(bool OptimizeFrame = false);
 
-  CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
-                bool OptimizeFrame = false);
+  LLVM_ABI CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
+                         bool OptimizeFrame = false);
 
+  LLVM_ABI
   CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
                 bool OptimizeFrame = false);
 
+  LLVM_ABI
   CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
                 SmallVector<BaseABITy> GenCustomABIs,
                 bool OptimizeFrame = false);
 
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
-                        LazyCallGraph &CG, CGSCCUpdateResult &UR);
+  LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C,
+                                 CGSCCAnalysisManager &AM, LazyCallGraph &CG,
+                                 CGSCCUpdateResult &UR);
 
   static bool isRequired() { return true; }
 
diff --git a/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
index d8fc0c86a6fb5..558984fed0300 100644
--- a/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
+++ b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
 
 #ifndef LLVM_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H
@@ -16,11 +17,12 @@ namespace llvm {
 namespace coro {
 
 // True if I is trivially rematerialzable, e.g. InsertElementInst
-bool isTriviallyMaterializable(Instruction &I);
+LLVM_ABI bool isTriviallyMaterializable(Instruction &I);
 
 // Performs rematerialization, invoked from buildCoroutineFrame.
-void doRematerializations(Function &F, SuspendCrossingInfo &Checker,
-                          std::function<bool(Instruction &)> IsMaterializable);
+LLVM_ABI void
+doRematerializations(Function &F, SuspendCrossingInfo &Checker,
+                     std::function<bool(Instruction &)> IsMaterializable);
 
 } // namespace coro
 
diff --git a/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
index 88cbf88acc4cd..1e04f09ddc275 100644
--- a/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
+++ b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
@@ -21,6 +21,7 @@
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroInstr.h"
 
 namespace llvm {
@@ -102,19 +103,21 @@ class SuspendCrossingInfo {
             ModuleSlotTracker &MST) const;
 #endif
 
+  LLVM_ABI
   SuspendCrossingInfo(Function &F,
                       const SmallVectorImpl<AnyCoroSuspendInst *> &CoroSuspends,
                       const SmallVectorImpl<AnyCoroEndInst *> &CoroEnds);
 
   /// Returns true if there is a path from \p From to \p To crossing a suspend
   /// point without crossing \p From a 2nd time.
-  bool hasPathCrossingSuspendPoint(BasicBlock *From, BasicBlock *To) const;
+  LLVM_ABI bool hasPathCrossingSuspendPoint(BasicBlock *From,
+                                            BasicBlock *To) const;
 
   /// Returns true if there is a path from \p From to \p To crossing a suspend
   /// point without crossing \p From a 2nd time. If \p From is the same as \p To
   /// this will also check if there is a looping path crossing a suspend point.
-  bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From,
-                                         BasicBlock *To) const;
+  LLVM_ABI bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From,
+                                                  BasicBlock *To) const;
 
   bool isDefinitionAcrossSuspend(BasicBlock *DefBB, User *U) const {
     auto *I = cast<Instruction>(U);
diff --git a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
index 5ff38bdf04812..20850ba4c02d2 100644
--- a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
+++ b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
@@ -19,6 +19,7 @@
 #define LLVM_TRANSFORMS_HIPSTDPAR_HIPSTDPAR_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class Module;
 class HipStdParAcceleratorCodeSelectionPass
   : public PassInfoMixin<HipStdParAcceleratorCodeSelectionPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 
   static bool isRequired() { return true; }
 };
@@ -35,7 +36,7 @@ class HipStdParAcceleratorCodeSelectionPass
 class HipStdParAllocationInterpositionPass
   : public PassInfoMixin<HipStdParAllocationInterpositionPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index ee0e35aa61832..56b30968ffd77 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -24,29 +24,29 @@ class raw_ostream;
 /// createDeadArgEliminationPass - This pass removes arguments from functions
 /// which are not used by the body of the function.
 ///
-ModulePass *createDeadArgEliminationPass();
+LLVM_ABI ModulePass *createDeadArgEliminationPass();
 
 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
 /// functions as well.  This is definitely not safe, and should only be used by
 /// bugpoint.
-ModulePass *createDeadArgHackingPass();
+LLVM_ABI ModulePass *createDeadArgHackingPass();
 
 //===----------------------------------------------------------------------===//
 //
 /// createLoopExtractorPass - This pass extracts all natural loops from the
 /// program into a function if it can.
 ///
-Pass *createLoopExtractorPass();
+LLVM_ABI Pass *createLoopExtractorPass();
 
 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
 /// program into a function if it can.  This is used by bugpoint.
 ///
-Pass *createSingleLoopExtractorPass();
+LLVM_ABI Pass *createSingleLoopExtractorPass();
 
 //===----------------------------------------------------------------------===//
 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
 /// manager.
-ModulePass *createBarrierNoopPass();
+LLVM_ABI ModulePass *createBarrierNoopPass();
 
 /// What to do with the summary when running passes that operate on it.
 enum class PassSummaryAction {
diff --git a/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h b/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
index 252cfd4dc5f37..679126b011d8e 100644
--- a/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
+++ b/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -36,14 +37,13 @@ class AlwaysInlinerPass : public PassInfoMixin<AlwaysInlinerPass> {
   AlwaysInlinerPass(bool InsertLifetime = true)
       : InsertLifetime(InsertLifetime) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
   static bool isRequired() { return true; }
 };
 
 /// Create a legacy pass manager instance of a pass to inline and remove
 /// functions marked as "always_inline".
-Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
-
+LLVM_ABI Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
 }
 
 #endif // LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index c628bbb007230..e6eb756df987d 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -129,6 +129,7 @@
 #include "llvm/Support/Alignment.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DOTGraphTraits.h"
 #include "llvm/Support/DebugCounter.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -172,7 +173,7 @@ enum class GPUAddressSpace : unsigned {
 };
 
 /// Return true iff \p M target a GPU (and we can use GPU AS reasoning).
-bool isGPU(const Module &M);
+LLVM_ABI bool isGPU(const Module &M);
 
 /// Flags to distinguish intra-procedural queries from *potentially*
 /// inter-procedural queries. Not that information can be valid for both and
@@ -195,30 +196,32 @@ struct ValueAndContext : public std::pair<Value *, const Instruction *> {
 
 /// Return true if \p I is a `nosync` instruction. Use generic reasoning and
 /// potentially the corresponding AANoSync.
-bool isNoSyncInst(Attributor &A, const Instruction &I,
-                  const AbstractAttribute &QueryingAA);
+LLVM_ABI bool isNoSyncInst(Attributor &A, const Instruction &I,
+                           const AbstractAttribute &QueryingAA);
 
 /// Return true if \p V is dynamically unique, that is, there are no two
 /// "instances" of \p V at runtime with different values.
 /// Note: If \p ForAnalysisOnly is set we only check that the Attributor will
 /// never use \p V to represent two "instances" not that \p V could not
 /// technically represent them.
-bool isDynamicallyUnique(Attributor &A, const AbstractAttribute &QueryingAA,
-                         const Value &V, bool ForAnalysisOnly = true);
+LLVM_ABI bool isDynamicallyUnique(Attributor &A,
+                                  const AbstractAttribute &QueryingAA,
+                                  const Value &V, bool ForAnalysisOnly = true);
 
 /// Return true if \p V is a valid value in \p Scope, that is a constant or an
 /// instruction/argument of \p Scope.
-bool isValidInScope(const Value &V, const Function *Scope);
+LLVM_ABI bool isValidInScope(const Value &V, const Function *Scope);
 
 /// Return true if the value of \p VAC is a valid at the position of \p VAC,
 /// that is a constant, an argument of the same function, or an instruction in
 /// that function that dominates the position.
-bool isValidAtPosition(const ValueAndContext &VAC, InformationCache &InfoCache);
+LLVM_ABI bool isValidAtPosition(const ValueAndContext &VAC,
+                                InformationCache &InfoCache);
 
 /// Try to convert \p V to type \p Ty without introducing new instructions. If
 /// this is not possible return `nullptr`. Note: this function basically knows
 /// how to cast various constants.
-Value *getWithType(Value &V, Type &Ty);
+LLVM_ABI Value *getWithType(Value &V, Type &Ty);
 
 /// Return the combination of \p A and \p B such that the result is a possible
 /// value of both. \p B is potentially casted to match the type \p Ty or the
@@ -228,7 +231,7 @@ Value *getWithType(Value &V, Type &Ty);
 ///        X + none  => X
 /// not_none + undef => not_none
 ///          V1 + V2 => nullptr
-std::optional<Value *>
+LLVM_ABI std::optional<Value *>
 combineOptionalValuesInAAValueLatice(const std::optional<Value *> &A,
                                      const std::optional<Value *> &B, Type *Ty);
 
@@ -328,11 +331,10 @@ inline bool operator==(const RangeTy &A, const RangeTy &B) {
 inline bool operator!=(const RangeTy &A, const RangeTy &B) { return !(A == B); }
 
 /// Return the initial value of \p Obj with type \p Ty if that is a constant.
-Constant *getInitialValueForObj(Attributor &A,
-                                const AbstractAttribute &QueryingAA, Value &Obj,
-                                Type &Ty, const TargetLibraryInfo *TLI,
-                                const DataLayout &DL,
-                                RangeTy *RangePtr = nullptr);
+LLVM_ABI Constant *
+getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
+                      Value &Obj, Type &Ty, const TargetLibraryInfo *TLI,
+                      const DataLayout &DL, RangeTy *RangePtr = nullptr);
 
 /// Collect all potential values \p LI could read into \p PotentialValues. That
 /// is, the only values read by \p LI are assumed to be known and all are in
@@ -345,7 +347,7 @@ Constant *getInitialValueForObj(Attributor &A,
 /// \returns True if the assumed potential copies are all in \p PotentialValues,
 ///          false if something went wrong and the copies could not be
 ///          determined.
-bool getPotentiallyLoadedValues(
+LLVM_ABI bool getPotentiallyLoadedValues(
     Attributor &A, LoadInst &LI, SmallSetVector<Value *, 4> &PotentialValues,
     SmallSetVector<Instruction *, 4> &PotentialValueOrigins,
     const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation,
@@ -360,20 +362,22 @@ bool getPotentiallyLoadedValues(
 /// \returns True if the assumed potential copies are all in \p PotentialCopies,
 ///          false if something went wrong and the copies could not be
 ///          determined.
-bool getPotentialCopiesOfStoredValue(
+LLVM_ABI bool getPotentialCopiesOfStoredValue(
     Attributor &A, StoreInst &SI, SmallSetVector<Value *, 4> &PotentialCopies,
     const AbstractAttribute &QueryingAA, bool &UsedAssumedInformati...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Andrew Rogers (andrurogerz)

Changes

Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the llvm/Transforms library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

Background

This effort is tracked in #109483. Additional context is provided in this discourse, and documentation for LLVM_ABI and related annotations is found in the LLVM repo here.

The bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with git clang-format.

The following manual adjustments were also applied after running IDS on Linux:

  • Removed a redundant operator&lt;&lt; from Attributor.h. IDS only auto-annotates the 1st declaration, and the 2nd declaration being un-annotated resulted in an "inconsistent linkage" error on Windows when building LLVM as a DLL.
  • #include the VirtualFileSystem.h in PGOInstrumentation.h and remove the local declaration of the vfs::FileSystem class. This is required because exporting the PGOInstrumentationUse constructor requires the class be fully defined because it is used by an argument.
  • Add #include "llvm/Support/Compiler.h" to files where it was not auto-added by IDS due to no pre-existing block of include statements.
  • Add LLVM_TEMPLATE_ABI and LLVM_EXPORT_TEMPLATE to exported instantiated templates.

Validation

Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:

  • Windows with MSVC
  • Windows with Clang
  • Linux with GCC
  • Linux with Clang
  • Darwin with Clang

Patch is 449.44 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/143413.diff

110 Files Affected:

  • (modified) llvm/include/llvm/Transforms/Coroutines/ABI.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroInstr.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroShape.h (+16-11)
  • (modified) llvm/include/llvm/Transforms/Coroutines/CoroSplit.h (+9-5)
  • (modified) llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h (+6-3)
  • (modified) llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/IPO.h (+5-5)
  • (modified) llvm/include/llvm/Transforms/IPO/AlwaysInliner.h (+3-3)
  • (modified) llvm/include/llvm/Transforms/IPO/Attributor.h (+334-290)
  • (modified) llvm/include/llvm/Transforms/IPO/BlockExtractor.h (+3-1)
  • (modified) llvm/include/llvm/Transforms/IPO/EmbedBitcodePass.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/ExtractGV.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/IPO/FunctionAttrs.h (+11-7)
  • (modified) llvm/include/llvm/Transforms/IPO/FunctionImport.h (+25-22)
  • (modified) llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h (+6-5)
  • (modified) llvm/include/llvm/Transforms/IPO/GlobalDCE.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/IPO/Inliner.h (+12-8)
  • (modified) llvm/include/llvm/Transforms/IPO/Internalize.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/IPO/LowerTypeTests.h (+10-9)
  • (modified) llvm/include/llvm/Transforms/IPO/MergeFunctions.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/IPO/ModuleInliner.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/SampleContextTracker.h (+46-40)
  • (modified) llvm/include/llvm/Transforms/IPO/SampleProfile.h (+9-8)
  • (modified) llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h (+8-7)
  • (modified) llvm/include/llvm/Transforms/IPO/StripDeadPrototypes.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/StripSymbols.h (+6-5)
  • (modified) llvm/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h (+20-18)
  • (modified) llvm/include/llvm/Transforms/InstCombine/InstCombine.h (+8-6)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h (+9-5)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/GCOVProfiler.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/KCFI.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h (+6-4)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfInstrumentation.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfUse.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h (+13-13)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/RealtimeSanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/TypeSanitizer.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/ObjCARC.h (+7-6)
  • (modified) llvm/include/llvm/Transforms/Scalar.h (+35-32)
  • (modified) llvm/include/llvm/Transforms/Scalar/EarlyCSE.h (+5-3)
  • (modified) llvm/include/llvm/Transforms/Scalar/GVN.h (+37-34)
  • (modified) llvm/include/llvm/Transforms/Scalar/JumpThreading.h (+54-46)
  • (modified) llvm/include/llvm/Transforms/Scalar/LoopPassManager.h (+22-18)
  • (modified) llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Scalar/SCCP.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Scalar/Scalarizer.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Utils.h (+19-17)
  • (modified) llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h (+3-2)
  • (modified) llvm/include/llvm/Transforms/Utils/ASanStackFrameLayout.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h (+15-14)
  • (modified) llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h (+118-117)
  • (modified) llvm/include/llvm/Transforms/Utils/BuildLibCalls.h (+138-113)
  • (modified) llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h (+6-5)
  • (modified) llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h (+16-14)
  • (modified) llvm/include/llvm/Transforms/Utils/Cloning.h (+91-90)
  • (modified) llvm/include/llvm/Transforms/Utils/CodeExtractor.h (+23-18)
  • (modified) llvm/include/llvm/Transforms/Utils/CodeLayout.h (+11-9)
  • (modified) llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h (+35-28)
  • (modified) llvm/include/llvm/Transforms/Utils/Debugify.h (+27-22)
  • (modified) llvm/include/llvm/Transforms/Utils/FunctionComparator.h (+19-16)
  • (modified) llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Utils/Instrumentation.h (+16-14)
  • (modified) llvm/include/llvm/Transforms/Utils/IntegerDivision.h (+34-32)
  • (modified) llvm/include/llvm/Transforms/Utils/LCSSA.h (+2-1)
  • (modified) llvm/include/llvm/Transforms/Utils/Local.h (+149-122)
  • (modified) llvm/include/llvm/Transforms/Utils/LoopRotationUtils.h (+8-5)
  • (modified) llvm/include/llvm/Transforms/Utils/LoopSimplify.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Utils/LoopUtils.h (+143-117)
  • (modified) llvm/include/llvm/Transforms/Utils/LowerMemIntrinsics.h (+13-10)
  • (modified) llvm/include/llvm/Transforms/Utils/ModuleUtils.h (+35-28)
  • (modified) llvm/include/llvm/Transforms/Utils/PredicateInfo.h (+9-8)
  • (modified) llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h (+3-3)
  • (modified) llvm/include/llvm/Transforms/Utils/SCCPSolver.h (+53-46)
  • (modified) llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h (+7-5)
  • (modified) llvm/include/llvm/Transforms/Utils/SanitizerStats.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+45-37)
  • (modified) llvm/include/llvm/Transforms/Utils/SizeOpts.h (+18-15)
  • (modified) llvm/include/llvm/Transforms/Utils/SplitModule.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Utils/SymbolRewriter.h (+6-4)
  • (modified) llvm/include/llvm/Transforms/Utils/UnrollLoop.h (+42-42)
  • (modified) llvm/include/llvm/Transforms/Utils/ValueMapper.h (+38-34)
  • (modified) llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h (+3-3)
  • (modified) llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h (+13-11)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h (+22-19)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h (+4)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h (+4-3)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h (+5-4)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Scheduler.h (+8-6)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h (+12-5)
  • (modified) llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h (+2-1)
  • (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+1)
  • (modified) llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp (+2-1)
  • (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+3-1)
  • (modified) llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp (+2-1)
  • (modified) llvm/lib/Transforms/Utils/Local.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/LoopUtils.cpp (+4-2)
  • (modified) llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp (+3-2)
  • (modified) llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp (+4-2)
diff --git a/llvm/include/llvm/Transforms/Coroutines/ABI.h b/llvm/include/llvm/Transforms/Coroutines/ABI.h
index 0b2d405f3caec..30d0e214d6195 100644
--- a/llvm/include/llvm/Transforms/Coroutines/ABI.h
+++ b/llvm/include/llvm/Transforms/Coroutines/ABI.h
@@ -16,6 +16,7 @@
 #define LLVM_TRANSFORMS_COROUTINES_ABI_H
 
 #include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroShape.h"
 #include "llvm/Transforms/Coroutines/MaterializationUtils.h"
 #include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
@@ -37,7 +38,7 @@ namespace coro {
 // index of an ABI generator for the custom ABI object in a SmallVector passed
 // to CoroSplitPass ctor.
 
-class BaseABI {
+class LLVM_ABI BaseABI {
 public:
   BaseABI(Function &F, coro::Shape &S,
           std::function<bool(Instruction &)> IsMaterializable)
@@ -63,7 +64,7 @@ class BaseABI {
   std::function<bool(Instruction &I)> IsMaterializable;
 };
 
-class SwitchABI : public BaseABI {
+class LLVM_ABI SwitchABI : public BaseABI {
 public:
   SwitchABI(Function &F, coro::Shape &S,
             std::function<bool(Instruction &)> IsMaterializable)
@@ -76,7 +77,7 @@ class SwitchABI : public BaseABI {
                       TargetTransformInfo &TTI) override;
 };
 
-class AsyncABI : public BaseABI {
+class LLVM_ABI AsyncABI : public BaseABI {
 public:
   AsyncABI(Function &F, coro::Shape &S,
            std::function<bool(Instruction &)> IsMaterializable)
@@ -89,7 +90,7 @@ class AsyncABI : public BaseABI {
                       TargetTransformInfo &TTI) override;
 };
 
-class AnyRetconABI : public BaseABI {
+class LLVM_ABI AnyRetconABI : public BaseABI {
 public:
   AnyRetconABI(Function &F, coro::Shape &S,
                std::function<bool(Instruction &)> IsMaterializable)
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
index b8c846596c994..0688068167ae6 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h
@@ -27,6 +27,7 @@
 
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/IntrinsicInst.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
@@ -237,7 +238,7 @@ class AnyCoroIdRetconInst : public AnyCoroIdInst {
   enum { SizeArg, AlignArg, StorageArg, PrototypeArg, AllocArg, DeallocArg };
 
 public:
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   uint64_t getStorageSize() const {
     return cast<ConstantInt>(getArgOperand(SizeArg))->getZExtValue();
@@ -306,7 +307,7 @@ class CoroIdAsyncInst : public AnyCoroIdInst {
   enum { SizeArg, AlignArg, StorageArg, AsyncFuncPtrArg };
 
 public:
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   /// The initial async function context size. The fields of which are reserved
   /// for use by the frontend. The frame will be allocated as a tail of this
@@ -568,7 +569,7 @@ class CoroSuspendAsyncInst : public AnyCoroSuspendInst {
     MustTailCallFuncArg
   };
 
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   unsigned getStorageArgumentIndex() const {
     auto *Arg = cast<ConstantInt>(getArgOperand(StorageArgNoArg));
@@ -722,7 +723,7 @@ class CoroAsyncEndInst : public AnyCoroEndInst {
   enum { FrameArg, UnwindArg, MustTailCallFuncArg };
 
 public:
-  void checkWellFormed() const;
+  LLVM_ABI void checkWellFormed() const;
 
   Function *getMustTailCallFunction() const {
     if (arg_size() < 3)
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
index 891774b446571..c54081de2d9da 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroShape.h
@@ -14,6 +14,7 @@
 
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroInstr.h"
 
 namespace llvm {
@@ -78,18 +79,20 @@ struct Shape {
   }
 
   // Scan the function and collect the above intrinsics for later processing
-  void analyze(Function &F, SmallVectorImpl<CoroFrameInst *> &CoroFrames,
-               SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
-               CoroPromiseInst *&CoroPromise);
+  LLVM_ABI void analyze(Function &F,
+                        SmallVectorImpl<CoroFrameInst *> &CoroFrames,
+                        SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
+                        CoroPromiseInst *&CoroPromise);
   // If for some reason, we were not able to find coro.begin, bailout.
-  void invalidateCoroutine(Function &F,
-                           SmallVectorImpl<CoroFrameInst *> &CoroFrames);
+  LLVM_ABI void
+  invalidateCoroutine(Function &F,
+                      SmallVectorImpl<CoroFrameInst *> &CoroFrames);
   // Perform ABI related initial transformation
-  void initABI();
+  LLVM_ABI void initABI();
   // Remove orphaned and unnecessary intrinsics
-  void cleanCoroutine(SmallVectorImpl<CoroFrameInst *> &CoroFrames,
-                      SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
-                      CoroPromiseInst *CoroPromise);
+  LLVM_ABI void cleanCoroutine(SmallVectorImpl<CoroFrameInst *> &CoroFrames,
+                               SmallVectorImpl<CoroSaveInst *> &UnusedCoroSaves,
+                               CoroPromiseInst *CoroPromise);
 
   // Field indexes for special fields in the switch lowering.
   struct SwitchFieldIndex {
@@ -256,12 +259,14 @@ struct Shape {
   /// Allocate memory according to the rules of the active lowering.
   ///
   /// \param CG - if non-null, will be updated for the new call
-  Value *emitAlloc(IRBuilder<> &Builder, Value *Size, CallGraph *CG) const;
+  LLVM_ABI Value *emitAlloc(IRBuilder<> &Builder, Value *Size,
+                            CallGraph *CG) const;
 
   /// Deallocate memory according to the rules of the active lowering.
   ///
   /// \param CG - if non-null, will be updated for the new call
-  void emitDealloc(IRBuilder<> &Builder, Value *Ptr, CallGraph *CG) const;
+  LLVM_ABI void emitDealloc(IRBuilder<> &Builder, Value *Ptr,
+                            CallGraph *CG) const;
 
   Shape() = default;
   explicit Shape(Function &F) {
diff --git a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
index 6c6a982e82805..f7cc6f29879f9 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
@@ -18,6 +18,7 @@
 #include "llvm/Analysis/CGSCCPassManager.h"
 #include "llvm/Analysis/LazyCallGraph.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/ABI.h"
 
 namespace llvm {
@@ -31,20 +32,23 @@ struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
   using BaseABITy =
       std::function<std::unique_ptr<coro::BaseABI>(Function &, coro::Shape &)>;
 
-  CoroSplitPass(bool OptimizeFrame = false);
+  LLVM_ABI CoroSplitPass(bool OptimizeFrame = false);
 
-  CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
-                bool OptimizeFrame = false);
+  LLVM_ABI CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
+                         bool OptimizeFrame = false);
 
+  LLVM_ABI
   CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
                 bool OptimizeFrame = false);
 
+  LLVM_ABI
   CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
                 SmallVector<BaseABITy> GenCustomABIs,
                 bool OptimizeFrame = false);
 
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
-                        LazyCallGraph &CG, CGSCCUpdateResult &UR);
+  LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C,
+                                 CGSCCAnalysisManager &AM, LazyCallGraph &CG,
+                                 CGSCCUpdateResult &UR);
 
   static bool isRequired() { return true; }
 
diff --git a/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
index d8fc0c86a6fb5..558984fed0300 100644
--- a/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
+++ b/llvm/include/llvm/Transforms/Coroutines/MaterializationUtils.h
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
 
 #ifndef LLVM_TRANSFORMS_COROUTINES_MATERIALIZATIONUTILS_H
@@ -16,11 +17,12 @@ namespace llvm {
 namespace coro {
 
 // True if I is trivially rematerialzable, e.g. InsertElementInst
-bool isTriviallyMaterializable(Instruction &I);
+LLVM_ABI bool isTriviallyMaterializable(Instruction &I);
 
 // Performs rematerialization, invoked from buildCoroutineFrame.
-void doRematerializations(Function &F, SuspendCrossingInfo &Checker,
-                          std::function<bool(Instruction &)> IsMaterializable);
+LLVM_ABI void
+doRematerializations(Function &F, SuspendCrossingInfo &Checker,
+                     std::function<bool(Instruction &)> IsMaterializable);
 
 } // namespace coro
 
diff --git a/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
index 88cbf88acc4cd..1e04f09ddc275 100644
--- a/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
+++ b/llvm/include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h
@@ -21,6 +21,7 @@
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Coroutines/CoroInstr.h"
 
 namespace llvm {
@@ -102,19 +103,21 @@ class SuspendCrossingInfo {
             ModuleSlotTracker &MST) const;
 #endif
 
+  LLVM_ABI
   SuspendCrossingInfo(Function &F,
                       const SmallVectorImpl<AnyCoroSuspendInst *> &CoroSuspends,
                       const SmallVectorImpl<AnyCoroEndInst *> &CoroEnds);
 
   /// Returns true if there is a path from \p From to \p To crossing a suspend
   /// point without crossing \p From a 2nd time.
-  bool hasPathCrossingSuspendPoint(BasicBlock *From, BasicBlock *To) const;
+  LLVM_ABI bool hasPathCrossingSuspendPoint(BasicBlock *From,
+                                            BasicBlock *To) const;
 
   /// Returns true if there is a path from \p From to \p To crossing a suspend
   /// point without crossing \p From a 2nd time. If \p From is the same as \p To
   /// this will also check if there is a looping path crossing a suspend point.
-  bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From,
-                                         BasicBlock *To) const;
+  LLVM_ABI bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From,
+                                                  BasicBlock *To) const;
 
   bool isDefinitionAcrossSuspend(BasicBlock *DefBB, User *U) const {
     auto *I = cast<Instruction>(U);
diff --git a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
index 5ff38bdf04812..20850ba4c02d2 100644
--- a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
+++ b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
@@ -19,6 +19,7 @@
 #define LLVM_TRANSFORMS_HIPSTDPAR_HIPSTDPAR_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ class Module;
 class HipStdParAcceleratorCodeSelectionPass
   : public PassInfoMixin<HipStdParAcceleratorCodeSelectionPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 
   static bool isRequired() { return true; }
 };
@@ -35,7 +36,7 @@ class HipStdParAcceleratorCodeSelectionPass
 class HipStdParAllocationInterpositionPass
   : public PassInfoMixin<HipStdParAllocationInterpositionPass> {
 public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 
   static bool isRequired() { return true; }
 };
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index ee0e35aa61832..56b30968ffd77 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -24,29 +24,29 @@ class raw_ostream;
 /// createDeadArgEliminationPass - This pass removes arguments from functions
 /// which are not used by the body of the function.
 ///
-ModulePass *createDeadArgEliminationPass();
+LLVM_ABI ModulePass *createDeadArgEliminationPass();
 
 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
 /// functions as well.  This is definitely not safe, and should only be used by
 /// bugpoint.
-ModulePass *createDeadArgHackingPass();
+LLVM_ABI ModulePass *createDeadArgHackingPass();
 
 //===----------------------------------------------------------------------===//
 //
 /// createLoopExtractorPass - This pass extracts all natural loops from the
 /// program into a function if it can.
 ///
-Pass *createLoopExtractorPass();
+LLVM_ABI Pass *createLoopExtractorPass();
 
 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
 /// program into a function if it can.  This is used by bugpoint.
 ///
-Pass *createSingleLoopExtractorPass();
+LLVM_ABI Pass *createSingleLoopExtractorPass();
 
 //===----------------------------------------------------------------------===//
 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
 /// manager.
-ModulePass *createBarrierNoopPass();
+LLVM_ABI ModulePass *createBarrierNoopPass();
 
 /// What to do with the summary when running passes that operate on it.
 enum class PassSummaryAction {
diff --git a/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h b/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
index 252cfd4dc5f37..679126b011d8e 100644
--- a/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
+++ b/llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
@@ -15,6 +15,7 @@
 #define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
 
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -36,14 +37,13 @@ class AlwaysInlinerPass : public PassInfoMixin<AlwaysInlinerPass> {
   AlwaysInlinerPass(bool InsertLifetime = true)
       : InsertLifetime(InsertLifetime) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
+  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
   static bool isRequired() { return true; }
 };
 
 /// Create a legacy pass manager instance of a pass to inline and remove
 /// functions marked as "always_inline".
-Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
-
+LLVM_ABI Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
 }
 
 #endif // LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index c628bbb007230..e6eb756df987d 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -129,6 +129,7 @@
 #include "llvm/Support/Alignment.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DOTGraphTraits.h"
 #include "llvm/Support/DebugCounter.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -172,7 +173,7 @@ enum class GPUAddressSpace : unsigned {
 };
 
 /// Return true iff \p M target a GPU (and we can use GPU AS reasoning).
-bool isGPU(const Module &M);
+LLVM_ABI bool isGPU(const Module &M);
 
 /// Flags to distinguish intra-procedural queries from *potentially*
 /// inter-procedural queries. Not that information can be valid for both and
@@ -195,30 +196,32 @@ struct ValueAndContext : public std::pair<Value *, const Instruction *> {
 
 /// Return true if \p I is a `nosync` instruction. Use generic reasoning and
 /// potentially the corresponding AANoSync.
-bool isNoSyncInst(Attributor &A, const Instruction &I,
-                  const AbstractAttribute &QueryingAA);
+LLVM_ABI bool isNoSyncInst(Attributor &A, const Instruction &I,
+                           const AbstractAttribute &QueryingAA);
 
 /// Return true if \p V is dynamically unique, that is, there are no two
 /// "instances" of \p V at runtime with different values.
 /// Note: If \p ForAnalysisOnly is set we only check that the Attributor will
 /// never use \p V to represent two "instances" not that \p V could not
 /// technically represent them.
-bool isDynamicallyUnique(Attributor &A, const AbstractAttribute &QueryingAA,
-                         const Value &V, bool ForAnalysisOnly = true);
+LLVM_ABI bool isDynamicallyUnique(Attributor &A,
+                                  const AbstractAttribute &QueryingAA,
+                                  const Value &V, bool ForAnalysisOnly = true);
 
 /// Return true if \p V is a valid value in \p Scope, that is a constant or an
 /// instruction/argument of \p Scope.
-bool isValidInScope(const Value &V, const Function *Scope);
+LLVM_ABI bool isValidInScope(const Value &V, const Function *Scope);
 
 /// Return true if the value of \p VAC is a valid at the position of \p VAC,
 /// that is a constant, an argument of the same function, or an instruction in
 /// that function that dominates the position.
-bool isValidAtPosition(const ValueAndContext &VAC, InformationCache &InfoCache);
+LLVM_ABI bool isValidAtPosition(const ValueAndContext &VAC,
+                                InformationCache &InfoCache);
 
 /// Try to convert \p V to type \p Ty without introducing new instructions. If
 /// this is not possible return `nullptr`. Note: this function basically knows
 /// how to cast various constants.
-Value *getWithType(Value &V, Type &Ty);
+LLVM_ABI Value *getWithType(Value &V, Type &Ty);
 
 /// Return the combination of \p A and \p B such that the result is a possible
 /// value of both. \p B is potentially casted to match the type \p Ty or the
@@ -228,7 +231,7 @@ Value *getWithType(Value &V, Type &Ty);
 ///        X + none  => X
 /// not_none + undef => not_none
 ///          V1 + V2 => nullptr
-std::optional<Value *>
+LLVM_ABI std::optional<Value *>
 combineOptionalValuesInAAValueLatice(const std::optional<Value *> &A,
                                      const std::optional<Value *> &B, Type *Ty);
 
@@ -328,11 +331,10 @@ inline bool operator==(const RangeTy &A, const RangeTy &B) {
 inline bool operator!=(const RangeTy &A, const RangeTy &B) { return !(A == B); }
 
 /// Return the initial value of \p Obj with type \p Ty if that is a constant.
-Constant *getInitialValueForObj(Attributor &A,
-                                const AbstractAttribute &QueryingAA, Value &Obj,
-                                Type &Ty, const TargetLibraryInfo *TLI,
-                                const DataLayout &DL,
-                                RangeTy *RangePtr = nullptr);
+LLVM_ABI Constant *
+getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
+                      Value &Obj, Type &Ty, const TargetLibraryInfo *TLI,
+                      const DataLayout &DL, RangeTy *RangePtr = nullptr);
 
 /// Collect all potential values \p LI could read into \p PotentialValues. That
 /// is, the only values read by \p LI are assumed to be known and all are in
@@ -345,7 +347,7 @@ Constant *getInitialValueForObj(Attributor &A,
 /// \returns True if the assumed potential copies are all in \p PotentialValues,
 ///          false if something went wrong and the copies could not be
 ///          determined.
-bool getPotentiallyLoadedValues(
+LLVM_ABI bool getPotentiallyLoadedValues(
     Attributor &A, LoadInst &LI, SmallSetVector<Value *, 4> &PotentialValues,
     SmallSetVector<Instruction *, 4> &PotentialValueOrigins,
     const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation,
@@ -360,20 +362,22 @@ bool getPotentiallyLoadedValues(
 /// \returns True if the assumed potential copies are all in \p PotentialCopies,
 ///          false if something went wrong and the copies could not be
 ///          determined.
-bool getPotentialCopiesOfStoredValue(
+LLVM_ABI bool getPotentialCopiesOfStoredValue(
     Attributor &A, StoreInst &SI, SmallSetVector<Value *, 4> &PotentialCopies,
     const AbstractAttribute &QueryingAA, bool &UsedAssumedInformati...
[truncated]

@andrurogerz
Copy link
Contributor Author

@compnerd @vgvassilev please have a look when you have a chance, thanks

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I am wondering if we should add the % left to complete the work on the llvm side. Where are we right now?

@andrurogerz
Copy link
Contributor Author

I am wondering if we should add the % left to complete the work on the llvm side. Where are we right now?

We're getting close with the bulk of the code-mod. I will run some numbers today and put the details in #109483. Of course, it is a little bit of a moving target since new APIs appear every week that require annotation, but that's to be expected.

@compnerd compnerd merged commit b2584e0 into llvm:main Jun 10, 2025
16 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 10, 2025

LLVM Buildbot has detected a new failure on builder mlir-nvidia-gcc7 running on mlir-nvidia while building llvm at step 6 "build-check-mlir-build-only".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/13962

Here is the relevant piece of the build log for the reference
Step 6 (build-check-mlir-build-only) failure: build (failure)
...
15.384 [3846/16/966] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/LatencyPriorityQueue.cpp.o
In file included from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/CodeGen/LatencyPriorityQueue.h:18:0,
                 from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/LatencyPriorityQueue.cpp:15:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/CodeGen/ScheduleDAG.h:316:40: warning: ‘llvm::SUnit::SchedulingPref’ is too small to hold all values of ‘enum llvm::Sched::Preference’
     Sched::Preference SchedulingPref : 4; ///< Scheduling preference.
                                        ^
15.406 [3845/16/967] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/LazyMachineBlockFrequencyInfo.cpp.o
15.428 [3844/16/968] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/LexicalScopes.cpp.o
15.456 [3843/16/969] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/LiveDebugVariables.cpp.o
16.438 [3842/16/970] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandReductions.cpp.o
FAILED: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandReductions.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++-7 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandReductions.cpp.o -MF lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandReductions.cpp.o.d -o lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandReductions.cpp.o -c /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/ExpandReductions.cpp
In file included from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/ExpandReductions.cpp:23:0:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:539:72: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::ArrayRef<llvm::Loop*>&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
     ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:543:79: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::Loop&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
                                     SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                               ^
17.170 [3842/15/971] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandVectorPredication.cpp.o
FAILED: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandVectorPredication.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++-7 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandVectorPredication.cpp.o -MF lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandVectorPredication.cpp.o.d -o lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandVectorPredication.cpp.o -c /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/ExpandVectorPredication.cpp
In file included from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/ExpandVectorPredication.cpp:28:0:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:539:72: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::ArrayRef<llvm::Loop*>&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
     ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:543:79: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::Loop&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
                                     SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                               ^
18.092 [3842/14/972] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandLargeDivRem.cpp.o
19.400 [3842/13/973] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/DwarfEHPrepare.cpp.o
19.723 [3842/12/974] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/ExpandMemCmp.cpp.o
20.189 [3842/11/975] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/HardwareLoops.cpp.o
FAILED: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/HardwareLoops.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++-7 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/HardwareLoops.cpp.o -MF lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/HardwareLoops.cpp.o.d -o lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/HardwareLoops.cpp.o -c /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/HardwareLoops.cpp
In file included from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/HardwareLoops.cpp:42:0:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:539:72: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::ArrayRef<llvm::Loop*>&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
     ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:543:79: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::Loop&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
                                     SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                               ^
20.194 [3842/10/976] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/BranchFolding.cpp.o
20.287 [3842/9/977] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/JMCInstrumenter.cpp.o
20.655 [3842/8/978] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/BasicTargetTransformInfo.cpp.o
FAILED: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/BasicTargetTransformInfo.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++-7 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/BasicTargetTransformInfo.cpp.o -MF lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/BasicTargetTransformInfo.cpp.o.d -o lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/BasicTargetTransformInfo.cpp.o -c /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
In file included from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/CodeGen/BasicTTIImpl.h:52:0,
                 from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp:17:

@andrurogerz
Copy link
Contributor Author

This PR is causing the break: https://lab.llvm.org/buildbot/#/builders/116/builds/13962.
Fix is clear: remove the "llvm" qualification from the new template declarations added in this PR:

extern template LLVM_TEMPLATE_ABI void
llvm::appendLoopsToWorklist<ArrayRef<Loop *> &>(
    ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);

extern template LLVM_TEMPLATE_ABI void
llvm::appendLoopsToWorklist<Loop &>(Loop &L,
                                    SmallPriorityWorklist<Loop *, 4> &Worklist);

Preparing a PR to fix.

@andrurogerz
Copy link
Contributor Author

#143555 will fix this issue; waiting on CI now.

compnerd pushed a commit that referenced this pull request Jun 10, 2025
…template instantiations (#143555)

## Purpose
Fix a build break introduced by #143413. This was a copy+paste error
where the `llvm::` qualifier was left on the template instantiation
declarations that were added. This causes a compile error with the
version of the compiler used by the mlir-nvidia-gcc7 build.
```
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:539:72: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::ArrayRef<llvm::Loop*>&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
     ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:543:79: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::Loop&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
                                     SmallPriorityWorklist<Loop *, 4> &Worklist);
```
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…3413)

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public
interface for export. This patch annotates the `llvm/Transforms`
library. These annotations currently have no meaningful impact on the
LLVM build; however, they are a prerequisite to support an LLVM Windows
DLL (shared library) build.

## Background

This effort is tracked in llvm#109483. Additional context is provided in
[this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307),
and documentation for `LLVM_ABI` and related annotations is found in the
LLVM repo
[here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).

The bulk of these changes were generated automatically using the
[Interface Definition Scanner (IDS)](https://github.com/compnerd/ids)
tool, followed formatting with `git clang-format`.

The following manual adjustments were also applied after running IDS on
Linux:
- Removed a redundant `operator<<` from Attributor.h. IDS only
auto-annotates the 1st declaration, and the 2nd declaration being
un-annotated resulted in an "inconsistent linkage" error on Windows when
building LLVM as a DLL.
- `#include` the `VirtualFileSystem.h` in PGOInstrumentation.h and
remove the local declaration of the `vfs::FileSystem` class. This is
required because exporting the `PGOInstrumentationUse` constructor
requires the class be fully defined because it is used by an argument.
- Add #include "llvm/Support/Compiler.h" to files where it was not
auto-added by IDS due to no pre-existing block of include statements.
- Add `LLVM_TEMPLATE_ABI` and `LLVM_EXPORT_TEMPLATE` to exported
instantiated templates.

## Validation

Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…template instantiations (llvm#143555)

## Purpose
Fix a build break introduced by llvm#143413. This was a copy+paste error
where the `llvm::` qualifier was left on the template instantiation
declarations that were added. This causes a compile error with the
version of the compiler used by the mlir-nvidia-gcc7 build.
```
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:539:72: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::ArrayRef<llvm::Loop*>&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
     ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:543:79: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::Loop&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
                                     SmallPriorityWorklist<Loop *, 4> &Worklist);
```
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…3413)

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public
interface for export. This patch annotates the `llvm/Transforms`
library. These annotations currently have no meaningful impact on the
LLVM build; however, they are a prerequisite to support an LLVM Windows
DLL (shared library) build.

## Background

This effort is tracked in llvm#109483. Additional context is provided in
[this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307),
and documentation for `LLVM_ABI` and related annotations is found in the
LLVM repo
[here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).

The bulk of these changes were generated automatically using the
[Interface Definition Scanner (IDS)](https://github.com/compnerd/ids)
tool, followed formatting with `git clang-format`.

The following manual adjustments were also applied after running IDS on
Linux:
- Removed a redundant `operator<<` from Attributor.h. IDS only
auto-annotates the 1st declaration, and the 2nd declaration being
un-annotated resulted in an "inconsistent linkage" error on Windows when
building LLVM as a DLL.
- `#include` the `VirtualFileSystem.h` in PGOInstrumentation.h and
remove the local declaration of the `vfs::FileSystem` class. This is
required because exporting the `PGOInstrumentationUse` constructor
requires the class be fully defined because it is used by an argument.
- Add #include "llvm/Support/Compiler.h" to files where it was not
auto-added by IDS due to no pre-existing block of include statements.
- Add `LLVM_TEMPLATE_ABI` and `LLVM_EXPORT_TEMPLATE` to exported
instantiated templates.

## Validation

Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…template instantiations (llvm#143555)

## Purpose
Fix a build break introduced by llvm#143413. This was a copy+paste error
where the `llvm::` qualifier was left on the template instantiation
declarations that were added. This causes a compile error with the
version of the compiler used by the mlir-nvidia-gcc7 build.
```
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:539:72: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::ArrayRef<llvm::Loop*>&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
     ArrayRef<Loop *> &Loops, SmallPriorityWorklist<Loop *, 4> &Worklist);
                                                                        ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Transforms/Utils/LoopUtils.h:543:79: error: explicit qualification in declaration of ‘void llvm::appendLoopsToWorklist(llvm::Loop&, llvm::SmallPriorityWorklist<llvm::Loop*, 4>&)’
                                     SmallPriorityWorklist<Loop *, 4> &Worklist);
```
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.

5 participants