[llvm] e582fe6 - [llvm] Fix -Wunused-variable in ConstantFold.cpp (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 00:58:31 PST 2023


Author: Jie Fu
Date: 2023-11-14T16:57:24+08:00
New Revision: e582fe64449b56005b945a32cc06e70bd8ef6ab1

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

LOG: [llvm] Fix -Wunused-variable in ConstantFold.cpp (NFC)

/llvm-project/llvm/lib/IR/ConstantFold.cpp:137:12: error: unused variable 'CSize' [-Werror,-Wunused-variable]
  unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
           ^
1 error generated.

Added: 
    

Modified: 
    llvm/lib/IR/ConstantFold.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 25f7ac22e3ab687..d499d74f7ba0106 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -134,7 +134,7 @@ static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
   assert(C->getType()->isIntegerTy() &&
          (cast<IntegerType>(C->getType())->getBitWidth() & 7) == 0 &&
          "Non-byte sized integer input");
-  unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
+  [[maybe_unused]] unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
   assert(ByteSize && "Must be accessing some piece");
   assert(ByteStart+ByteSize <= CSize && "Extracting invalid piece from input");
   assert(ByteSize != CSize && "Should not extract everything");


        


More information about the llvm-commits mailing list