[llvm] ee1a06b - [Analysis] Fix gcc warnings about unused variables [NFC]
Mikael Holmen via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 02:26:48 PDT 2023
Author: Mikael Holmen
Date: 2023-09-29T11:25:36+02:00
New Revision: ee1a06b80fb70a015d0b8a6be55124df3575622a
URL: https://github.com/llvm/llvm-project/commit/ee1a06b80fb70a015d0b8a6be55124df3575622a
DIFF: https://github.com/llvm/llvm-project/commit/ee1a06b80fb70a015d0b8a6be55124df3575622a.diff
LOG: [Analysis] Fix gcc warnings about unused variables [NFC]
gcc warned with:
[236/4788] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/LazyValueInfo.cpp.o
../lib/Analysis/LazyValueInfo.cpp: In member function 'void llvm::LazyValueInfo::forgetValue(llvm::Value*)':
../lib/Analysis/LazyValueInfo.cpp:1978:13: warning: unused variable 'Impl' [-Wunused-variable]
1978 | if (auto *Impl = getImpl())
| ^~~~
../lib/Analysis/LazyValueInfo.cpp: In member function 'void llvm::LazyValueInfo::eraseBlock(llvm::BasicBlock*)':
../lib/Analysis/LazyValueInfo.cpp:1983:13: warning: unused variable 'Impl' [-Wunused-variable]
1983 | if (auto *Impl = getImpl())
| ^~~~
../lib/Analysis/LazyValueInfo.cpp: In member function 'void llvm::LazyValueInfo::clear()':
../lib/Analysis/LazyValueInfo.cpp:1988:13: warning: unused variable 'Impl' [-Wunused-variable]
1988 | if (auto *Impl = getImpl())
| ^~~~
../lib/Analysis/LazyValueInfo.cpp: In member function 'void llvm::LazyValueInfo::printLVI(llvm::Function&, llvm::DominatorTree&, llvm::raw_ostream&)':
../lib/Analysis/LazyValueInfo.cpp:1993:13: warning: unused variable 'Impl' [-Wunused-variable]
1993 | if (auto *Impl = getImpl())
| ^~~~
Use the locals instead of calling getImpl() again.
Added:
Modified:
llvm/lib/Analysis/LazyValueInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 80136a090a8010d..0892aa9d75fb417 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -1976,22 +1976,22 @@ void LazyValueInfo::threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc,
void LazyValueInfo::forgetValue(Value *V) {
if (auto *Impl = getImpl())
- getImpl()->forgetValue(V);
+ Impl->forgetValue(V);
}
void LazyValueInfo::eraseBlock(BasicBlock *BB) {
if (auto *Impl = getImpl())
- getImpl()->eraseBlock(BB);
+ Impl->eraseBlock(BB);
}
void LazyValueInfo::clear() {
if (auto *Impl = getImpl())
- getImpl()->clear();
+ Impl->clear();
}
void LazyValueInfo::printLVI(Function &F, DominatorTree &DTree, raw_ostream &OS) {
if (auto *Impl = getImpl())
- getImpl()->printLVI(F, DTree, OS);
+ Impl->printLVI(F, DTree, OS);
}
// Print the LVI for the function arguments at the start of each basic block.
More information about the llvm-commits
mailing list