[llvm] 59fe840 - [LV] Use StringRef::consume_front. NFC (#161454)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 08:58:33 PDT 2025


Author: Craig Topper
Date: 2025-10-01T08:58:30-07:00
New Revision: 59fe8401f473dc77825b7bdfc82dc1628ddb82cc

URL: https://github.com/llvm/llvm-project/commit/59fe8401f473dc77825b7bdfc82dc1628ddb82cc
DIFF: https://github.com/llvm/llvm-project/commit/59fe8401f473dc77825b7bdfc82dc1628ddb82cc.diff

LOG: [LV] Use StringRef::consume_front. NFC (#161454)

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index ff35db14f7094..7d376c370bb1c 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -293,9 +293,8 @@ void LoopVectorizeHints::getHintsFromMetadata() {
 }
 
 void LoopVectorizeHints::setHint(StringRef Name, Metadata *Arg) {
-  if (!Name.starts_with(Prefix()))
+  if (!Name.consume_front(Prefix()))
     return;
-  Name = Name.substr(Prefix().size(), StringRef::npos);
 
   const ConstantInt *C = mdconst::dyn_extract<ConstantInt>(Arg);
   if (!C)


        


More information about the llvm-commits mailing list