diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:43:05 +0000 |
commit | 349cc55c9796c4596a5b9904cd3281af295f878f (patch) | |
tree | 410c5a785075730a35f1272ca6a7adf72222ad03 /contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp | |
parent | cb2ae6163174b90e999326ecec3699ee093a5d43 (diff) | |
parent | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp index ec8d7a7074cd..aff9d1311688 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/LowerSwitch.cpp @@ -524,16 +524,14 @@ bool LowerSwitch(Function &F, LazyValueInfo *LVI, AssumptionCache *AC) { bool Changed = false; SmallPtrSet<BasicBlock *, 8> DeleteList; - for (Function::iterator I = F.begin(), E = F.end(); I != E;) { - BasicBlock *Cur = - &*I++; // Advance over block so we don't traverse new blocks - + // We use make_early_inc_range here so that we don't traverse new blocks. + for (BasicBlock &Cur : llvm::make_early_inc_range(F)) { // If the block is a dead Default block that will be deleted later, don't // waste time processing it. - if (DeleteList.count(Cur)) + if (DeleteList.count(&Cur)) continue; - if (SwitchInst *SI = dyn_cast<SwitchInst>(Cur->getTerminator())) { + if (SwitchInst *SI = dyn_cast<SwitchInst>(Cur.getTerminator())) { Changed = true; ProcessSwitchInst(SI, DeleteList, AC, LVI); } |