Skip to content

[IR] Fix warnings #143752

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 2 commits into from
Jun 11, 2025
Merged

[IR] Fix warnings #143752

merged 2 commits into from
Jun 11, 2025

Conversation

kazutakahirata
Copy link
Contributor

This patch fixes:

llvm/lib/IR/DIBuilder.cpp:1072:18: error: unused function
'getDeclareIntrin' [-Werror,-Wunused-function]

llvm/include/llvm/IR/DIBuilder.h:51:15: error: private field
'DeclareFn' is not used [-Werror,-Wunused-private-field]

llvm/include/llvm/IR/DIBuilder.h:52:15: error: private field
'ValueFn' is not used [-Werror,-Wunused-private-field]

llvm/include/llvm/IR/DIBuilder.h:53:15: error: private field
'LabelFn' is not used [-Werror,-Wunused-private-field]

llvm/include/llvm/IR/DIBuilder.h:54:15: error: private field
'AssignFn' is not used [-Werror,-Wunused-private-field]

This patch fixes:

  llvm/lib/IR/DIBuilder.cpp:1072:18: error: unused function
  'getDeclareIntrin' [-Werror,-Wunused-function]

  llvm/include/llvm/IR/DIBuilder.h:51:15: error: private field
  'DeclareFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:52:15: error: private field
  'ValueFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:53:15: error: private field
  'LabelFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:54:15: error: private field
  'AssignFn' is not used [-Werror,-Wunused-private-field]
@kazutakahirata kazutakahirata requested a review from jmorse June 11, 2025 17:15
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2025

@llvm/pr-subscribers-llvm-ir

Author: Kazu Hirata (kazutakahirata)

Changes

This patch fixes:

llvm/lib/IR/DIBuilder.cpp:1072:18: error: unused function
'getDeclareIntrin' [-Werror,-Wunused-function]

llvm/include/llvm/IR/DIBuilder.h:51:15: error: private field
'DeclareFn' is not used [-Werror,-Wunused-private-field]

llvm/include/llvm/IR/DIBuilder.h:52:15: error: private field
'ValueFn' is not used [-Werror,-Wunused-private-field]

llvm/include/llvm/IR/DIBuilder.h:53:15: error: private field
'LabelFn' is not used [-Werror,-Wunused-private-field]

llvm/include/llvm/IR/DIBuilder.h:54:15: error: private field
'AssignFn' is not used [-Werror,-Wunused-private-field]


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

2 Files Affected:

  • (modified) llvm/include/llvm/IR/DIBuilder.h (+1-5)
  • (modified) llvm/lib/IR/DIBuilder.cpp (+1-6)
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index ebfe41dd59afb..43fca571ee6d5 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -47,11 +47,7 @@ namespace llvm {
     Module &M;
     LLVMContext &VMContext;
 
-    DICompileUnit *CUNode;   ///< The one compile unit created by this DIBuiler.
-    Function *DeclareFn;     ///< llvm.dbg.declare
-    Function *ValueFn;       ///< llvm.dbg.value
-    Function *LabelFn;       ///< llvm.dbg.label
-    Function *AssignFn;      ///< llvm.dbg.assign
+    DICompileUnit *CUNode; ///< The one compile unit created by this DIBuiler.
 
     SmallVector<TrackingMDNodeRef, 4> AllEnumTypes;
     /// Track the RetainTypes, since they can be updated later on.
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 1484c549dd580..fd8c2d7bb5cc3 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -25,8 +25,7 @@ using namespace llvm;
 using namespace llvm::dwarf;
 
 DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU)
-    : M(m), VMContext(M.getContext()), CUNode(CU), DeclareFn(nullptr),
-      ValueFn(nullptr), LabelFn(nullptr), AssignFn(nullptr),
+    : M(m), VMContext(M.getContext()), CUNode(CU),
       AllowUnresolvedNodes(AllowUnresolvedNodes) {
   if (CUNode) {
     if (const auto &ETs = CUNode->getEnumTypes())
@@ -1069,10 +1068,6 @@ static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) {
   return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
 }
 
-static Function *getDeclareIntrin(Module &M) {
-  return Intrinsic::getOrInsertDeclaration(&M, Intrinsic::dbg_declare);
-}
-
 DbgInstPtr DIBuilder::insertDbgValueIntrinsic(llvm::Value *Val,
                                               DILocalVariable *VarInfo,
                                               DIExpression *Expr,

@kazutakahirata kazutakahirata requested a review from OCHyams June 11, 2025 17:15
@kazutakahirata
Copy link
Contributor Author

@jmorse I normally merge warning fixes myself, but your commit 459475020aeff15d0f886ab99c59d66b744d3e17 says "it'll be deleted in about an hour", so I'm wondering if you are planning to take care of this yourself. Thanks!

Copy link
Member

@jmorse jmorse left a comment

Choose a reason for hiding this comment

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

Thanks for the catch, my prediction of an hour was for the code in #143746 to remove other unrelated pieces of code, rather than these warnings. And we've now hit the end of the day in the UK, curses. Please do merge this in anyway! (my ancient local compiler doesn't flag these things up ._.).

Awkwardly I did spot one warning and pushed up 7414d88 directly, so now I've given you a merge conflict to deal with sorry.

@kazutakahirata kazutakahirata merged commit 66f533e into llvm:main Jun 11, 2025
4 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_warning_IR branch June 11, 2025 17:39
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
This patch fixes:

  llvm/lib/IR/DIBuilder.cpp:1072:18: error: unused function
  'getDeclareIntrin' [-Werror,-Wunused-function]

  llvm/include/llvm/IR/DIBuilder.h:51:15: error: private field
  'DeclareFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:52:15: error: private field
  'ValueFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:53:15: error: private field
  'LabelFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:54:15: error: private field
  'AssignFn' is not used [-Werror,-Wunused-private-field]
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
This patch fixes:

  llvm/lib/IR/DIBuilder.cpp:1072:18: error: unused function
  'getDeclareIntrin' [-Werror,-Wunused-function]

  llvm/include/llvm/IR/DIBuilder.h:51:15: error: private field
  'DeclareFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:52:15: error: private field
  'ValueFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:53:15: error: private field
  'LabelFn' is not used [-Werror,-Wunused-private-field]

  llvm/include/llvm/IR/DIBuilder.h:54:15: error: private field
  'AssignFn' is not used [-Werror,-Wunused-private-field]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants