[llvm] r321605 - [Utils/Local] Use `auto` when the type is obvious. NFCI.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 31 08:51:50 PST 2017
Author: davide
Date: Sun Dec 31 08:51:50 2017
New Revision: 321605
URL: http://llvm.org/viewvc/llvm-project?rev=321605&view=rev
Log:
[Utils/Local] Use `auto` when the type is obvious. NFCI.
Modified:
llvm/trunk/lib/Transforms/Utils/Local.cpp
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=321605&r1=321604&r2=321605&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Sun Dec 31 08:51:50 2017
@@ -105,12 +105,12 @@ bool llvm::ConstantFoldTerminator(BasicB
IRBuilder<> Builder(T);
// Branch - See if we are conditional jumping on constant
- if (BranchInst *BI = dyn_cast<BranchInst>(T)) {
+ if (auto *BI = dyn_cast<BranchInst>(T)) {
if (BI->isUnconditional()) return false; // Can't optimize uncond branch
BasicBlock *Dest1 = BI->getSuccessor(0);
BasicBlock *Dest2 = BI->getSuccessor(1);
- if (ConstantInt *Cond = dyn_cast<ConstantInt>(BI->getCondition())) {
+ if (auto *Cond = dyn_cast<ConstantInt>(BI->getCondition())) {
// Are we branching on constant?
// YES. Change to unconditional branch...
BasicBlock *Destination = Cond->getZExtValue() ? Dest1 : Dest2;
@@ -146,10 +146,10 @@ bool llvm::ConstantFoldTerminator(BasicB
return false;
}
- if (SwitchInst *SI = dyn_cast<SwitchInst>(T)) {
+ if (auto *SI = dyn_cast<SwitchInst>(T)) {
// If we are switching on a constant, we can convert the switch to an
// unconditional branch.
- ConstantInt *CI = dyn_cast<ConstantInt>(SI->getCondition());
+ auto *CI = dyn_cast<ConstantInt>(SI->getCondition());
BasicBlock *DefaultDest = SI->getDefaultDest();
BasicBlock *TheOnlyDest = DefaultDest;
@@ -276,9 +276,9 @@ bool llvm::ConstantFoldTerminator(BasicB
return false;
}
- if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(T)) {
+ if (auto *IBI = dyn_cast<IndirectBrInst>(T)) {
// indirectbr blockaddress(@F, @BB) -> br label @BB
- if (BlockAddress *BA =
+ if (auto *BA =
dyn_cast<BlockAddress>(IBI->getAddress()->stripPointerCasts())) {
BasicBlock *TheOnlyDest = BA->getBasicBlock();
// Insert the new branch.
More information about the llvm-commits
mailing list