[llvm] f2a585e - [NFC] Fix "not used" warning

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 22:09:36 PDT 2021


Author: Vitaly Buka
Date: 2021-04-26T22:09:23-07:00
New Revision: f2a585e6d392f4c8587c1dac4d776037d4b588c5

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

LOG: [NFC] Fix "not used" warning

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReaderStmt.cpp
    lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
    llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
    llvm/tools/llvm-dwp/llvm-dwp.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp
index 30fb627c2a61..ce6ef36c30da 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -1099,10 +1099,9 @@ void ASTStmtReader::VisitCastExpr(CastExpr *E) {
 
 void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
   bool hasFP_Features;
-  BinaryOperator::Opcode opc;
   VisitExpr(E);
   E->setHasStoredFPFeatures(hasFP_Features = Record.readInt());
-  E->setOpcode(opc = (BinaryOperator::Opcode)Record.readInt());
+  E->setOpcode((BinaryOperator::Opcode)Record.readInt());
   E->setLHS(Record.readSubExpr());
   E->setRHS(Record.readSubExpr());
   E->setOperatorLoc(readSourceLocation());

diff  --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 0a59e24c47a8..164a283b972b 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -836,9 +836,8 @@ dataExtractorFromSection(const NormalizedFile &normalizedFile,
 //        inspection" code if possible.
 static uint64_t getCUAbbrevOffset(llvm::DataExtractor abbrevData,
                                   uint64_t abbrCode) {
-  uint64_t curCode;
   uint64_t offset = 0;
-  while ((curCode = abbrevData.getULEB128(&offset)) != abbrCode) {
+  while (abbrevData.getULEB128(&offset) != abbrCode) {
     // Tag
     abbrevData.getULEB128(&offset);
     // DW_CHILDREN

diff  --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index d9b33face569..f20d739c4d41 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -502,7 +502,6 @@ LoopIdiomRecognize::isLegalStore(StoreInst *SI) {
   // are stored.  A store of i32 0x01020304 can never be turned into a memset,
   // but it can be turned into memset_pattern if the target supports it.
   Value *SplatValue = isBytewiseValue(StoredVal, *DL);
-  Constant *PatternValue = nullptr;
 
   // Note: memset and memset_pattern on unordered-atomic is yet not supported
   bool UnorderedAtomic = SI->isUnordered() && !SI->isSimple();
@@ -515,10 +514,11 @@ LoopIdiomRecognize::isLegalStore(StoreInst *SI) {
       CurLoop->isLoopInvariant(SplatValue)) {
     // It looks like we can use SplatValue.
     return LegalStoreKind::Memset;
-  } else if (!UnorderedAtomic && HasMemsetPattern && !DisableLIRP::Memset &&
-             // Don't create memset_pattern16s with address spaces.
-             StorePtr->getType()->getPointerAddressSpace() == 0 &&
-             (PatternValue = getMemSetPatternValue(StoredVal, DL))) {
+  }
+  if (!UnorderedAtomic && HasMemsetPattern && !DisableLIRP::Memset &&
+      // Don't create memset_pattern16s with address spaces.
+      StorePtr->getType()->getPointerAddressSpace() == 0 &&
+      getMemSetPatternValue(StoredVal, DL)) {
     // It looks like we can use PatternValue!
     return LegalStoreKind::MemsetPattern;
   }

diff  --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 5cbe1a34392c..790541c08aaf 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -201,10 +201,9 @@ static void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
 }
 
 static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode) {
-  uint64_t CurCode;
   uint64_t Offset = 0;
   DataExtractor AbbrevData(Abbrev, true, 0);
-  while ((CurCode = AbbrevData.getULEB128(&Offset)) != AbbrCode) {
+  while (AbbrevData.getULEB128(&Offset) != AbbrCode) {
     // Tag
     AbbrevData.getULEB128(&Offset);
     // DW_CHILDREN


        


More information about the llvm-commits mailing list