[llvm] e4375bf - [X86] Fix warning about unused variable [NFC]

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 02:32:53 PST 2024


Author: Mikael Holmen
Date: 2024-01-25T11:30:51+01:00
New Revision: e4375bf47fafb0cfcb2288ecfad94dfe63ca994c

URL: https://github.com/llvm/llvm-project/commit/e4375bf47fafb0cfcb2288ecfad94dfe63ca994c
DIFF: https://github.com/llvm/llvm-project/commit/e4375bf47fafb0cfcb2288ecfad94dfe63ca994c.diff

LOG: [X86] Fix warning about unused variable [NFC]

Without this gcc complains like
 ../lib/Target/X86/X86FixupVectorConstants.cpp:70:13: warning: unused variable 'CUndef' [-Wunused-variable]
    70 |   if (auto *CUndef = dyn_cast<UndefValue>(C))
       |             ^~~~~~

Remove the unused variable and change dyn_cast to isa.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86FixupVectorConstants.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp
index ca52cb384a7ee6a..d4af94c7f92ee7e 100644
--- a/llvm/lib/Target/X86/X86FixupVectorConstants.cpp
+++ b/llvm/lib/Target/X86/X86FixupVectorConstants.cpp
@@ -67,7 +67,7 @@ FunctionPass *llvm::createX86FixupVectorConstants() {
 static std::optional<APInt> extractConstantBits(const Constant *C) {
   unsigned NumBits = C->getType()->getPrimitiveSizeInBits();
 
-  if (auto *CUndef = dyn_cast<UndefValue>(C))
+  if (isa<UndefValue>(C))
     return APInt::getZero(NumBits);
 
   if (auto *CInt = dyn_cast<ConstantInt>(C))


        


More information about the llvm-commits mailing list