[Mlir-commits] [mlir] [mlir] Use StringRef::consume_front (NFC) (PR #139459)

Kazu Hirata llvmlistbot at llvm.org
Sun May 11 10:00:11 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/139459

None

>From 1bb6698dd14f985c747ca94fab210e2d18daabdc Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 10 May 2025 23:49:14 -0700
Subject: [PATCH] [mlir] Use StringRef::consume_front (NFC)

---
 mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index ad4f65da9d7f5..1168b9f339904 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -296,8 +296,7 @@ translateDataLayout(DataLayoutSpecInterface attribute,
       return failure();
   }
   StringRef layoutSpec(llvmDataLayout);
-  if (layoutSpec.starts_with("-"))
-    layoutSpec = layoutSpec.drop_front();
+  layoutSpec.consume_front("-");
 
   return llvm::DataLayout(layoutSpec);
 }



More information about the Mlir-commits mailing list