[ConstantFolding] Fix -Wunused-variable warning (NFC)

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<GEPOperator>(Simplified)) {
      |                   ^~~~~~~~~~~~~
```
This commit is contained in:
Yang Fan 2021-05-28 16:15:12 +08:00
parent e96d6f4821
commit f2264ebb08
No known key found for this signature in database
GPG Key ID: 717E4EB972E515EF
1 changed files with 1 additions and 1 deletions

View File

@ -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<GEPOperator>(Simplified)) {
if (isa<GEPOperator>(Simplified)) {
if (auto *GV = dyn_cast<GlobalVariable>(Simplified->getOperand(0))) {
if (GV->isConstant() && GV->hasDefinitiveInitializer()) {
if (Constant *V = ConstantFoldLoadThroughGEPConstantExpr(