[llvm] 71cf592 - [IR] Fix -Wunused-but-set-variable
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 31 20:23:43 PDT 2025
Author: Fangrui Song
Date: 2025-03-31T20:23:34-07:00
New Revision: 71cf59219162be67392b435dfcb9b280e1ff8681
URL: https://github.com/llvm/llvm-project/commit/71cf59219162be67392b435dfcb9b280e1ff8681
DIFF: https://github.com/llvm/llvm-project/commit/71cf59219162be67392b435dfcb9b280e1ff8681.diff
LOG: [IR] Fix -Wunused-but-set-variable
Added:
Modified:
llvm/lib/IR/Attributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 8cb8b0d927afd..33ac8bfaf4e7c 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -2292,10 +2292,10 @@ AttrBuilder &AttrBuilder::addInitializesAttr(const ConstantRangeList &CRL) {
}
AttrBuilder &AttrBuilder::addFromEquivalentMetadata(const Instruction &I) {
- if (const MDNode *NonNull = I.getMetadata(LLVMContext::MD_nonnull))
+ if (I.hasMetadata(LLVMContext::MD_nonnull))
addAttribute(Attribute::NonNull);
- if (const MDNode *NoUndef = I.getMetadata(LLVMContext::MD_noundef))
+ if (I.hasMetadata(LLVMContext::MD_noundef))
addAttribute(Attribute::NoUndef);
if (const MDNode *Align = I.getMetadata(LLVMContext::MD_align)) {
More information about the llvm-commits
mailing list