[PATCH] D152372: change checking for auto-init metadata to use `equalsStr` instead of casing MDOperand nodes.

Zain Jaffal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 07:58:25 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd65c0527ab70: change checking for auto-init metadata to use `equalsStr` instead of casing… (authored by zjaffal).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152372/new/

https://reviews.llvm.org/D152372

Files:
  llvm/lib/Transforms/Utils/MoveAutoInit.cpp


Index: llvm/lib/Transforms/Utils/MoveAutoInit.cpp
===================================================================
--- llvm/lib/Transforms/Utils/MoveAutoInit.cpp
+++ llvm/lib/Transforms/Utils/MoveAutoInit.cpp
@@ -40,9 +40,7 @@
 static bool hasAutoInitMetadata(const Instruction &I) {
   return I.hasMetadata(LLVMContext::MD_annotation) &&
          any_of(I.getMetadata(LLVMContext::MD_annotation)->operands(),
-                [](const MDOperand &Op) {
-                  return cast<MDString>(Op.get())->getString() == "auto-init";
-                });
+                [](const MDOperand &Op) { return Op.equalsStr("auto-init"); });
 }
 
 static std::optional<MemoryLocation> writeToAlloca(const Instruction &I) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152372.529599.patch
Type: text/x-patch
Size: 720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230608/b7b0e321/attachment-0001.bin>


More information about the llvm-commits mailing list