1 //===- CombinerUtils.cpp --------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "CombinerUtils.h" 10 #include "llvm/ADT/StringSet.h" 11 12 namespace llvm { 13 14 StringRef insertStrRef(StringRef S) { 15 if (S.empty()) 16 return {}; 17 18 static StringSet<> Pool; 19 auto [It, Inserted] = Pool.insert(S); 20 return It->getKey(); 21 } 22 23 } // namespace llvm 24