[llvm] [BitcodeReader] Lazily read and cache target triple (NFC) (PR #208175)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 06:04:03 PDT 2026


================
@@ -893,6 +889,20 @@ class BitcodeReader : public BitcodeReaderBase, public GVMaterializer {
     return readConstantRange(Record, OpNum, BitWidth);
   }
 
+  /// Cache target triple for for upgrading AArch64 memory effects.
+  const Triple &getTargetTriple() {
+    if (!TargetTriple) {
+      BitstreamCursor TripleStream(Stream.getBitcodeBytes());
+      if (Expected<std::string> TripleStr = readTriple(TripleStream))
+        TargetTriple.emplace(*TripleStr);
----------------
CarolineConcatto wrote:

Should we use std::move here?
  TargetTriple.emplace(std::move(*TripleStr));

https://github.com/llvm/llvm-project/pull/208175


More information about the llvm-commits mailing list