From f2264ebb087272d49e2216476a62f3208ba5a1ea Mon Sep 17 00:00:00 2001 From: Yang Fan Date: Fri, 28 May 2021 16:15:12 +0800 Subject: [PATCH] [ConstantFolding] Fix -Wunused-variable warning (NFC) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit GCC warning: ``` /llvm-project/llvm/lib/Analysis/ConstantFolding.cpp: In function ‘llvm::Constant* llvm::ConstantFoldLoadFromConstPtr(llvm::Constant*, llvm::Type*, const llvm::DataLayout&)’: /llvm-project/llvm/lib/Analysis/ConstantFolding.cpp:713:19: warning: unused variable ‘SimplifiedGEP’ [-Wunused-variable] 713 | if (auto *SimplifiedGEP = dyn_cast(Simplified)) { | ^~~~~~~~~~~~~ ``` --- llvm/lib/Analysis/ConstantFolding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 989379d..39ef3fe 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -710,7 +710,7 @@ Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, // fold it if the resulting pointer operand is a GlobalValue. Otherwise // there is nothing else to simplify since the GEP is already in the // most simplified form. - if (auto *SimplifiedGEP = dyn_cast(Simplified)) { + if (isa(Simplified)) { if (auto *GV = dyn_cast(Simplified->getOperand(0))) { if (GV->isConstant() && GV->hasDefinitiveInitializer()) { if (Constant *V = ConstantFoldLoadThroughGEPConstantExpr( -- 2.7.4