diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp index f9a38e48166c9..904ce17fb0e7c 100644 --- a/llvm/lib/IR/Instruction.cpp +++ b/llvm/lib/IR/Instruction.cpp @@ -1167,9 +1167,7 @@ void Instruction::copyMetadata(const Instruction &SrcInst, if (!SrcInst.hasMetadata()) return; - DenseSet WLS; - for (unsigned M : WL) - WLS.insert(M); + SmallDenseSet WLS(WL.begin(), WL.end()); // Otherwise, enumerate and copy over metadata from the old instruction to the // new one.