diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-18 10:17:22 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-18 10:17:22 -0700 |
commit | 4271a1ff33802b4be06945d6ee6b45f8b6bedc74 (patch) | |
tree | 65ad522a8d11a67e5c7730a8d7f63a6566acc09a /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | eca86cb2edfd63c296ec3fa30697276f2ddcfbb8 (diff) | |
download | llvm-4271a1ff33802b4be06945d6ee6b45f8b6bedc74.zip llvm-4271a1ff33802b4be06945d6ee6b45f8b6bedc74.tar.gz llvm-4271a1ff33802b4be06945d6ee6b45f8b6bedc74.tar.bz2 |
[llvm] Call *set::insert without checking membership first (NFC)
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 85d8afb..4b5f37e 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -6020,31 +6020,25 @@ bool CodeGenPrepare::optimizePhiType( for (Value *V : Phi->incoming_values()) { if (auto *OpPhi = dyn_cast<PHINode>(V)) { if (!PhiNodes.count(OpPhi)) { - if (Visited.count(OpPhi)) + if (!Visited.insert(OpPhi).second) return false; PhiNodes.insert(OpPhi); - Visited.insert(OpPhi); Worklist.push_back(OpPhi); } } else if (auto *OpLoad = dyn_cast<LoadInst>(V)) { if (!OpLoad->isSimple()) return false; - if (!Defs.count(OpLoad)) { - Defs.insert(OpLoad); + if (Defs.insert(OpLoad).second) Worklist.push_back(OpLoad); - } } else if (auto *OpEx = dyn_cast<ExtractElementInst>(V)) { - if (!Defs.count(OpEx)) { - Defs.insert(OpEx); + if (Defs.insert(OpEx).second) Worklist.push_back(OpEx); - } } else if (auto *OpBC = dyn_cast<BitCastInst>(V)) { if (!ConvertTy) ConvertTy = OpBC->getOperand(0)->getType(); if (OpBC->getOperand(0)->getType() != ConvertTy) return false; - if (!Defs.count(OpBC)) { - Defs.insert(OpBC); + if (Defs.insert(OpBC).second) { Worklist.push_back(OpBC); AnyAnchored |= !isa<LoadInst>(OpBC->getOperand(0)) && !isa<ExtractElementInst>(OpBC->getOperand(0)); |