[llvm] 939fd6c - [AutoUpgrade] Use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 05:27:53 PST 2023


Author: Simon Pilgrim
Date: 2023-11-06T13:27:36Z
New Revision: 939fd6c37c52a12cb968215cb30d1accd360338c

URL: https://github.com/llvm/llvm-project/commit/939fd6c37c52a12cb968215cb30d1accd360338c
DIFF: https://github.com/llvm/llvm-project/commit/939fd6c37c52a12cb968215cb30d1accd360338c.diff

LOG: [AutoUpgrade] Use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.

startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)

Added: 
    

Modified: 
    llvm/include/llvm/IR/AutoUpgrade.h
    llvm/lib/IR/AutoUpgrade.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/AutoUpgrade.h b/llvm/include/llvm/IR/AutoUpgrade.h
index f9b5d0c843907e6..152f781ffa9b305 100644
--- a/llvm/include/llvm/IR/AutoUpgrade.h
+++ b/llvm/include/llvm/IR/AutoUpgrade.h
@@ -90,7 +90,7 @@ namespace llvm {
 
   /// Check whether a string looks like an old loop attachment tag.
   inline bool mayBeOldLoopAttachmentTag(StringRef Name) {
-    return Name.startswith("llvm.vectorizer.");
+    return Name.starts_with("llvm.vectorizer.");
   }
 
   /// Upgrade the loop attachment metadata node.

diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index e102aae52597a8a..f401135127c1b2b 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -128,60 +128,60 @@ static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name) {
       Name == "addcarry.u64" || // Added in 8.0
       Name == "subborrow.u32" || // Added in 8.0
       Name == "subborrow.u64" || // Added in 8.0
-      Name.startswith("sse2.padds.") || // Added in 8.0
-      Name.startswith("sse2.psubs.") || // Added in 8.0
-      Name.startswith("sse2.paddus.") || // Added in 8.0
-      Name.startswith("sse2.psubus.") || // Added in 8.0
-      Name.startswith("avx2.padds.") || // Added in 8.0
-      Name.startswith("avx2.psubs.") || // Added in 8.0
-      Name.startswith("avx2.paddus.") || // Added in 8.0
-      Name.startswith("avx2.psubus.") || // Added in 8.0
-      Name.startswith("avx512.padds.") || // Added in 8.0
-      Name.startswith("avx512.psubs.") || // Added in 8.0
-      Name.startswith("avx512.mask.padds.") || // Added in 8.0
-      Name.startswith("avx512.mask.psubs.") || // Added in 8.0
-      Name.startswith("avx512.mask.paddus.") || // Added in 8.0
-      Name.startswith("avx512.mask.psubus.") || // Added in 8.0
+      Name.starts_with("sse2.padds.") || // Added in 8.0
+      Name.starts_with("sse2.psubs.") || // Added in 8.0
+      Name.starts_with("sse2.paddus.") || // Added in 8.0
+      Name.starts_with("sse2.psubus.") || // Added in 8.0
+      Name.starts_with("avx2.padds.") || // Added in 8.0
+      Name.starts_with("avx2.psubs.") || // Added in 8.0
+      Name.starts_with("avx2.paddus.") || // Added in 8.0
+      Name.starts_with("avx2.psubus.") || // Added in 8.0
+      Name.starts_with("avx512.padds.") || // Added in 8.0
+      Name.starts_with("avx512.psubs.") || // Added in 8.0
+      Name.starts_with("avx512.mask.padds.") || // Added in 8.0
+      Name.starts_with("avx512.mask.psubs.") || // Added in 8.0
+      Name.starts_with("avx512.mask.paddus.") || // Added in 8.0
+      Name.starts_with("avx512.mask.psubus.") || // Added in 8.0
       Name=="ssse3.pabs.b.128" || // Added in 6.0
       Name=="ssse3.pabs.w.128" || // Added in 6.0
       Name=="ssse3.pabs.d.128" || // Added in 6.0
-      Name.startswith("fma4.vfmadd.s") || // Added in 7.0
-      Name.startswith("fma.vfmadd.") || // Added in 7.0
-      Name.startswith("fma.vfmsub.") || // Added in 7.0
-      Name.startswith("fma.vfmsubadd.") || // Added in 7.0
-      Name.startswith("fma.vfnmadd.") || // Added in 7.0
-      Name.startswith("fma.vfnmsub.") || // Added in 7.0
-      Name.startswith("avx512.mask.vfmadd.") || // Added in 7.0
-      Name.startswith("avx512.mask.vfnmadd.") || // Added in 7.0
-      Name.startswith("avx512.mask.vfnmsub.") || // Added in 7.0
-      Name.startswith("avx512.mask3.vfmadd.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vfmadd.") || // Added in 7.0
-      Name.startswith("avx512.mask3.vfmsub.") || // Added in 7.0
-      Name.startswith("avx512.mask3.vfnmsub.") || // Added in 7.0
-      Name.startswith("avx512.mask.vfmaddsub.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vfmaddsub.") || // Added in 7.0
-      Name.startswith("avx512.mask3.vfmaddsub.") || // Added in 7.0
-      Name.startswith("avx512.mask3.vfmsubadd.") || // Added in 7.0
-      Name.startswith("avx512.mask.shuf.i") || // Added in 6.0
-      Name.startswith("avx512.mask.shuf.f") || // Added in 6.0
-      Name.startswith("avx512.kunpck") || //added in 6.0
-      Name.startswith("avx2.pabs.") || // Added in 6.0
-      Name.startswith("avx512.mask.pabs.") || // Added in 6.0
-      Name.startswith("avx512.broadcastm") || // Added in 6.0
+      Name.starts_with("fma4.vfmadd.s") || // Added in 7.0
+      Name.starts_with("fma.vfmadd.") || // Added in 7.0
+      Name.starts_with("fma.vfmsub.") || // Added in 7.0
+      Name.starts_with("fma.vfmsubadd.") || // Added in 7.0
+      Name.starts_with("fma.vfnmadd.") || // Added in 7.0
+      Name.starts_with("fma.vfnmsub.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vfmadd.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vfnmadd.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vfnmsub.") || // Added in 7.0
+      Name.starts_with("avx512.mask3.vfmadd.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vfmadd.") || // Added in 7.0
+      Name.starts_with("avx512.mask3.vfmsub.") || // Added in 7.0
+      Name.starts_with("avx512.mask3.vfnmsub.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vfmaddsub.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vfmaddsub.") || // Added in 7.0
+      Name.starts_with("avx512.mask3.vfmaddsub.") || // Added in 7.0
+      Name.starts_with("avx512.mask3.vfmsubadd.") || // Added in 7.0
+      Name.starts_with("avx512.mask.shuf.i") || // Added in 6.0
+      Name.starts_with("avx512.mask.shuf.f") || // Added in 6.0
+      Name.starts_with("avx512.kunpck") || //added in 6.0
+      Name.starts_with("avx2.pabs.") || // Added in 6.0
+      Name.starts_with("avx512.mask.pabs.") || // Added in 6.0
+      Name.starts_with("avx512.broadcastm") || // Added in 6.0
       Name == "sse.sqrt.ss" || // Added in 7.0
       Name == "sse2.sqrt.sd" || // Added in 7.0
-      Name.startswith("avx512.mask.sqrt.p") || // Added in 7.0
-      Name.startswith("avx.sqrt.p") || // Added in 7.0
-      Name.startswith("sse2.sqrt.p") || // Added in 7.0
-      Name.startswith("sse.sqrt.p") || // Added in 7.0
-      Name.startswith("avx512.mask.pbroadcast") || // Added in 6.0
-      Name.startswith("sse2.pcmpeq.") || // Added in 3.1
-      Name.startswith("sse2.pcmpgt.") || // Added in 3.1
-      Name.startswith("avx2.pcmpeq.") || // Added in 3.1
-      Name.startswith("avx2.pcmpgt.") || // Added in 3.1
-      Name.startswith("avx512.mask.pcmpeq.") || // Added in 3.9
-      Name.startswith("avx512.mask.pcmpgt.") || // Added in 3.9
-      Name.startswith("avx.vperm2f128.") || // Added in 6.0
+      Name.starts_with("avx512.mask.sqrt.p") || // Added in 7.0
+      Name.starts_with("avx.sqrt.p") || // Added in 7.0
+      Name.starts_with("sse2.sqrt.p") || // Added in 7.0
+      Name.starts_with("sse.sqrt.p") || // Added in 7.0
+      Name.starts_with("avx512.mask.pbroadcast") || // Added in 6.0
+      Name.starts_with("sse2.pcmpeq.") || // Added in 3.1
+      Name.starts_with("sse2.pcmpgt.") || // Added in 3.1
+      Name.starts_with("avx2.pcmpeq.") || // Added in 3.1
+      Name.starts_with("avx2.pcmpgt.") || // Added in 3.1
+      Name.starts_with("avx512.mask.pcmpeq.") || // Added in 3.9
+      Name.starts_with("avx512.mask.pcmpgt.") || // Added in 3.9
+      Name.starts_with("avx.vperm2f128.") || // Added in 6.0
       Name == "avx2.vperm2i128" || // Added in 6.0
       Name == "sse.add.ss" || // Added in 4.0
       Name == "sse2.add.sd" || // Added in 4.0
@@ -211,48 +211,48 @@ static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name) {
       Name == "avx512.kxnor.w" || // Added in 7.0
       Name == "avx512.kortestc.w" || // Added in 7.0
       Name == "avx512.kortestz.w" || // Added in 7.0
-      Name.startswith("avx512.mask.pshuf.b.") || // Added in 4.0
-      Name.startswith("avx2.pmax") || // Added in 3.9
-      Name.startswith("avx2.pmin") || // Added in 3.9
-      Name.startswith("avx512.mask.pmax") || // Added in 4.0
-      Name.startswith("avx512.mask.pmin") || // Added in 4.0
-      Name.startswith("avx2.vbroadcast") || // Added in 3.8
-      Name.startswith("avx2.pbroadcast") || // Added in 3.8
-      Name.startswith("avx.vpermil.") || // Added in 3.1
-      Name.startswith("sse2.pshuf") || // Added in 3.9
-      Name.startswith("avx512.pbroadcast") || // Added in 3.9
-      Name.startswith("avx512.mask.broadcast.s") || // Added in 3.9
-      Name.startswith("avx512.mask.movddup") || // Added in 3.9
-      Name.startswith("avx512.mask.movshdup") || // Added in 3.9
-      Name.startswith("avx512.mask.movsldup") || // Added in 3.9
-      Name.startswith("avx512.mask.pshuf.d.") || // Added in 3.9
-      Name.startswith("avx512.mask.pshufl.w.") || // Added in 3.9
-      Name.startswith("avx512.mask.pshufh.w.") || // Added in 3.9
-      Name.startswith("avx512.mask.shuf.p") || // Added in 4.0
-      Name.startswith("avx512.mask.vpermil.p") || // Added in 3.9
-      Name.startswith("avx512.mask.perm.df.") || // Added in 3.9
-      Name.startswith("avx512.mask.perm.di.") || // Added in 3.9
-      Name.startswith("avx512.mask.punpckl") || // Added in 3.9
-      Name.startswith("avx512.mask.punpckh") || // Added in 3.9
-      Name.startswith("avx512.mask.unpckl.") || // Added in 3.9
-      Name.startswith("avx512.mask.unpckh.") || // Added in 3.9
-      Name.startswith("avx512.mask.pand.") || // Added in 3.9
-      Name.startswith("avx512.mask.pandn.") || // Added in 3.9
-      Name.startswith("avx512.mask.por.") || // Added in 3.9
-      Name.startswith("avx512.mask.pxor.") || // Added in 3.9
-      Name.startswith("avx512.mask.and.") || // Added in 3.9
-      Name.startswith("avx512.mask.andn.") || // Added in 3.9
-      Name.startswith("avx512.mask.or.") || // Added in 3.9
-      Name.startswith("avx512.mask.xor.") || // Added in 3.9
-      Name.startswith("avx512.mask.padd.") || // Added in 4.0
-      Name.startswith("avx512.mask.psub.") || // Added in 4.0
-      Name.startswith("avx512.mask.pmull.") || // Added in 4.0
-      Name.startswith("avx512.mask.cvtdq2pd.") || // Added in 4.0
-      Name.startswith("avx512.mask.cvtudq2pd.") || // Added in 4.0
-      Name.startswith("avx512.mask.cvtudq2ps.") || // Added in 7.0 updated 9.0
-      Name.startswith("avx512.mask.cvtqq2pd.") || // Added in 7.0 updated 9.0
-      Name.startswith("avx512.mask.cvtuqq2pd.") || // Added in 7.0 updated 9.0
-      Name.startswith("avx512.mask.cvtdq2ps.") || // Added in 7.0 updated 9.0
+      Name.starts_with("avx512.mask.pshuf.b.") || // Added in 4.0
+      Name.starts_with("avx2.pmax") || // Added in 3.9
+      Name.starts_with("avx2.pmin") || // Added in 3.9
+      Name.starts_with("avx512.mask.pmax") || // Added in 4.0
+      Name.starts_with("avx512.mask.pmin") || // Added in 4.0
+      Name.starts_with("avx2.vbroadcast") || // Added in 3.8
+      Name.starts_with("avx2.pbroadcast") || // Added in 3.8
+      Name.starts_with("avx.vpermil.") || // Added in 3.1
+      Name.starts_with("sse2.pshuf") || // Added in 3.9
+      Name.starts_with("avx512.pbroadcast") || // Added in 3.9
+      Name.starts_with("avx512.mask.broadcast.s") || // Added in 3.9
+      Name.starts_with("avx512.mask.movddup") || // Added in 3.9
+      Name.starts_with("avx512.mask.movshdup") || // Added in 3.9
+      Name.starts_with("avx512.mask.movsldup") || // Added in 3.9
+      Name.starts_with("avx512.mask.pshuf.d.") || // Added in 3.9
+      Name.starts_with("avx512.mask.pshufl.w.") || // Added in 3.9
+      Name.starts_with("avx512.mask.pshufh.w.") || // Added in 3.9
+      Name.starts_with("avx512.mask.shuf.p") || // Added in 4.0
+      Name.starts_with("avx512.mask.vpermil.p") || // Added in 3.9
+      Name.starts_with("avx512.mask.perm.df.") || // Added in 3.9
+      Name.starts_with("avx512.mask.perm.di.") || // Added in 3.9
+      Name.starts_with("avx512.mask.punpckl") || // Added in 3.9
+      Name.starts_with("avx512.mask.punpckh") || // Added in 3.9
+      Name.starts_with("avx512.mask.unpckl.") || // Added in 3.9
+      Name.starts_with("avx512.mask.unpckh.") || // Added in 3.9
+      Name.starts_with("avx512.mask.pand.") || // Added in 3.9
+      Name.starts_with("avx512.mask.pandn.") || // Added in 3.9
+      Name.starts_with("avx512.mask.por.") || // Added in 3.9
+      Name.starts_with("avx512.mask.pxor.") || // Added in 3.9
+      Name.starts_with("avx512.mask.and.") || // Added in 3.9
+      Name.starts_with("avx512.mask.andn.") || // Added in 3.9
+      Name.starts_with("avx512.mask.or.") || // Added in 3.9
+      Name.starts_with("avx512.mask.xor.") || // Added in 3.9
+      Name.starts_with("avx512.mask.padd.") || // Added in 4.0
+      Name.starts_with("avx512.mask.psub.") || // Added in 4.0
+      Name.starts_with("avx512.mask.pmull.") || // Added in 4.0
+      Name.starts_with("avx512.mask.cvtdq2pd.") || // Added in 4.0
+      Name.starts_with("avx512.mask.cvtudq2pd.") || // Added in 4.0
+      Name.starts_with("avx512.mask.cvtudq2ps.") || // Added in 7.0 updated 9.0
+      Name.starts_with("avx512.mask.cvtqq2pd.") || // Added in 7.0 updated 9.0
+      Name.starts_with("avx512.mask.cvtuqq2pd.") || // Added in 7.0 updated 9.0
+      Name.starts_with("avx512.mask.cvtdq2ps.") || // Added in 7.0 updated 9.0
       Name == "avx512.mask.vcvtph2ps.128" || // Added in 11.0
       Name == "avx512.mask.vcvtph2ps.256" || // Added in 11.0
       Name == "avx512.mask.cvtqq2ps.256" || // Added in 9.0
@@ -267,91 +267,91 @@ static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name) {
       Name == "avx512.mask.cvtps2pd.128" || // Added in 7.0
       Name == "avx512.mask.cvtps2pd.256" || // Added in 7.0
       Name == "avx512.cvtusi2sd" || // Added in 7.0
-      Name.startswith("avx512.mask.permvar.") || // Added in 7.0
+      Name.starts_with("avx512.mask.permvar.") || // Added in 7.0
       Name == "sse2.pmulu.dq" || // Added in 7.0
       Name == "sse41.pmuldq" || // Added in 7.0
       Name == "avx2.pmulu.dq" || // Added in 7.0
       Name == "avx2.pmul.dq" || // Added in 7.0
       Name == "avx512.pmulu.dq.512" || // Added in 7.0
       Name == "avx512.pmul.dq.512" || // Added in 7.0
-      Name.startswith("avx512.mask.pmul.dq.") || // Added in 4.0
-      Name.startswith("avx512.mask.pmulu.dq.") || // Added in 4.0
-      Name.startswith("avx512.mask.pmul.hr.sw.") || // Added in 7.0
-      Name.startswith("avx512.mask.pmulh.w.") || // Added in 7.0
-      Name.startswith("avx512.mask.pmulhu.w.") || // Added in 7.0
-      Name.startswith("avx512.mask.pmaddw.d.") || // Added in 7.0
-      Name.startswith("avx512.mask.pmaddubs.w.") || // Added in 7.0
-      Name.startswith("avx512.mask.packsswb.") || // Added in 5.0
-      Name.startswith("avx512.mask.packssdw.") || // Added in 5.0
-      Name.startswith("avx512.mask.packuswb.") || // Added in 5.0
-      Name.startswith("avx512.mask.packusdw.") || // Added in 5.0
-      Name.startswith("avx512.mask.cmp.b") || // Added in 5.0
-      Name.startswith("avx512.mask.cmp.d") || // Added in 5.0
-      Name.startswith("avx512.mask.cmp.q") || // Added in 5.0
-      Name.startswith("avx512.mask.cmp.w") || // Added in 5.0
-      Name.startswith("avx512.cmp.p") || // Added in 12.0
-      Name.startswith("avx512.mask.ucmp.") || // Added in 5.0
-      Name.startswith("avx512.cvtb2mask.") || // Added in 7.0
-      Name.startswith("avx512.cvtw2mask.") || // Added in 7.0
-      Name.startswith("avx512.cvtd2mask.") || // Added in 7.0
-      Name.startswith("avx512.cvtq2mask.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpermilvar.") || // Added in 4.0
-      Name.startswith("avx512.mask.psll.d") || // Added in 4.0
-      Name.startswith("avx512.mask.psll.q") || // Added in 4.0
-      Name.startswith("avx512.mask.psll.w") || // Added in 4.0
-      Name.startswith("avx512.mask.psra.d") || // Added in 4.0
-      Name.startswith("avx512.mask.psra.q") || // Added in 4.0
-      Name.startswith("avx512.mask.psra.w") || // Added in 4.0
-      Name.startswith("avx512.mask.psrl.d") || // Added in 4.0
-      Name.startswith("avx512.mask.psrl.q") || // Added in 4.0
-      Name.startswith("avx512.mask.psrl.w") || // Added in 4.0
-      Name.startswith("avx512.mask.pslli") || // Added in 4.0
-      Name.startswith("avx512.mask.psrai") || // Added in 4.0
-      Name.startswith("avx512.mask.psrli") || // Added in 4.0
-      Name.startswith("avx512.mask.psllv") || // Added in 4.0
-      Name.startswith("avx512.mask.psrav") || // Added in 4.0
-      Name.startswith("avx512.mask.psrlv") || // Added in 4.0
-      Name.startswith("sse41.pmovsx") || // Added in 3.8
-      Name.startswith("sse41.pmovzx") || // Added in 3.9
-      Name.startswith("avx2.pmovsx") || // Added in 3.9
-      Name.startswith("avx2.pmovzx") || // Added in 3.9
-      Name.startswith("avx512.mask.pmovsx") || // Added in 4.0
-      Name.startswith("avx512.mask.pmovzx") || // Added in 4.0
-      Name.startswith("avx512.mask.lzcnt.") || // Added in 5.0
-      Name.startswith("avx512.mask.pternlog.") || // Added in 7.0
-      Name.startswith("avx512.maskz.pternlog.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpmadd52") || // Added in 7.0
-      Name.startswith("avx512.maskz.vpmadd52") || // Added in 7.0
-      Name.startswith("avx512.mask.vpermi2var.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpermt2var.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vpermt2var.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpdpbusd.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vpdpbusd.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpdpbusds.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vpdpbusds.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpdpwssd.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vpdpwssd.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpdpwssds.") || // Added in 7.0
-      Name.startswith("avx512.maskz.vpdpwssds.") || // Added in 7.0
-      Name.startswith("avx512.mask.dbpsadbw.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpshld.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpshrd.") || // Added in 7.0
-      Name.startswith("avx512.mask.vpshldv.") || // Added in 8.0
-      Name.startswith("avx512.mask.vpshrdv.") || // Added in 8.0
-      Name.startswith("avx512.maskz.vpshldv.") || // Added in 8.0
-      Name.startswith("avx512.maskz.vpshrdv.") || // Added in 8.0
-      Name.startswith("avx512.vpshld.") || // Added in 8.0
-      Name.startswith("avx512.vpshrd.") || // Added in 8.0
-      Name.startswith("avx512.mask.add.p") || // Added in 7.0. 128/256 in 4.0
-      Name.startswith("avx512.mask.sub.p") || // Added in 7.0. 128/256 in 4.0
-      Name.startswith("avx512.mask.mul.p") || // Added in 7.0. 128/256 in 4.0
-      Name.startswith("avx512.mask.div.p") || // Added in 7.0. 128/256 in 4.0
-      Name.startswith("avx512.mask.max.p") || // Added in 7.0. 128/256 in 5.0
-      Name.startswith("avx512.mask.min.p") || // Added in 7.0. 128/256 in 5.0
-      Name.startswith("avx512.mask.fpclass.p") || // Added in 7.0
-      Name.startswith("avx512.mask.vpshufbitqmb.") || // Added in 8.0
-      Name.startswith("avx512.mask.pmultishift.qb.") || // Added in 8.0
-      Name.startswith("avx512.mask.conflict.") || // Added in 9.0
+      Name.starts_with("avx512.mask.pmul.dq.") || // Added in 4.0
+      Name.starts_with("avx512.mask.pmulu.dq.") || // Added in 4.0
+      Name.starts_with("avx512.mask.pmul.hr.sw.") || // Added in 7.0
+      Name.starts_with("avx512.mask.pmulh.w.") || // Added in 7.0
+      Name.starts_with("avx512.mask.pmulhu.w.") || // Added in 7.0
+      Name.starts_with("avx512.mask.pmaddw.d.") || // Added in 7.0
+      Name.starts_with("avx512.mask.pmaddubs.w.") || // Added in 7.0
+      Name.starts_with("avx512.mask.packsswb.") || // Added in 5.0
+      Name.starts_with("avx512.mask.packssdw.") || // Added in 5.0
+      Name.starts_with("avx512.mask.packuswb.") || // Added in 5.0
+      Name.starts_with("avx512.mask.packusdw.") || // Added in 5.0
+      Name.starts_with("avx512.mask.cmp.b") || // Added in 5.0
+      Name.starts_with("avx512.mask.cmp.d") || // Added in 5.0
+      Name.starts_with("avx512.mask.cmp.q") || // Added in 5.0
+      Name.starts_with("avx512.mask.cmp.w") || // Added in 5.0
+      Name.starts_with("avx512.cmp.p") || // Added in 12.0
+      Name.starts_with("avx512.mask.ucmp.") || // Added in 5.0
+      Name.starts_with("avx512.cvtb2mask.") || // Added in 7.0
+      Name.starts_with("avx512.cvtw2mask.") || // Added in 7.0
+      Name.starts_with("avx512.cvtd2mask.") || // Added in 7.0
+      Name.starts_with("avx512.cvtq2mask.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpermilvar.") || // Added in 4.0
+      Name.starts_with("avx512.mask.psll.d") || // Added in 4.0
+      Name.starts_with("avx512.mask.psll.q") || // Added in 4.0
+      Name.starts_with("avx512.mask.psll.w") || // Added in 4.0
+      Name.starts_with("avx512.mask.psra.d") || // Added in 4.0
+      Name.starts_with("avx512.mask.psra.q") || // Added in 4.0
+      Name.starts_with("avx512.mask.psra.w") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrl.d") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrl.q") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrl.w") || // Added in 4.0
+      Name.starts_with("avx512.mask.pslli") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrai") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrli") || // Added in 4.0
+      Name.starts_with("avx512.mask.psllv") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrav") || // Added in 4.0
+      Name.starts_with("avx512.mask.psrlv") || // Added in 4.0
+      Name.starts_with("sse41.pmovsx") || // Added in 3.8
+      Name.starts_with("sse41.pmovzx") || // Added in 3.9
+      Name.starts_with("avx2.pmovsx") || // Added in 3.9
+      Name.starts_with("avx2.pmovzx") || // Added in 3.9
+      Name.starts_with("avx512.mask.pmovsx") || // Added in 4.0
+      Name.starts_with("avx512.mask.pmovzx") || // Added in 4.0
+      Name.starts_with("avx512.mask.lzcnt.") || // Added in 5.0
+      Name.starts_with("avx512.mask.pternlog.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.pternlog.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpmadd52") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vpmadd52") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpermi2var.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpermt2var.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vpermt2var.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpdpbusd.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vpdpbusd.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpdpbusds.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vpdpbusds.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpdpwssd.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vpdpwssd.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpdpwssds.") || // Added in 7.0
+      Name.starts_with("avx512.maskz.vpdpwssds.") || // Added in 7.0
+      Name.starts_with("avx512.mask.dbpsadbw.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpshld.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpshrd.") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpshldv.") || // Added in 8.0
+      Name.starts_with("avx512.mask.vpshrdv.") || // Added in 8.0
+      Name.starts_with("avx512.maskz.vpshldv.") || // Added in 8.0
+      Name.starts_with("avx512.maskz.vpshrdv.") || // Added in 8.0
+      Name.starts_with("avx512.vpshld.") || // Added in 8.0
+      Name.starts_with("avx512.vpshrd.") || // Added in 8.0
+      Name.starts_with("avx512.mask.add.p") || // Added in 7.0. 128/256 in 4.0
+      Name.starts_with("avx512.mask.sub.p") || // Added in 7.0. 128/256 in 4.0
+      Name.starts_with("avx512.mask.mul.p") || // Added in 7.0. 128/256 in 4.0
+      Name.starts_with("avx512.mask.div.p") || // Added in 7.0. 128/256 in 4.0
+      Name.starts_with("avx512.mask.max.p") || // Added in 7.0. 128/256 in 5.0
+      Name.starts_with("avx512.mask.min.p") || // Added in 7.0. 128/256 in 5.0
+      Name.starts_with("avx512.mask.fpclass.p") || // Added in 7.0
+      Name.starts_with("avx512.mask.vpshufbitqmb.") || // Added in 8.0
+      Name.starts_with("avx512.mask.pmultishift.qb.") || // Added in 8.0
+      Name.starts_with("avx512.mask.conflict.") || // Added in 9.0
       Name == "avx512.mask.pmov.qd.256" || // Added in 9.0
       Name == "avx512.mask.pmov.qd.512" || // Added in 9.0
       Name == "avx512.mask.pmov.wb.256" || // Added in 9.0
@@ -367,85 +367,85 @@ static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name) {
       Name == "avx.cvtdq2.pd.256" || // Added in 3.9
       Name == "avx.cvtdq2.ps.256" || // Added in 7.0
       Name == "avx.cvt.ps2.pd.256" || // Added in 3.9
-      Name.startswith("vcvtph2ps.") || // Added in 11.0
-      Name.startswith("avx.vinsertf128.") || // Added in 3.7
+      Name.starts_with("vcvtph2ps.") || // Added in 11.0
+      Name.starts_with("avx.vinsertf128.") || // Added in 3.7
       Name == "avx2.vinserti128" || // Added in 3.7
-      Name.startswith("avx512.mask.insert") || // Added in 4.0
-      Name.startswith("avx.vextractf128.") || // Added in 3.7
+      Name.starts_with("avx512.mask.insert") || // Added in 4.0
+      Name.starts_with("avx.vextractf128.") || // Added in 3.7
       Name == "avx2.vextracti128" || // Added in 3.7
-      Name.startswith("avx512.mask.vextract") || // Added in 4.0
-      Name.startswith("sse4a.movnt.") || // Added in 3.9
-      Name.startswith("avx.movnt.") || // Added in 3.2
-      Name.startswith("avx512.storent.") || // Added in 3.9
+      Name.starts_with("avx512.mask.vextract") || // Added in 4.0
+      Name.starts_with("sse4a.movnt.") || // Added in 3.9
+      Name.starts_with("avx.movnt.") || // Added in 3.2
+      Name.starts_with("avx512.storent.") || // Added in 3.9
       Name == "sse41.movntdqa" || // Added in 5.0
       Name == "avx2.movntdqa" || // Added in 5.0
       Name == "avx512.movntdqa" || // Added in 5.0
       Name == "sse2.storel.dq" || // Added in 3.9
-      Name.startswith("sse.storeu.") || // Added in 3.9
-      Name.startswith("sse2.storeu.") || // Added in 3.9
-      Name.startswith("avx.storeu.") || // Added in 3.9
-      Name.startswith("avx512.mask.storeu.") || // Added in 3.9
-      Name.startswith("avx512.mask.store.p") || // Added in 3.9
-      Name.startswith("avx512.mask.store.b.") || // Added in 3.9
-      Name.startswith("avx512.mask.store.w.") || // Added in 3.9
-      Name.startswith("avx512.mask.store.d.") || // Added in 3.9
-      Name.startswith("avx512.mask.store.q.") || // Added in 3.9
+      Name.starts_with("sse.storeu.") || // Added in 3.9
+      Name.starts_with("sse2.storeu.") || // Added in 3.9
+      Name.starts_with("avx.storeu.") || // Added in 3.9
+      Name.starts_with("avx512.mask.storeu.") || // Added in 3.9
+      Name.starts_with("avx512.mask.store.p") || // Added in 3.9
+      Name.starts_with("avx512.mask.store.b.") || // Added in 3.9
+      Name.starts_with("avx512.mask.store.w.") || // Added in 3.9
+      Name.starts_with("avx512.mask.store.d.") || // Added in 3.9
+      Name.starts_with("avx512.mask.store.q.") || // Added in 3.9
       Name == "avx512.mask.store.ss" || // Added in 7.0
-      Name.startswith("avx512.mask.loadu.") || // Added in 3.9
-      Name.startswith("avx512.mask.load.") || // Added in 3.9
-      Name.startswith("avx512.mask.expand.load.") || // Added in 7.0
-      Name.startswith("avx512.mask.compress.store.") || // Added in 7.0
-      Name.startswith("avx512.mask.expand.b") || // Added in 9.0
-      Name.startswith("avx512.mask.expand.w") || // Added in 9.0
-      Name.startswith("avx512.mask.expand.d") || // Added in 9.0
-      Name.startswith("avx512.mask.expand.q") || // Added in 9.0
-      Name.startswith("avx512.mask.expand.p") || // Added in 9.0
-      Name.startswith("avx512.mask.compress.b") || // Added in 9.0
-      Name.startswith("avx512.mask.compress.w") || // Added in 9.0
-      Name.startswith("avx512.mask.compress.d") || // Added in 9.0
-      Name.startswith("avx512.mask.compress.q") || // Added in 9.0
-      Name.startswith("avx512.mask.compress.p") || // Added in 9.0
+      Name.starts_with("avx512.mask.loadu.") || // Added in 3.9
+      Name.starts_with("avx512.mask.load.") || // Added in 3.9
+      Name.starts_with("avx512.mask.expand.load.") || // Added in 7.0
+      Name.starts_with("avx512.mask.compress.store.") || // Added in 7.0
+      Name.starts_with("avx512.mask.expand.b") || // Added in 9.0
+      Name.starts_with("avx512.mask.expand.w") || // Added in 9.0
+      Name.starts_with("avx512.mask.expand.d") || // Added in 9.0
+      Name.starts_with("avx512.mask.expand.q") || // Added in 9.0
+      Name.starts_with("avx512.mask.expand.p") || // Added in 9.0
+      Name.starts_with("avx512.mask.compress.b") || // Added in 9.0
+      Name.starts_with("avx512.mask.compress.w") || // Added in 9.0
+      Name.starts_with("avx512.mask.compress.d") || // Added in 9.0
+      Name.starts_with("avx512.mask.compress.q") || // Added in 9.0
+      Name.starts_with("avx512.mask.compress.p") || // Added in 9.0
       Name == "sse42.crc32.64.8" || // Added in 3.4
-      Name.startswith("avx.vbroadcast.s") || // Added in 3.5
-      Name.startswith("avx512.vbroadcast.s") || // Added in 7.0
-      Name.startswith("avx512.mask.palignr.") || // Added in 3.9
-      Name.startswith("avx512.mask.valign.") || // Added in 4.0
-      Name.startswith("sse2.psll.dq") || // Added in 3.7
-      Name.startswith("sse2.psrl.dq") || // Added in 3.7
-      Name.startswith("avx2.psll.dq") || // Added in 3.7
-      Name.startswith("avx2.psrl.dq") || // Added in 3.7
-      Name.startswith("avx512.psll.dq") || // Added in 3.9
-      Name.startswith("avx512.psrl.dq") || // Added in 3.9
+      Name.starts_with("avx.vbroadcast.s") || // Added in 3.5
+      Name.starts_with("avx512.vbroadcast.s") || // Added in 7.0
+      Name.starts_with("avx512.mask.palignr.") || // Added in 3.9
+      Name.starts_with("avx512.mask.valign.") || // Added in 4.0
+      Name.starts_with("sse2.psll.dq") || // Added in 3.7
+      Name.starts_with("sse2.psrl.dq") || // Added in 3.7
+      Name.starts_with("avx2.psll.dq") || // Added in 3.7
+      Name.starts_with("avx2.psrl.dq") || // Added in 3.7
+      Name.starts_with("avx512.psll.dq") || // Added in 3.9
+      Name.starts_with("avx512.psrl.dq") || // Added in 3.9
       Name == "sse41.pblendw" || // Added in 3.7
-      Name.startswith("sse41.blendp") || // Added in 3.7
-      Name.startswith("avx.blend.p") || // Added in 3.7
+      Name.starts_with("sse41.blendp") || // Added in 3.7
+      Name.starts_with("avx.blend.p") || // Added in 3.7
       Name == "avx2.pblendw" || // Added in 3.7
-      Name.startswith("avx2.pblendd.") || // Added in 3.7
-      Name.startswith("avx.vbroadcastf128") || // Added in 4.0
+      Name.starts_with("avx2.pblendd.") || // Added in 3.7
+      Name.starts_with("avx.vbroadcastf128") || // Added in 4.0
       Name == "avx2.vbroadcasti128" || // Added in 3.7
-      Name.startswith("avx512.mask.broadcastf32x4.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcastf64x2.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcastf32x8.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcastf64x4.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcasti32x4.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcasti64x2.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcasti32x8.") || // Added in 6.0
-      Name.startswith("avx512.mask.broadcasti64x4.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcastf32x4.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcastf64x2.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcastf32x8.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcastf64x4.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcasti32x4.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcasti64x2.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcasti32x8.") || // Added in 6.0
+      Name.starts_with("avx512.mask.broadcasti64x4.") || // Added in 6.0
       Name == "xop.vpcmov" || // Added in 3.8
       Name == "xop.vpcmov.256" || // Added in 5.0
-      Name.startswith("avx512.mask.move.s") || // Added in 4.0
-      Name.startswith("avx512.cvtmask2") || // Added in 5.0
-      Name.startswith("xop.vpcom") || // Added in 3.2, Updated in 9.0
-      Name.startswith("xop.vprot") || // Added in 8.0
-      Name.startswith("avx512.prol") || // Added in 8.0
-      Name.startswith("avx512.pror") || // Added in 8.0
-      Name.startswith("avx512.mask.prorv.") || // Added in 8.0
-      Name.startswith("avx512.mask.pror.") ||  // Added in 8.0
-      Name.startswith("avx512.mask.prolv.") || // Added in 8.0
-      Name.startswith("avx512.mask.prol.") ||  // Added in 8.0
-      Name.startswith("avx512.ptestm") || //Added in 6.0
-      Name.startswith("avx512.ptestnm") || //Added in 6.0
-      Name.startswith("avx512.mask.pavg")) // Added in 6.0
+      Name.starts_with("avx512.mask.move.s") || // Added in 4.0
+      Name.starts_with("avx512.cvtmask2") || // Added in 5.0
+      Name.starts_with("xop.vpcom") || // Added in 3.2, Updated in 9.0
+      Name.starts_with("xop.vprot") || // Added in 8.0
+      Name.starts_with("avx512.prol") || // Added in 8.0
+      Name.starts_with("avx512.pror") || // Added in 8.0
+      Name.starts_with("avx512.mask.prorv.") || // Added in 8.0
+      Name.starts_with("avx512.mask.pror.") ||  // Added in 8.0
+      Name.starts_with("avx512.mask.prolv.") || // Added in 8.0
+      Name.starts_with("avx512.mask.prol.") ||  // Added in 8.0
+      Name.starts_with("avx512.ptestm") || //Added in 6.0
+      Name.starts_with("avx512.ptestnm") || //Added in 6.0
+      Name.starts_with("avx512.mask.pavg")) // Added in 6.0
     return true;
 
   return false;
@@ -454,7 +454,7 @@ static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name) {
 static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name,
                                         Function *&NewFn) {
   // Only handle intrinsics that start with "x86.".
-  if (!Name.startswith("x86."))
+  if (!Name.starts_with("x86."))
     return false;
   // Remove "x86." prefix.
   Name = Name.substr(4);
@@ -476,7 +476,7 @@ static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name,
   }
 
   // SSE4.1 ptest functions may have an old signature.
-  if (Name.startswith("sse41.ptest")) { // Added in 3.2
+  if (Name.starts_with("sse41.ptest")) { // Added in 3.2
     if (Name.substr(11) == "c")
       return UpgradePTESTIntrinsic(F, Intrinsic::x86_sse41_ptestc, NewFn);
     if (Name.substr(11) == "z")
@@ -551,20 +551,20 @@ static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name,
         F, Intrinsic::x86_avx512bf16_dpbf16ps_512, NewFn);
 
   // frcz.ss/sd may need to have an argument dropped. Added in 3.2
-  if (Name.startswith("xop.vfrcz.ss") && F->arg_size() == 2) {
+  if (Name.starts_with("xop.vfrcz.ss") && F->arg_size() == 2) {
     rename(F);
     NewFn = Intrinsic::getDeclaration(F->getParent(),
                                       Intrinsic::x86_xop_vfrcz_ss);
     return true;
   }
-  if (Name.startswith("xop.vfrcz.sd") && F->arg_size() == 2) {
+  if (Name.starts_with("xop.vfrcz.sd") && F->arg_size() == 2) {
     rename(F);
     NewFn = Intrinsic::getDeclaration(F->getParent(),
                                       Intrinsic::x86_xop_vfrcz_sd);
     return true;
   }
   // Upgrade any XOP PERMIL2 index operand still using a float/double vector.
-  if (Name.startswith("xop.vpermil2")) { // Added in 3.9
+  if (Name.starts_with("xop.vpermil2")) { // Added in 3.9
     auto Idx = F->getFunctionType()->getParamType(2);
     if (Idx->isFPOrFPVectorTy()) {
       rename(F);
@@ -677,24 +677,24 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
 
   // Quickly eliminate it, if it's not a candidate.
   StringRef Name = F->getName();
-  if (Name.size() <= 7 || !Name.startswith("llvm."))
+  if (Name.size() <= 7 || !Name.starts_with("llvm."))
     return false;
   Name = Name.substr(5); // Strip off "llvm."
 
   switch (Name[0]) {
   default: break;
   case 'a': {
-    if (Name.startswith("arm.rbit") || Name.startswith("aarch64.rbit")) {
+    if (Name.starts_with("arm.rbit") || Name.starts_with("aarch64.rbit")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::bitreverse,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("aarch64.neon.frintn")) {
+    if (Name.starts_with("aarch64.neon.frintn")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::roundeven,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("aarch64.neon.rbit")) {
+    if (Name.starts_with("aarch64.neon.rbit")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::bitreverse,
                                         F->arg_begin()->getType());
       return true;
@@ -730,13 +730,13 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), ID, Ty);
       return true;
     }
-    if (Name.startswith("aarch64.sve.tuple.get")) {
+    if (Name.starts_with("aarch64.sve.tuple.get")) {
       Type *Tys[] = {F->getReturnType(), F->arg_begin()->getType()};
       NewFn = Intrinsic::getDeclaration(F->getParent(),
                                         Intrinsic::vector_extract, Tys);
       return true;
     }
-    if (Name.startswith("aarch64.sve.tuple.set")) {
+    if (Name.starts_with("aarch64.sve.tuple.set")) {
       auto Args = F->getFunctionType()->params();
       Type *Tys[] = {Args[0], Args[2], Args[1]};
       NewFn = Intrinsic::getDeclaration(F->getParent(),
@@ -752,7 +752,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
                                         Intrinsic::vector_insert, Tys);
       return true;
     }
-    if (Name.startswith("arm.neon.vclz")) {
+    if (Name.starts_with("arm.neon.vclz")) {
       Type* args[2] = {
         F->arg_begin()->getType(),
         Type::getInt1Ty(F->getContext())
@@ -765,7 +765,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
                                "llvm.ctlz." + Name.substr(14), F->getParent());
       return true;
     }
-    if (Name.startswith("arm.neon.vcnt")) {
+    if (Name.starts_with("arm.neon.vcnt")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ctpop,
                                         F->arg_begin()->getType());
       return true;
@@ -796,27 +796,27 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::thread_pointer);
       return true;
     }
-    if (Name.startswith("arm.neon.vqadds.")) {
+    if (Name.starts_with("arm.neon.vqadds.")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::sadd_sat,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("arm.neon.vqaddu.")) {
+    if (Name.starts_with("arm.neon.vqaddu.")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::uadd_sat,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("arm.neon.vqsubs.")) {
+    if (Name.starts_with("arm.neon.vqsubs.")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ssub_sat,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("arm.neon.vqsubu.")) {
+    if (Name.starts_with("arm.neon.vqsubu.")) {
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::usub_sat,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("aarch64.neon.addp")) {
+    if (Name.starts_with("aarch64.neon.addp")) {
       if (F->arg_size() != 2)
         break; // Invalid IR.
       VectorType *Ty = dyn_cast<VectorType>(F->getReturnType());
@@ -829,9 +829,9 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
 
     // Changed in 12.0: bfdot accept v4bf16 and v8bf16 instead of v8i8 and v16i8
     // respectively
-    if ((Name.startswith("arm.neon.bfdot.") ||
-         Name.startswith("aarch64.neon.bfdot.")) &&
-        Name.endswith("i8")) {
+    if ((Name.starts_with("arm.neon.bfdot.") ||
+         Name.starts_with("aarch64.neon.bfdot.")) &&
+        Name.ends_with("i8")) {
       Intrinsic::ID IID =
           StringSwitch<Intrinsic::ID>(Name)
               .Cases("arm.neon.bfdot.v2f32.v8i8",
@@ -858,9 +858,9 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
 
     // Changed in 12.0: bfmmla, bfmlalb and bfmlalt are not polymorphic anymore
     // and accept v8bf16 instead of v16i8
-    if ((Name.startswith("arm.neon.bfm") ||
-         Name.startswith("aarch64.neon.bfm")) &&
-        Name.endswith(".v4f32.v16i8")) {
+    if ((Name.starts_with("arm.neon.bfm") ||
+         Name.starts_with("aarch64.neon.bfm")) &&
+        Name.ends_with(".v4f32.v16i8")) {
       Intrinsic::ID IID =
           StringSwitch<Intrinsic::ID>(Name)
               .Case("arm.neon.bfmmla.v4f32.v16i8",
@@ -920,14 +920,14 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
         return true;
       }
 
-      if (Name.startswith("atomic.inc") || Name.startswith("atomic.dec")) {
+      if (Name.starts_with("atomic.inc") || Name.starts_with("atomic.dec")) {
         // This was replaced with atomicrmw uinc_wrap and udec_wrap, so there's no
         // new declaration.
         NewFn = nullptr;
         return true;
       }
 
-      if (Name.startswith("ldexp.")) {
+      if (Name.starts_with("ldexp.")) {
         // Target specific intrinsic became redundant
         NewFn = Intrinsic::getDeclaration(
           F->getParent(), Intrinsic::ldexp,
@@ -939,13 +939,13 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
     break;
   }
   case 'c': {
-    if (Name.startswith("ctlz.") && F->arg_size() == 1) {
+    if (Name.starts_with("ctlz.") && F->arg_size() == 1) {
       rename(F);
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ctlz,
                                         F->arg_begin()->getType());
       return true;
     }
-    if (Name.startswith("cttz.") && F->arg_size() == 1) {
+    if (Name.starts_with("cttz.") && F->arg_size() == 1) {
       rename(F);
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::cttz,
                                         F->arg_begin()->getType());
@@ -1032,14 +1032,14 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
     }
     break; // No other 'e*'.
   case 'f':
-    if (Name.startswith("flt.rounds")) {
+    if (Name.starts_with("flt.rounds")) {
       rename(F);
       NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::get_rounding);
       return true;
     }
     break;
   case 'i':
-    if (Name.startswith("invariant.group.barrier")) {
+    if (Name.starts_with("invariant.group.barrier")) {
       // Rename invariant.group.barrier to launder.invariant.group
       auto Args = F->getFunctionType()->params();
       Type* ObjectPtr[1] = {Args[0]};
@@ -1066,7 +1066,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
         return true;
       }
     }
-    if (Name.startswith("memset.") && F->arg_size() == 5) {
+    if (Name.starts_with("memset.") && F->arg_size() == 5) {
       rename(F);
       // Get the types of dest, and len
       const auto *FT = F->getFunctionType();
@@ -1121,7 +1121,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
         Expand = Name == "i" || Name == "ll" || Name == "ui" || Name == "ull";
       else if (Name.consume_front("atomic.load.add."))
         // nvvm.atomic.load.add.{f32.p,f64.p}
-        Expand = Name.startswith("f32.p") || Name.startswith("f64.p");
+        Expand = Name.starts_with("f32.p") || Name.starts_with("f64.p");
       else
         Expand = false;
 
@@ -1136,7 +1136,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
   case 'o':
     // We only need to change the name to match the mangling including the
     // address space.
-    if (Name.startswith("objectsize.")) {
+    if (Name.starts_with("objectsize.")) {
       Type *Tys[2] = { F->getReturnType(), F->arg_begin()->getType() };
       if (F->arg_size() == 2 || F->arg_size() == 3 ||
           F->getName() !=
@@ -1150,7 +1150,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
     break;
 
   case 'p':
-    if (Name.startswith("ptr.annotation.") && F->arg_size() == 4) {
+    if (Name.starts_with("ptr.annotation.") && F->arg_size() == 4) {
       rename(F);
       NewFn = Intrinsic::getDeclaration(
           F->getParent(), Intrinsic::ptr_annotation,
@@ -1866,7 +1866,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
   unsigned VecWidth = CI.getType()->getPrimitiveSizeInBits();
   unsigned EltWidth = CI.getType()->getScalarSizeInBits();
   Intrinsic::ID IID;
-  if (Name.startswith("max.p")) {
+  if (Name.starts_with("max.p")) {
     if (VecWidth == 128 && EltWidth == 32)
       IID = Intrinsic::x86_sse_max_ps;
     else if (VecWidth == 128 && EltWidth == 64)
@@ -1877,7 +1877,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx_max_pd_256;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("min.p")) {
+  } else if (Name.starts_with("min.p")) {
     if (VecWidth == 128 && EltWidth == 32)
       IID = Intrinsic::x86_sse_min_ps;
     else if (VecWidth == 128 && EltWidth == 64)
@@ -1888,7 +1888,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx_min_pd_256;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pshuf.b.")) {
+  } else if (Name.starts_with("pshuf.b.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_ssse3_pshuf_b_128;
     else if (VecWidth == 256)
@@ -1897,7 +1897,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pshuf_b_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pmul.hr.sw.")) {
+  } else if (Name.starts_with("pmul.hr.sw.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_ssse3_pmul_hr_sw_128;
     else if (VecWidth == 256)
@@ -1906,7 +1906,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pmul_hr_sw_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pmulh.w.")) {
+  } else if (Name.starts_with("pmulh.w.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse2_pmulh_w;
     else if (VecWidth == 256)
@@ -1915,7 +1915,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pmulh_w_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pmulhu.w.")) {
+  } else if (Name.starts_with("pmulhu.w.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse2_pmulhu_w;
     else if (VecWidth == 256)
@@ -1924,7 +1924,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pmulhu_w_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pmaddw.d.")) {
+  } else if (Name.starts_with("pmaddw.d.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse2_pmadd_wd;
     else if (VecWidth == 256)
@@ -1933,7 +1933,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pmaddw_d_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pmaddubs.w.")) {
+  } else if (Name.starts_with("pmaddubs.w.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_ssse3_pmadd_ub_sw_128;
     else if (VecWidth == 256)
@@ -1942,7 +1942,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pmaddubs_w_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("packsswb.")) {
+  } else if (Name.starts_with("packsswb.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse2_packsswb_128;
     else if (VecWidth == 256)
@@ -1951,7 +1951,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_packsswb_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("packssdw.")) {
+  } else if (Name.starts_with("packssdw.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse2_packssdw_128;
     else if (VecWidth == 256)
@@ -1960,7 +1960,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_packssdw_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("packuswb.")) {
+  } else if (Name.starts_with("packuswb.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse2_packuswb_128;
     else if (VecWidth == 256)
@@ -1969,7 +1969,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_packuswb_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("packusdw.")) {
+  } else if (Name.starts_with("packusdw.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_sse41_packusdw;
     else if (VecWidth == 256)
@@ -1978,7 +1978,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_packusdw_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("vpermilvar.")) {
+  } else if (Name.starts_with("vpermilvar.")) {
     if (VecWidth == 128 && EltWidth == 32)
       IID = Intrinsic::x86_avx_vpermilvar_ps;
     else if (VecWidth == 128 && EltWidth == 64)
@@ -2003,7 +2003,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
     IID = Intrinsic::x86_sse2_cvttps2dq;
   } else if (Name == "cvttps2dq.256") {
     IID = Intrinsic::x86_avx_cvtt_ps2dq_256;
-  } else if (Name.startswith("permvar.")) {
+  } else if (Name.starts_with("permvar.")) {
     bool IsFloat = CI.getType()->isFPOrFPVectorTy();
     if (VecWidth == 256 && EltWidth == 32 && IsFloat)
       IID = Intrinsic::x86_avx2_permps;
@@ -2035,7 +2035,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_permvar_qi_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("dbpsadbw.")) {
+  } else if (Name.starts_with("dbpsadbw.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_avx512_dbpsadbw_128;
     else if (VecWidth == 256)
@@ -2044,7 +2044,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_dbpsadbw_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pmultishift.qb.")) {
+  } else if (Name.starts_with("pmultishift.qb.")) {
     if (VecWidth == 128)
       IID = Intrinsic::x86_avx512_pmultishift_qb_128;
     else if (VecWidth == 256)
@@ -2053,7 +2053,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_pmultishift_qb_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("conflict.")) {
+  } else if (Name.starts_with("conflict.")) {
     if (Name[9] == 'd' && VecWidth == 128)
       IID = Intrinsic::x86_avx512_conflict_d_128;
     else if (Name[9] == 'd' && VecWidth == 256)
@@ -2068,7 +2068,7 @@ static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
       IID = Intrinsic::x86_avx512_conflict_q_512;
     else
       llvm_unreachable("Unexpected intrinsic");
-  } else if (Name.startswith("pavg.")) {
+  } else if (Name.starts_with("pavg.")) {
     if (Name[5] == 'b' && VecWidth == 128)
       IID = Intrinsic::x86_sse2_pavg_b;
     else if (Name[5] == 'b' && VecWidth == 256)
@@ -2204,8 +2204,8 @@ static Value *UpgradeARMIntrinsicCall(StringRef Name, CallBase *CI, Function *F,
 
 static Value *UpgradeAMDGCNIntrinsicCall(StringRef Name, CallBase *CI,
                                          Function *F, IRBuilder<> &Builder) {
-  const bool IsInc = Name.startswith("atomic.inc.");
-  if (IsInc || Name.startswith("atomic.dec.")) {
+  const bool IsInc = Name.starts_with("atomic.inc.");
+  if (IsInc || Name.starts_with("atomic.dec.")) {
     if (CI->getNumOperands() != 6) // Malformed bitcode.
       return nullptr;
 
@@ -2256,23 +2256,23 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
     // Get the Function's name.
     StringRef Name = F->getName();
 
-    assert(Name.startswith("llvm.") && "Intrinsic doesn't start with 'llvm.'");
+    assert(Name.starts_with("llvm.") && "Intrinsic doesn't start with 'llvm.'");
     Name = Name.substr(5);
 
-    bool IsX86 = Name.startswith("x86.");
+    bool IsX86 = Name.starts_with("x86.");
     if (IsX86)
       Name = Name.substr(4);
-    bool IsNVVM = Name.startswith("nvvm.");
+    bool IsNVVM = Name.starts_with("nvvm.");
     if (IsNVVM)
       Name = Name.substr(5);
-    bool IsARM = Name.startswith("arm.");
+    bool IsARM = Name.starts_with("arm.");
     if (IsARM)
       Name = Name.substr(4);
-    bool IsAMDGCN = Name.startswith("amdgcn.");
+    bool IsAMDGCN = Name.starts_with("amdgcn.");
     if (IsAMDGCN)
       Name = Name.substr(7);
 
-    if (IsX86 && Name.startswith("sse4a.movnt.")) {
+    if (IsX86 && Name.starts_with("sse4a.movnt.")) {
       SmallVector<Metadata *, 1> Elts;
       Elts.push_back(
           ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
@@ -2297,8 +2297,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       return;
     }
 
-    if (IsX86 && (Name.startswith("avx.movnt.") ||
-                  Name.startswith("avx512.storent."))) {
+    if (IsX86 && (Name.starts_with("avx.movnt.") ||
+                  Name.starts_with("avx512.storent."))) {
       SmallVector<Metadata *, 1> Elts;
       Elts.push_back(
           ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
@@ -2338,9 +2338,9 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       return;
     }
 
-    if (IsX86 && (Name.startswith("sse.storeu.") ||
-                  Name.startswith("sse2.storeu.") ||
-                  Name.startswith("avx.storeu."))) {
+    if (IsX86 && (Name.starts_with("sse.storeu.") ||
+                  Name.starts_with("sse2.storeu.") ||
+                  Name.starts_with("avx.storeu."))) {
       Value *Arg0 = CI->getArgOperand(0);
       Value *Arg1 = CI->getArgOperand(1);
 
@@ -2364,7 +2364,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       return;
     }
 
-    if (IsX86 && (Name.startswith("avx512.mask.store"))) {
+    if (IsX86 && (Name.starts_with("avx512.mask.store"))) {
       // "avx512.mask.storeu." or "avx512.mask.store."
       bool Aligned = Name[17] != 'u'; // "avx512.mask.storeu".
       UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
@@ -2377,14 +2377,14 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
     Value *Rep;
     // Upgrade packed integer vector compare intrinsics to compare instructions.
-    if (IsX86 && (Name.startswith("sse2.pcmp") ||
-                  Name.startswith("avx2.pcmp"))) {
+    if (IsX86 && (Name.starts_with("sse2.pcmp") ||
+                  Name.starts_with("avx2.pcmp"))) {
       // "sse2.pcpmpeq." "sse2.pcmpgt." "avx2.pcmpeq." or "avx2.pcmpgt."
       bool CmpEq = Name[9] == 'e';
       Rep = Builder.CreateICmp(CmpEq ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_SGT,
                                CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = Builder.CreateSExt(Rep, CI->getType(), "");
-    } else if (IsX86 && (Name.startswith("avx512.broadcastm"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.broadcastm"))) {
       Type *ExtTy = Type::getInt32Ty(C);
       if (CI->getOperand(0)->getType()->isIntegerTy(8))
         ExtTy = Type::getInt64Ty(C);
@@ -2400,14 +2400,14 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                                  Intrinsic::sqrt, Elt0->getType());
       Elt0 = Builder.CreateCall(Intr, Elt0);
       Rep = Builder.CreateInsertElement(Vec, Elt0, (uint64_t)0);
-    } else if (IsX86 && (Name.startswith("avx.sqrt.p") ||
-                         Name.startswith("sse2.sqrt.p") ||
-                         Name.startswith("sse.sqrt.p"))) {
+    } else if (IsX86 && (Name.starts_with("avx.sqrt.p") ||
+                         Name.starts_with("sse2.sqrt.p") ||
+                         Name.starts_with("sse.sqrt.p"))) {
       Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(),
                                                          Intrinsic::sqrt,
                                                          CI->getType()),
                                {CI->getArgOperand(0)});
-    } else if (IsX86 && (Name.startswith("avx512.mask.sqrt.p"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.sqrt.p"))) {
       if (CI->arg_size() == 4 &&
           (!isa<ConstantInt>(CI->getArgOperand(3)) ||
            cast<ConstantInt>(CI->getArgOperand(3))->getZExtValue() != 4)) {
@@ -2425,8 +2425,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
       Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                           CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("avx512.ptestm") ||
-                         Name.startswith("avx512.ptestnm"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.ptestm") ||
+                         Name.starts_with("avx512.ptestnm"))) {
       Value *Op0 = CI->getArgOperand(0);
       Value *Op1 = CI->getArgOperand(1);
       Value *Mask = CI->getArgOperand(2);
@@ -2434,16 +2434,16 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       llvm::Type *Ty = Op0->getType();
       Value *Zero = llvm::Constant::getNullValue(Ty);
       ICmpInst::Predicate Pred =
-        Name.startswith("avx512.ptestm") ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
+        Name.starts_with("avx512.ptestm") ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
       Rep = Builder.CreateICmp(Pred, Rep, Zero);
       Rep = ApplyX86MaskOn1BitsVec(Builder, Rep, Mask);
-    } else if (IsX86 && (Name.startswith("avx512.mask.pbroadcast"))){
+    } else if (IsX86 && (Name.starts_with("avx512.mask.pbroadcast"))){
       unsigned NumElts = cast<FixedVectorType>(CI->getArgOperand(1)->getType())
                              ->getNumElements();
       Rep = Builder.CreateVectorSplat(NumElts, CI->getArgOperand(0));
       Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                           CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("avx512.kunpck"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.kunpck"))) {
       unsigned NumElts = CI->getType()->getScalarSizeInBits();
       Value *LHS = getX86MaskVec(Builder, CI->getArgOperand(0), NumElts);
       Value *RHS = getX86MaskVec(Builder, CI->getArgOperand(1), NumElts);
@@ -2525,11 +2525,11 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
         EltOp = Builder.CreateFDiv(Elt0, Elt1);
       Rep = Builder.CreateInsertElement(CI->getArgOperand(0), EltOp,
                                         ConstantInt::get(I32Ty, 0));
-    } else if (IsX86 && Name.startswith("avx512.mask.pcmp")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.pcmp")) {
       // "avx512.mask.pcmpeq." or "avx512.mask.pcmpgt."
       bool CmpEq = Name[16] == 'e';
       Rep = upgradeMaskedCompare(Builder, *CI, CmpEq ? 0 : 6, true);
-    } else if (IsX86 && Name.startswith("avx512.mask.vpshufbitqmb.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.vpshufbitqmb.")) {
       Type *OpTy = CI->getArgOperand(0)->getType();
       unsigned VecWidth = OpTy->getPrimitiveSizeInBits();
       Intrinsic::ID IID;
@@ -2543,7 +2543,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(), IID),
                                { CI->getOperand(0), CI->getArgOperand(1) });
       Rep = ApplyX86MaskOn1BitsVec(Builder, Rep, CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.fpclass.p")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.fpclass.p")) {
       Type *OpTy = CI->getArgOperand(0)->getType();
       unsigned VecWidth = OpTy->getPrimitiveSizeInBits();
       unsigned EltWidth = OpTy->getScalarSizeInBits();
@@ -2566,7 +2566,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(), IID),
                                { CI->getOperand(0), CI->getArgOperand(1) });
       Rep = ApplyX86MaskOn1BitsVec(Builder, Rep, CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.cmp.p")) {
+    } else if (IsX86 && Name.starts_with("avx512.cmp.p")) {
       SmallVector<Value *, 4> Args(CI->args());
       Type *OpTy = Args[0]->getType();
       unsigned VecWidth = OpTy->getPrimitiveSizeInBits();
@@ -2594,17 +2594,17 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(), IID),
                                Args);
-    } else if (IsX86 && Name.startswith("avx512.mask.cmp.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.cmp.")) {
       // Integer compare intrinsics.
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
       Rep = upgradeMaskedCompare(Builder, *CI, Imm, true);
-    } else if (IsX86 && Name.startswith("avx512.mask.ucmp.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.ucmp.")) {
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
       Rep = upgradeMaskedCompare(Builder, *CI, Imm, false);
-    } else if (IsX86 && (Name.startswith("avx512.cvtb2mask.") ||
-                         Name.startswith("avx512.cvtw2mask.") ||
-                         Name.startswith("avx512.cvtd2mask.") ||
-                         Name.startswith("avx512.cvtq2mask."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.cvtb2mask.") ||
+                         Name.starts_with("avx512.cvtw2mask.") ||
+                         Name.starts_with("avx512.cvtd2mask.") ||
+                         Name.starts_with("avx512.cvtq2mask."))) {
       Value *Op = CI->getArgOperand(0);
       Value *Zero = llvm::Constant::getNullValue(Op->getType());
       Rep = Builder.CreateICmp(ICmpInst::ICMP_SLT, Op, Zero);
@@ -2612,42 +2612,42 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
     } else if(IsX86 && (Name == "ssse3.pabs.b.128" ||
                         Name == "ssse3.pabs.w.128" ||
                         Name == "ssse3.pabs.d.128" ||
-                        Name.startswith("avx2.pabs") ||
-                        Name.startswith("avx512.mask.pabs"))) {
+                        Name.starts_with("avx2.pabs") ||
+                        Name.starts_with("avx512.mask.pabs"))) {
       Rep = upgradeAbs(Builder, *CI);
     } else if (IsX86 && (Name == "sse41.pmaxsb" ||
                          Name == "sse2.pmaxs.w" ||
                          Name == "sse41.pmaxsd" ||
-                         Name.startswith("avx2.pmaxs") ||
-                         Name.startswith("avx512.mask.pmaxs"))) {
+                         Name.starts_with("avx2.pmaxs") ||
+                         Name.starts_with("avx512.mask.pmaxs"))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::smax);
     } else if (IsX86 && (Name == "sse2.pmaxu.b" ||
                          Name == "sse41.pmaxuw" ||
                          Name == "sse41.pmaxud" ||
-                         Name.startswith("avx2.pmaxu") ||
-                         Name.startswith("avx512.mask.pmaxu"))) {
+                         Name.starts_with("avx2.pmaxu") ||
+                         Name.starts_with("avx512.mask.pmaxu"))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::umax);
     } else if (IsX86 && (Name == "sse41.pminsb" ||
                          Name == "sse2.pmins.w" ||
                          Name == "sse41.pminsd" ||
-                         Name.startswith("avx2.pmins") ||
-                         Name.startswith("avx512.mask.pmins"))) {
+                         Name.starts_with("avx2.pmins") ||
+                         Name.starts_with("avx512.mask.pmins"))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::smin);
     } else if (IsX86 && (Name == "sse2.pminu.b" ||
                          Name == "sse41.pminuw" ||
                          Name == "sse41.pminud" ||
-                         Name.startswith("avx2.pminu") ||
-                         Name.startswith("avx512.mask.pminu"))) {
+                         Name.starts_with("avx2.pminu") ||
+                         Name.starts_with("avx512.mask.pminu"))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::umin);
     } else if (IsX86 && (Name == "sse2.pmulu.dq" ||
                          Name == "avx2.pmulu.dq" ||
                          Name == "avx512.pmulu.dq.512" ||
-                         Name.startswith("avx512.mask.pmulu.dq."))) {
+                         Name.starts_with("avx512.mask.pmulu.dq."))) {
       Rep = upgradePMULDQ(Builder, *CI, /*Signed*/false);
     } else if (IsX86 && (Name == "sse41.pmuldq" ||
                          Name == "avx2.pmul.dq" ||
                          Name == "avx512.pmul.dq.512" ||
-                         Name.startswith("avx512.mask.pmul.dq."))) {
+                         Name.starts_with("avx512.mask.pmul.dq."))) {
       Rep = upgradePMULDQ(Builder, *CI, /*Signed*/true);
     } else if (IsX86 && (Name == "sse.cvtsi2ss" ||
                          Name == "sse2.cvtsi2sd" ||
@@ -2671,12 +2671,12 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                          Name == "sse2.cvtdq2ps" ||
                          Name == "avx.cvtdq2.pd.256" ||
                          Name == "avx.cvtdq2.ps.256" ||
-                         Name.startswith("avx512.mask.cvtdq2pd.") ||
-                         Name.startswith("avx512.mask.cvtudq2pd.") ||
-                         Name.startswith("avx512.mask.cvtdq2ps.") ||
-                         Name.startswith("avx512.mask.cvtudq2ps.") ||
-                         Name.startswith("avx512.mask.cvtqq2pd.") ||
-                         Name.startswith("avx512.mask.cvtuqq2pd.") ||
+                         Name.starts_with("avx512.mask.cvtdq2pd.") ||
+                         Name.starts_with("avx512.mask.cvtudq2pd.") ||
+                         Name.starts_with("avx512.mask.cvtdq2ps.") ||
+                         Name.starts_with("avx512.mask.cvtudq2ps.") ||
+                         Name.starts_with("avx512.mask.cvtqq2pd.") ||
+                         Name.starts_with("avx512.mask.cvtuqq2pd.") ||
                          Name == "avx512.mask.cvtqq2ps.256" ||
                          Name == "avx512.mask.cvtqq2ps.512" ||
                          Name == "avx512.mask.cvtuqq2ps.256" ||
@@ -2715,8 +2715,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (CI->arg_size() >= 3)
         Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                             CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("avx512.mask.vcvtph2ps.") ||
-                         Name.startswith("vcvtph2ps."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vcvtph2ps.") ||
+                         Name.starts_with("vcvtph2ps."))) {
       auto *DstTy = cast<FixedVectorType>(CI->getType());
       Rep = CI->getArgOperand(0);
       auto *SrcTy = cast<FixedVectorType>(Rep->getType());
@@ -2731,13 +2731,13 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (CI->arg_size() >= 3)
         Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                             CI->getArgOperand(1));
-    } else if (IsX86 && Name.startswith("avx512.mask.load")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.load")) {
       // "avx512.mask.loadu." or "avx512.mask.load."
       bool Aligned = Name[16] != 'u'; // "avx512.mask.loadu".
       Rep =
           UpgradeMaskedLoad(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
                             CI->getArgOperand(2), Aligned);
-    } else if (IsX86 && Name.startswith("avx512.mask.expand.load.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.expand.load.")) {
       auto *ResultTy = cast<FixedVectorType>(CI->getType());
       Type *PtrTy = ResultTy->getElementType();
 
@@ -2752,7 +2752,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                                 Intrinsic::masked_expandload,
                                                 ResultTy);
       Rep = Builder.CreateCall(ELd, { Ptr, MaskVec, CI->getOperand(1) });
-    } else if (IsX86 && Name.startswith("avx512.mask.compress.store.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.compress.store.")) {
       auto *ResultTy = cast<VectorType>(CI->getArgOperand(1)->getType());
       Type *PtrTy = ResultTy->getElementType();
 
@@ -2768,8 +2768,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                                 Intrinsic::masked_compressstore,
                                                 ResultTy);
       Rep = Builder.CreateCall(CSt, { CI->getArgOperand(1), Ptr, MaskVec });
-    } else if (IsX86 && (Name.startswith("avx512.mask.compress.") ||
-                         Name.startswith("avx512.mask.expand."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.compress.") ||
+                         Name.starts_with("avx512.mask.expand."))) {
       auto *ResultTy = cast<FixedVectorType>(CI->getType());
 
       Value *MaskVec = getX86MaskVec(Builder, CI->getArgOperand(2),
@@ -2781,13 +2781,13 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Function *Intr = Intrinsic::getDeclaration(F->getParent(), IID, ResultTy);
       Rep = Builder.CreateCall(Intr, { CI->getOperand(0), CI->getOperand(1),
                                        MaskVec });
-    } else if (IsX86 && Name.startswith("xop.vpcom")) {
+    } else if (IsX86 && Name.starts_with("xop.vpcom")) {
       bool IsSigned;
-      if (Name.endswith("ub") || Name.endswith("uw") || Name.endswith("ud") ||
-          Name.endswith("uq"))
+      if (Name.ends_with("ub") || Name.ends_with("uw") || Name.ends_with("ud") ||
+          Name.ends_with("uq"))
         IsSigned = false;
-      else if (Name.endswith("b") || Name.endswith("w") || Name.endswith("d") ||
-               Name.endswith("q"))
+      else if (Name.ends_with("b") || Name.ends_with("w") || Name.ends_with("d") ||
+               Name.ends_with("q"))
         IsSigned = true;
       else
         llvm_unreachable("Unknown suffix");
@@ -2797,48 +2797,48 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
         Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
       } else {
         Name = Name.substr(9); // strip off "xop.vpcom"
-        if (Name.startswith("lt"))
+        if (Name.starts_with("lt"))
           Imm = 0;
-        else if (Name.startswith("le"))
+        else if (Name.starts_with("le"))
           Imm = 1;
-        else if (Name.startswith("gt"))
+        else if (Name.starts_with("gt"))
           Imm = 2;
-        else if (Name.startswith("ge"))
+        else if (Name.starts_with("ge"))
           Imm = 3;
-        else if (Name.startswith("eq"))
+        else if (Name.starts_with("eq"))
           Imm = 4;
-        else if (Name.startswith("ne"))
+        else if (Name.starts_with("ne"))
           Imm = 5;
-        else if (Name.startswith("false"))
+        else if (Name.starts_with("false"))
           Imm = 6;
-        else if (Name.startswith("true"))
+        else if (Name.starts_with("true"))
           Imm = 7;
         else
           llvm_unreachable("Unknown condition");
       }
 
       Rep = upgradeX86vpcom(Builder, *CI, Imm, IsSigned);
-    } else if (IsX86 && Name.startswith("xop.vpcmov")) {
+    } else if (IsX86 && Name.starts_with("xop.vpcmov")) {
       Value *Sel = CI->getArgOperand(2);
       Value *NotSel = Builder.CreateNot(Sel);
       Value *Sel0 = Builder.CreateAnd(CI->getArgOperand(0), Sel);
       Value *Sel1 = Builder.CreateAnd(CI->getArgOperand(1), NotSel);
       Rep = Builder.CreateOr(Sel0, Sel1);
-    } else if (IsX86 && (Name.startswith("xop.vprot") ||
-                         Name.startswith("avx512.prol") ||
-                         Name.startswith("avx512.mask.prol"))) {
+    } else if (IsX86 && (Name.starts_with("xop.vprot") ||
+                         Name.starts_with("avx512.prol") ||
+                         Name.starts_with("avx512.mask.prol"))) {
       Rep = upgradeX86Rotate(Builder, *CI, false);
-    } else if (IsX86 && (Name.startswith("avx512.pror") ||
-                         Name.startswith("avx512.mask.pror"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.pror") ||
+                         Name.starts_with("avx512.mask.pror"))) {
       Rep = upgradeX86Rotate(Builder, *CI, true);
-    } else if (IsX86 && (Name.startswith("avx512.vpshld.") ||
-                         Name.startswith("avx512.mask.vpshld") ||
-                         Name.startswith("avx512.maskz.vpshld"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.vpshld.") ||
+                         Name.starts_with("avx512.mask.vpshld") ||
+                         Name.starts_with("avx512.maskz.vpshld"))) {
       bool ZeroMask = Name[11] == 'z';
       Rep = upgradeX86ConcatShift(Builder, *CI, false, ZeroMask);
-    } else if (IsX86 && (Name.startswith("avx512.vpshrd.") ||
-                         Name.startswith("avx512.mask.vpshrd") ||
-                         Name.startswith("avx512.maskz.vpshrd"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.vpshrd.") ||
+                         Name.starts_with("avx512.mask.vpshrd") ||
+                         Name.starts_with("avx512.maskz.vpshrd"))) {
       bool ZeroMask = Name[11] == 'z';
       Rep = upgradeX86ConcatShift(Builder, *CI, true, ZeroMask);
     } else if (IsX86 && Name == "sse42.crc32.64.8") {
@@ -2847,8 +2847,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Value *Trunc0 = Builder.CreateTrunc(CI->getArgOperand(0), Type::getInt32Ty(C));
       Rep = Builder.CreateCall(CRC32, {Trunc0, CI->getArgOperand(1)});
       Rep = Builder.CreateZExt(Rep, CI->getType(), "");
-    } else if (IsX86 && (Name.startswith("avx.vbroadcast.s") ||
-                         Name.startswith("avx512.vbroadcast.s"))) {
+    } else if (IsX86 && (Name.starts_with("avx.vbroadcast.s") ||
+                         Name.starts_with("avx512.vbroadcast.s"))) {
       // Replace broadcasts with a series of insertelements.
       auto *VecTy = cast<FixedVectorType>(CI->getType());
       Type *EltTy = VecTy->getElementType();
@@ -2859,12 +2859,12 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       for (unsigned I = 0; I < EltNum; ++I)
         Rep = Builder.CreateInsertElement(Rep, Load,
                                           ConstantInt::get(I32Ty, I));
-    } else if (IsX86 && (Name.startswith("sse41.pmovsx") ||
-                         Name.startswith("sse41.pmovzx") ||
-                         Name.startswith("avx2.pmovsx") ||
-                         Name.startswith("avx2.pmovzx") ||
-                         Name.startswith("avx512.mask.pmovsx") ||
-                         Name.startswith("avx512.mask.pmovzx"))) {
+    } else if (IsX86 && (Name.starts_with("sse41.pmovsx") ||
+                         Name.starts_with("sse41.pmovzx") ||
+                         Name.starts_with("avx2.pmovsx") ||
+                         Name.starts_with("avx2.pmovzx") ||
+                         Name.starts_with("avx512.mask.pmovsx") ||
+                         Name.starts_with("avx512.mask.pmovzx"))) {
       auto *DstTy = cast<FixedVectorType>(CI->getType());
       unsigned NumDstElts = DstTy->getNumElements();
 
@@ -2891,7 +2891,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateTrunc(CI->getArgOperand(0), Ty);
       Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                           CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("avx.vbroadcastf128") ||
+    } else if (IsX86 && (Name.starts_with("avx.vbroadcastf128") ||
                          Name == "avx2.vbroadcasti128")) {
       // Replace vbroadcastf128/vbroadcasti128 with a vector load+shuffle.
       Type *EltTy = cast<VectorType>(CI->getType())->getElementType();
@@ -2905,8 +2905,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       else
         Rep = Builder.CreateShuffleVector(
             Load, ArrayRef<int>{0, 1, 2, 3, 0, 1, 2, 3});
-    } else if (IsX86 && (Name.startswith("avx512.mask.shuf.i") ||
-                         Name.startswith("avx512.mask.shuf.f"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.shuf.i") ||
+                         Name.starts_with("avx512.mask.shuf.f"))) {
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
       Type *VT = CI->getType();
       unsigned NumLanes = VT->getPrimitiveSizeInBits() / 128;
@@ -2927,8 +2927,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                         CI->getArgOperand(1), ShuffleMask);
       Rep = EmitX86Select(Builder, CI->getArgOperand(4), Rep,
                           CI->getArgOperand(3));
-    }else if (IsX86 && (Name.startswith("avx512.mask.broadcastf") ||
-                         Name.startswith("avx512.mask.broadcasti"))) {
+    }else if (IsX86 && (Name.starts_with("avx512.mask.broadcastf") ||
+                         Name.starts_with("avx512.mask.broadcasti"))) {
       unsigned NumSrcElts =
           cast<FixedVectorType>(CI->getArgOperand(0)->getType())
               ->getNumElements();
@@ -2944,10 +2944,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                         ShuffleMask);
       Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                           CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("avx2.pbroadcast") ||
-                         Name.startswith("avx2.vbroadcast") ||
-                         Name.startswith("avx512.pbroadcast") ||
-                         Name.startswith("avx512.mask.broadcast.s"))) {
+    } else if (IsX86 && (Name.starts_with("avx2.pbroadcast") ||
+                         Name.starts_with("avx2.vbroadcast") ||
+                         Name.starts_with("avx512.pbroadcast") ||
+                         Name.starts_with("avx512.mask.broadcast.s"))) {
       // Replace vp?broadcasts with a vector shuffle.
       Value *Op = CI->getArgOperand(0);
       ElementCount EC = cast<VectorType>(CI->getType())->getElementCount();
@@ -2959,32 +2959,32 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (CI->arg_size() == 3)
         Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                             CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("sse2.padds.") ||
-                         Name.startswith("avx2.padds.") ||
-                         Name.startswith("avx512.padds.") ||
-                         Name.startswith("avx512.mask.padds."))) {
+    } else if (IsX86 && (Name.starts_with("sse2.padds.") ||
+                         Name.starts_with("avx2.padds.") ||
+                         Name.starts_with("avx512.padds.") ||
+                         Name.starts_with("avx512.mask.padds."))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::sadd_sat);
-    } else if (IsX86 && (Name.startswith("sse2.psubs.") ||
-                         Name.startswith("avx2.psubs.") ||
-                         Name.startswith("avx512.psubs.") ||
-                         Name.startswith("avx512.mask.psubs."))) {
+    } else if (IsX86 && (Name.starts_with("sse2.psubs.") ||
+                         Name.starts_with("avx2.psubs.") ||
+                         Name.starts_with("avx512.psubs.") ||
+                         Name.starts_with("avx512.mask.psubs."))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::ssub_sat);
-    } else if (IsX86 && (Name.startswith("sse2.paddus.") ||
-                         Name.startswith("avx2.paddus.") ||
-                         Name.startswith("avx512.mask.paddus."))) {
+    } else if (IsX86 && (Name.starts_with("sse2.paddus.") ||
+                         Name.starts_with("avx2.paddus.") ||
+                         Name.starts_with("avx512.mask.paddus."))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::uadd_sat);
-    } else if (IsX86 && (Name.startswith("sse2.psubus.") ||
-                         Name.startswith("avx2.psubus.") ||
-                         Name.startswith("avx512.mask.psubus."))) {
+    } else if (IsX86 && (Name.starts_with("sse2.psubus.") ||
+                         Name.starts_with("avx2.psubus.") ||
+                         Name.starts_with("avx512.mask.psubus."))) {
       Rep = UpgradeX86BinaryIntrinsics(Builder, *CI, Intrinsic::usub_sat);
-    } else if (IsX86 && Name.startswith("avx512.mask.palignr.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.palignr.")) {
       Rep = UpgradeX86ALIGNIntrinsics(Builder, CI->getArgOperand(0),
                                       CI->getArgOperand(1),
                                       CI->getArgOperand(2),
                                       CI->getArgOperand(3),
                                       CI->getArgOperand(4),
                                       false);
-    } else if (IsX86 && Name.startswith("avx512.mask.valign.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.valign.")) {
       Rep = UpgradeX86ALIGNIntrinsics(Builder, CI->getArgOperand(0),
                                       CI->getArgOperand(1),
                                       CI->getArgOperand(2),
@@ -3016,10 +3016,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       Rep = UpgradeX86PSRLDQIntrinsics(Builder, CI->getArgOperand(0), Shift);
     } else if (IsX86 && (Name == "sse41.pblendw" ||
-                         Name.startswith("sse41.blendp") ||
-                         Name.startswith("avx.blend.p") ||
+                         Name.starts_with("sse41.blendp") ||
+                         Name.starts_with("avx.blend.p") ||
                          Name == "avx2.pblendw" ||
-                         Name.startswith("avx2.pblendd."))) {
+                         Name.starts_with("avx2.pblendd."))) {
       Value *Op0 = CI->getArgOperand(0);
       Value *Op1 = CI->getArgOperand(1);
       unsigned Imm = cast <ConstantInt>(CI->getArgOperand(2))->getZExtValue();
@@ -3031,9 +3031,9 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
         Idxs[i] = ((Imm >> (i%8)) & 1) ? i + NumElts : i;
 
       Rep = Builder.CreateShuffleVector(Op0, Op1, Idxs);
-    } else if (IsX86 && (Name.startswith("avx.vinsertf128.") ||
+    } else if (IsX86 && (Name.starts_with("avx.vinsertf128.") ||
                          Name == "avx2.vinserti128" ||
-                         Name.startswith("avx512.mask.insert"))) {
+                         Name.starts_with("avx512.mask.insert"))) {
       Value *Op0 = CI->getArgOperand(0);
       Value *Op1 = CI->getArgOperand(1);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
@@ -3077,9 +3077,9 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (CI->arg_size() == 5)
         Rep = EmitX86Select(Builder, CI->getArgOperand(4), Rep,
                             CI->getArgOperand(3));
-    } else if (IsX86 && (Name.startswith("avx.vextractf128.") ||
+    } else if (IsX86 && (Name.starts_with("avx.vextractf128.") ||
                          Name == "avx2.vextracti128" ||
-                         Name.startswith("avx512.mask.vextract"))) {
+                         Name.starts_with("avx512.mask.vextract"))) {
       Value *Op0 = CI->getArgOperand(0);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       unsigned DstNumElts =
@@ -3104,8 +3104,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                             CI->getArgOperand(2));
     } else if (!IsX86 && Name == "stackprotectorcheck") {
       Rep = nullptr;
-    } else if (IsX86 && (Name.startswith("avx512.mask.perm.df.") ||
-                         Name.startswith("avx512.mask.perm.di."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.perm.df.") ||
+                         Name.starts_with("avx512.mask.perm.di."))) {
       Value *Op0 = CI->getArgOperand(0);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       auto *VecTy = cast<FixedVectorType>(CI->getType());
@@ -3120,7 +3120,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (CI->arg_size() == 4)
         Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                             CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx.vperm2f128.") ||
+    } else if (IsX86 && (Name.starts_with("avx.vperm2f128.") ||
                          Name == "avx2.vperm2i128")) {
       // The immediate permute control byte looks like this:
       //    [1:0] - select 128 bits from sources for low half of destination
@@ -3156,10 +3156,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = Builder.CreateShuffleVector(V0, V1, ShuffleMask);
 
-    } else if (IsX86 && (Name.startswith("avx.vpermil.") ||
+    } else if (IsX86 && (Name.starts_with("avx.vpermil.") ||
                          Name == "sse2.pshuf.d" ||
-                         Name.startswith("avx512.mask.vpermil.p") ||
-                         Name.startswith("avx512.mask.pshuf.d."))) {
+                         Name.starts_with("avx512.mask.vpermil.p") ||
+                         Name.starts_with("avx512.mask.pshuf.d."))) {
       Value *Op0 = CI->getArgOperand(0);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       auto *VecTy = cast<FixedVectorType>(CI->getType());
@@ -3181,7 +3181,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
         Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                             CI->getArgOperand(2));
     } else if (IsX86 && (Name == "sse2.pshufl.w" ||
-                         Name.startswith("avx512.mask.pshufl.w."))) {
+                         Name.starts_with("avx512.mask.pshufl.w."))) {
       Value *Op0 = CI->getArgOperand(0);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       unsigned NumElts = cast<FixedVectorType>(CI->getType())->getNumElements();
@@ -3200,7 +3200,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
         Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                             CI->getArgOperand(2));
     } else if (IsX86 && (Name == "sse2.pshufh.w" ||
-                         Name.startswith("avx512.mask.pshufh.w."))) {
+                         Name.starts_with("avx512.mask.pshufh.w."))) {
       Value *Op0 = CI->getArgOperand(0);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       unsigned NumElts = cast<FixedVectorType>(CI->getType())->getNumElements();
@@ -3218,7 +3218,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (CI->arg_size() == 4)
         Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                             CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.shuf.p")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.shuf.p")) {
       Value *Op0 = CI->getArgOperand(0);
       Value *Op1 = CI->getArgOperand(1);
       unsigned Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
@@ -3243,15 +3243,15 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = EmitX86Select(Builder, CI->getArgOperand(4), Rep,
                           CI->getArgOperand(3));
-    } else if (IsX86 && (Name.startswith("avx512.mask.movddup") ||
-                         Name.startswith("avx512.mask.movshdup") ||
-                         Name.startswith("avx512.mask.movsldup"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.movddup") ||
+                         Name.starts_with("avx512.mask.movshdup") ||
+                         Name.starts_with("avx512.mask.movsldup"))) {
       Value *Op0 = CI->getArgOperand(0);
       unsigned NumElts = cast<FixedVectorType>(CI->getType())->getNumElements();
       unsigned NumLaneElts = 128/CI->getType()->getScalarSizeInBits();
 
       unsigned Offset = 0;
-      if (Name.startswith("avx512.mask.movshdup."))
+      if (Name.starts_with("avx512.mask.movshdup."))
         Offset = 1;
 
       SmallVector<int, 16> Idxs(NumElts);
@@ -3265,8 +3265,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                           CI->getArgOperand(1));
-    } else if (IsX86 && (Name.startswith("avx512.mask.punpckl") ||
-                         Name.startswith("avx512.mask.unpckl."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.punpckl") ||
+                         Name.starts_with("avx512.mask.unpckl."))) {
       Value *Op0 = CI->getArgOperand(0);
       Value *Op1 = CI->getArgOperand(1);
       int NumElts = cast<FixedVectorType>(CI->getType())->getNumElements();
@@ -3281,8 +3281,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.punpckh") ||
-                         Name.startswith("avx512.mask.unpckh."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.punpckh") ||
+                         Name.starts_with("avx512.mask.unpckh."))) {
       Value *Op0 = CI->getArgOperand(0);
       Value *Op1 = CI->getArgOperand(1);
       int NumElts = cast<FixedVectorType>(CI->getType())->getNumElements();
@@ -3297,8 +3297,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.and.") ||
-                         Name.startswith("avx512.mask.pand."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.and.") ||
+                         Name.starts_with("avx512.mask.pand."))) {
       VectorType *FTy = cast<VectorType>(CI->getType());
       VectorType *ITy = VectorType::getInteger(FTy);
       Rep = Builder.CreateAnd(Builder.CreateBitCast(CI->getArgOperand(0), ITy),
@@ -3306,8 +3306,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateBitCast(Rep, FTy);
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.andn.") ||
-                         Name.startswith("avx512.mask.pandn."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.andn.") ||
+                         Name.starts_with("avx512.mask.pandn."))) {
       VectorType *FTy = cast<VectorType>(CI->getType());
       VectorType *ITy = VectorType::getInteger(FTy);
       Rep = Builder.CreateNot(Builder.CreateBitCast(CI->getArgOperand(0), ITy));
@@ -3316,8 +3316,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateBitCast(Rep, FTy);
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.or.") ||
-                         Name.startswith("avx512.mask.por."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.or.") ||
+                         Name.starts_with("avx512.mask.por."))) {
       VectorType *FTy = cast<VectorType>(CI->getType());
       VectorType *ITy = VectorType::getInteger(FTy);
       Rep = Builder.CreateOr(Builder.CreateBitCast(CI->getArgOperand(0), ITy),
@@ -3325,8 +3325,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateBitCast(Rep, FTy);
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.xor.") ||
-                         Name.startswith("avx512.mask.pxor."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.xor.") ||
+                         Name.starts_with("avx512.mask.pxor."))) {
       VectorType *FTy = cast<VectorType>(CI->getType());
       VectorType *ITy = VectorType::getInteger(FTy);
       Rep = Builder.CreateXor(Builder.CreateBitCast(CI->getArgOperand(0), ITy),
@@ -3334,20 +3334,20 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Rep = Builder.CreateBitCast(Rep, FTy);
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.padd.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.padd.")) {
       Rep = Builder.CreateAdd(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.psub.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.psub.")) {
       Rep = Builder.CreateSub(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.pmull.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.pmull.")) {
       Rep = Builder.CreateMul(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.add.p")) {
-      if (Name.endswith(".512")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.add.p")) {
+      if (Name.ends_with(".512")) {
         Intrinsic::ID IID;
         if (Name[17] == 's')
           IID = Intrinsic::x86_avx512_add_ps_512;
@@ -3362,8 +3362,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.div.p")) {
-      if (Name.endswith(".512")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.div.p")) {
+      if (Name.ends_with(".512")) {
         Intrinsic::ID IID;
         if (Name[17] == 's')
           IID = Intrinsic::x86_avx512_div_ps_512;
@@ -3378,8 +3378,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.mul.p")) {
-      if (Name.endswith(".512")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.mul.p")) {
+      if (Name.ends_with(".512")) {
         Intrinsic::ID IID;
         if (Name[17] == 's')
           IID = Intrinsic::x86_avx512_mul_ps_512;
@@ -3394,8 +3394,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.sub.p")) {
-      if (Name.endswith(".512")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.sub.p")) {
+      if (Name.ends_with(".512")) {
         Intrinsic::ID IID;
         if (Name[17] == 's')
           IID = Intrinsic::x86_avx512_sub_ps_512;
@@ -3410,8 +3410,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.max.p") ||
-                         Name.startswith("avx512.mask.min.p")) &&
+    } else if (IsX86 && (Name.starts_with("avx512.mask.max.p") ||
+                         Name.starts_with("avx512.mask.min.p")) &&
                Name.drop_front(18) == ".512") {
       bool IsDouble = Name[17] == 'd';
       bool IsMin = Name[13] == 'i';
@@ -3426,14 +3426,14 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                  CI->getArgOperand(4) });
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name.startswith("avx512.mask.lzcnt.")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.lzcnt.")) {
       Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(),
                                                          Intrinsic::ctlz,
                                                          CI->getType()),
                                { CI->getArgOperand(0), Builder.getInt1(false) });
       Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
                           CI->getArgOperand(1));
-    } else if (IsX86 && Name.startswith("avx512.mask.psll")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.psll")) {
       bool IsImmediate = Name[16] == 'i' ||
                          (Name.size() > 18 && Name[18] == 'i');
       bool IsVariable = Name[16] == 'v';
@@ -3460,7 +3460,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
           IID = Intrinsic::x86_avx512_psllv_w_512;
         else
           llvm_unreachable("Unexpected size");
-      } else if (Name.endswith(".128")) {
+      } else if (Name.ends_with(".128")) {
         if (Size == 'd') // avx512.mask.psll.d.128, avx512.mask.psll.di.128
           IID = IsImmediate ? Intrinsic::x86_sse2_pslli_d
                             : Intrinsic::x86_sse2_psll_d;
@@ -3472,7 +3472,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                             : Intrinsic::x86_sse2_psll_w;
         else
           llvm_unreachable("Unexpected size");
-      } else if (Name.endswith(".256")) {
+      } else if (Name.ends_with(".256")) {
         if (Size == 'd') // avx512.mask.psll.d.256, avx512.mask.psll.di.256
           IID = IsImmediate ? Intrinsic::x86_avx2_pslli_d
                             : Intrinsic::x86_avx2_psll_d;
@@ -3501,7 +3501,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
 
       Rep = UpgradeX86MaskedShift(Builder, *CI, IID);
-    } else if (IsX86 && Name.startswith("avx512.mask.psrl")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.psrl")) {
       bool IsImmediate = Name[16] == 'i' ||
                          (Name.size() > 18 && Name[18] == 'i');
       bool IsVariable = Name[16] == 'v';
@@ -3528,7 +3528,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
           IID = Intrinsic::x86_avx512_psrlv_w_512;
         else
           llvm_unreachable("Unexpected size");
-      } else if (Name.endswith(".128")) {
+      } else if (Name.ends_with(".128")) {
         if (Size == 'd') // avx512.mask.psrl.d.128, avx512.mask.psrl.di.128
           IID = IsImmediate ? Intrinsic::x86_sse2_psrli_d
                             : Intrinsic::x86_sse2_psrl_d;
@@ -3540,7 +3540,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                             : Intrinsic::x86_sse2_psrl_w;
         else
           llvm_unreachable("Unexpected size");
-      } else if (Name.endswith(".256")) {
+      } else if (Name.ends_with(".256")) {
         if (Size == 'd') // avx512.mask.psrl.d.256, avx512.mask.psrl.di.256
           IID = IsImmediate ? Intrinsic::x86_avx2_psrli_d
                             : Intrinsic::x86_avx2_psrl_d;
@@ -3569,7 +3569,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
 
       Rep = UpgradeX86MaskedShift(Builder, *CI, IID);
-    } else if (IsX86 && Name.startswith("avx512.mask.psra")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.psra")) {
       bool IsImmediate = Name[16] == 'i' ||
                          (Name.size() > 18 && Name[18] == 'i');
       bool IsVariable = Name[16] == 'v';
@@ -3592,7 +3592,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
           IID = Intrinsic::x86_avx512_psrav_w_512;
         else
           llvm_unreachable("Unexpected size");
-      } else if (Name.endswith(".128")) {
+      } else if (Name.ends_with(".128")) {
         if (Size == 'd') // avx512.mask.psra.d.128, avx512.mask.psra.di.128
           IID = IsImmediate ? Intrinsic::x86_sse2_psrai_d
                             : Intrinsic::x86_sse2_psra_d;
@@ -3605,7 +3605,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                             : Intrinsic::x86_sse2_psra_w;
         else
           llvm_unreachable("Unexpected size");
-      } else if (Name.endswith(".256")) {
+      } else if (Name.ends_with(".256")) {
         if (Size == 'd') // avx512.mask.psra.d.256, avx512.mask.psra.di.256
           IID = IsImmediate ? Intrinsic::x86_avx2_psrai_d
                             : Intrinsic::x86_avx2_psra_d;
@@ -3635,11 +3635,11 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       }
 
       Rep = UpgradeX86MaskedShift(Builder, *CI, IID);
-    } else if (IsX86 && Name.startswith("avx512.mask.move.s")) {
+    } else if (IsX86 && Name.starts_with("avx512.mask.move.s")) {
       Rep = upgradeMaskedMove(Builder, *CI);
-    } else if (IsX86 && Name.startswith("avx512.cvtmask2")) {
+    } else if (IsX86 && Name.starts_with("avx512.cvtmask2")) {
       Rep = UpgradeMaskToInt(Builder, *CI);
-    } else if (IsX86 && Name.endswith(".movntdqa")) {
+    } else if (IsX86 && Name.ends_with(".movntdqa")) {
       MDNode *Node = MDNode::get(
           C, ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
 
@@ -3653,10 +3653,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
           Align(CI->getType()->getPrimitiveSizeInBits().getFixedValue() / 8));
       LI->setMetadata(LLVMContext::MD_nontemporal, Node);
       Rep = LI;
-    } else if (IsX86 && (Name.startswith("fma.vfmadd.") ||
-                         Name.startswith("fma.vfmsub.") ||
-                         Name.startswith("fma.vfnmadd.") ||
-                         Name.startswith("fma.vfnmsub."))) {
+    } else if (IsX86 && (Name.starts_with("fma.vfmadd.") ||
+                         Name.starts_with("fma.vfmsub.") ||
+                         Name.starts_with("fma.vfnmadd.") ||
+                         Name.starts_with("fma.vfnmsub."))) {
       bool NegMul = Name[6] == 'n';
       bool NegAcc = NegMul ? Name[8] == 's' : Name[7] == 's';
       bool IsScalar = NegMul ? Name[12] == 's' : Name[11] == 's';
@@ -3685,7 +3685,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       if (IsScalar)
         Rep = Builder.CreateInsertElement(CI->getArgOperand(0), Rep,
                                           (uint64_t)0);
-    } else if (IsX86 && Name.startswith("fma4.vfmadd.s")) {
+    } else if (IsX86 && Name.starts_with("fma4.vfmadd.s")) {
       Value *Ops[] = { CI->getArgOperand(0), CI->getArgOperand(1),
                        CI->getArgOperand(2) };
 
@@ -3700,11 +3700,11 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       Rep = Builder.CreateInsertElement(Constant::getNullValue(CI->getType()),
                                         Rep, (uint64_t)0);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vfmadd.s") ||
-                         Name.startswith("avx512.maskz.vfmadd.s") ||
-                         Name.startswith("avx512.mask3.vfmadd.s") ||
-                         Name.startswith("avx512.mask3.vfmsub.s") ||
-                         Name.startswith("avx512.mask3.vfnmsub.s"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vfmadd.s") ||
+                         Name.starts_with("avx512.maskz.vfmadd.s") ||
+                         Name.starts_with("avx512.mask3.vfmadd.s") ||
+                         Name.starts_with("avx512.mask3.vfmsub.s") ||
+                         Name.starts_with("avx512.mask3.vfnmsub.s"))) {
       bool IsMask3 = Name[11] == '3';
       bool IsMaskZ = Name[11] == 'z';
       // Drop the "avx512.mask." to make it easier.
@@ -3758,13 +3758,13 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                 Rep, PassThru);
       Rep = Builder.CreateInsertElement(CI->getArgOperand(IsMask3 ? 2 : 0),
                                         Rep, (uint64_t)0);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vfmadd.p") ||
-                         Name.startswith("avx512.mask.vfnmadd.p") ||
-                         Name.startswith("avx512.mask.vfnmsub.p") ||
-                         Name.startswith("avx512.mask3.vfmadd.p") ||
-                         Name.startswith("avx512.mask3.vfmsub.p") ||
-                         Name.startswith("avx512.mask3.vfnmsub.p") ||
-                         Name.startswith("avx512.maskz.vfmadd.p"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vfmadd.p") ||
+                         Name.starts_with("avx512.mask.vfnmadd.p") ||
+                         Name.starts_with("avx512.mask.vfnmsub.p") ||
+                         Name.starts_with("avx512.mask3.vfmadd.p") ||
+                         Name.starts_with("avx512.mask3.vfmsub.p") ||
+                         Name.starts_with("avx512.mask3.vfnmsub.p") ||
+                         Name.starts_with("avx512.maskz.vfmadd.p"))) {
       bool IsMask3 = Name[11] == '3';
       bool IsMaskZ = Name[11] == 'z';
       // Drop the "avx512.mask." to make it easier.
@@ -3807,7 +3807,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                   CI->getArgOperand(0);
 
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, PassThru);
-    } else if (IsX86 &&  Name.startswith("fma.vfmsubadd.p")) {
+    } else if (IsX86 &&  Name.starts_with("fma.vfmsubadd.p")) {
       unsigned VecWidth = CI->getType()->getPrimitiveSizeInBits();
       unsigned EltWidth = CI->getType()->getScalarSizeInBits();
       Intrinsic::ID IID;
@@ -3827,10 +3827,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Ops[2] = Builder.CreateFNeg(Ops[2]);
       Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(), IID),
                                Ops);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vfmaddsub.p") ||
-                         Name.startswith("avx512.mask3.vfmaddsub.p") ||
-                         Name.startswith("avx512.maskz.vfmaddsub.p") ||
-                         Name.startswith("avx512.mask3.vfmsubadd.p"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vfmaddsub.p") ||
+                         Name.starts_with("avx512.mask3.vfmaddsub.p") ||
+                         Name.starts_with("avx512.maskz.vfmaddsub.p") ||
+                         Name.starts_with("avx512.mask3.vfmsubadd.p"))) {
       bool IsMask3 = Name[11] == '3';
       bool IsMaskZ = Name[11] == 'z';
       // Drop the "avx512.mask." to make it easier.
@@ -3878,8 +3878,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                                   CI->getArgOperand(0);
 
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, PassThru);
-    } else if (IsX86 && (Name.startswith("avx512.mask.pternlog.") ||
-                         Name.startswith("avx512.maskz.pternlog."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.pternlog.") ||
+                         Name.starts_with("avx512.maskz.pternlog."))) {
       bool ZeroMask = Name[11] == 'z';
       unsigned VecWidth = CI->getType()->getPrimitiveSizeInBits();
       unsigned EltWidth = CI->getType()->getScalarSizeInBits();
@@ -3906,8 +3906,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Value *PassThru = ZeroMask ? ConstantAggregateZero::get(CI->getType())
                                  : CI->getArgOperand(0);
       Rep = EmitX86Select(Builder, CI->getArgOperand(4), Rep, PassThru);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vpmadd52") ||
-                         Name.startswith("avx512.maskz.vpmadd52"))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vpmadd52") ||
+                         Name.starts_with("avx512.maskz.vpmadd52"))) {
       bool ZeroMask = Name[11] == 'z';
       bool High = Name[20] == 'h' || Name[21] == 'h';
       unsigned VecWidth = CI->getType()->getPrimitiveSizeInBits();
@@ -3934,16 +3934,16 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Value *PassThru = ZeroMask ? ConstantAggregateZero::get(CI->getType())
                                  : CI->getArgOperand(0);
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, PassThru);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vpermi2var.") ||
-                         Name.startswith("avx512.mask.vpermt2var.") ||
-                         Name.startswith("avx512.maskz.vpermt2var."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vpermi2var.") ||
+                         Name.starts_with("avx512.mask.vpermt2var.") ||
+                         Name.starts_with("avx512.maskz.vpermt2var."))) {
       bool ZeroMask = Name[11] == 'z';
       bool IndexForm = Name[17] == 'i';
       Rep = UpgradeX86VPERMT2Intrinsics(Builder, *CI, ZeroMask, IndexForm);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vpdpbusd.") ||
-                         Name.startswith("avx512.maskz.vpdpbusd.") ||
-                         Name.startswith("avx512.mask.vpdpbusds.") ||
-                         Name.startswith("avx512.maskz.vpdpbusds."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vpdpbusd.") ||
+                         Name.starts_with("avx512.maskz.vpdpbusd.") ||
+                         Name.starts_with("avx512.mask.vpdpbusds.") ||
+                         Name.starts_with("avx512.maskz.vpdpbusds."))) {
       bool ZeroMask = Name[11] == 'z';
       bool IsSaturating = Name[ZeroMask ? 21 : 20] == 's';
       unsigned VecWidth = CI->getType()->getPrimitiveSizeInBits();
@@ -3970,10 +3970,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Value *PassThru = ZeroMask ? ConstantAggregateZero::get(CI->getType())
                                  : CI->getArgOperand(0);
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, PassThru);
-    } else if (IsX86 && (Name.startswith("avx512.mask.vpdpwssd.") ||
-                         Name.startswith("avx512.maskz.vpdpwssd.") ||
-                         Name.startswith("avx512.mask.vpdpwssds.") ||
-                         Name.startswith("avx512.maskz.vpdpwssds."))) {
+    } else if (IsX86 && (Name.starts_with("avx512.mask.vpdpwssd.") ||
+                         Name.starts_with("avx512.maskz.vpdpwssd.") ||
+                         Name.starts_with("avx512.mask.vpdpwssds.") ||
+                         Name.starts_with("avx512.maskz.vpdpwssds."))) {
       bool ZeroMask = Name[11] == 'z';
       bool IsSaturating = Name[ZeroMask ? 21 : 20] == 's';
       unsigned VecWidth = CI->getType()->getPrimitiveSizeInBits();
@@ -4033,7 +4033,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
       CI->replaceAllUsesWith(CF);
       Rep = nullptr;
-    } else if (IsX86 && Name.startswith("avx512.mask.") &&
+    } else if (IsX86 && Name.starts_with("avx512.mask.") &&
                upgradeAVX512MaskToSelect(Name, Builder, *CI, Rep)) {
       // Rep will be updated by the call in the condition.
     } else if (IsNVVM && (Name == "abs.i" || Name == "abs.ll")) {
@@ -4042,8 +4042,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Value *Cmp = Builder.CreateICmpSGE(
           Arg, llvm::Constant::getNullValue(Arg->getType()), "abs.cond");
       Rep = Builder.CreateSelect(Cmp, Arg, Neg, "abs");
-    } else if (IsNVVM && (Name.startswith("atomic.load.add.f32.p") ||
-                          Name.startswith("atomic.load.add.f64.p"))) {
+    } else if (IsNVVM && (Name.starts_with("atomic.load.add.f32.p") ||
+                          Name.starts_with("atomic.load.add.f64.p"))) {
       Value *Ptr = CI->getArgOperand(0);
       Value *Val = CI->getArgOperand(1);
       Rep = Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, Ptr, Val, MaybeAlign(),
@@ -4052,7 +4052,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                           Name == "max.ui" || Name == "max.ull")) {
       Value *Arg0 = CI->getArgOperand(0);
       Value *Arg1 = CI->getArgOperand(1);
-      Value *Cmp = Name.endswith(".ui") || Name.endswith(".ull")
+      Value *Cmp = Name.ends_with(".ui") || Name.ends_with(".ull")
                        ? Builder.CreateICmpUGE(Arg0, Arg1, "max.cond")
                        : Builder.CreateICmpSGE(Arg0, Arg1, "max.cond");
       Rep = Builder.CreateSelect(Cmp, Arg0, Arg1, "max");
@@ -4060,7 +4060,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
                           Name == "min.ui" || Name == "min.ull")) {
       Value *Arg0 = CI->getArgOperand(0);
       Value *Arg1 = CI->getArgOperand(1);
-      Value *Cmp = Name.endswith(".ui") || Name.endswith(".ull")
+      Value *Cmp = Name.ends_with(".ui") || Name.ends_with(".ull")
                        ? Builder.CreateICmpULE(Arg0, Arg1, "min.cond")
                        : Builder.CreateICmpSLE(Arg0, Arg1, "min.cond");
       Rep = Builder.CreateSelect(Cmp, Arg0, Arg1, "min");
@@ -4221,7 +4221,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
   case Intrinsic::vector_extract: {
     StringRef Name = F->getName();
     Name = Name.substr(5); // Strip llvm
-    if (!Name.startswith("aarch64.sve.tuple.get")) {
+    if (!Name.starts_with("aarch64.sve.tuple.get")) {
       DefaultCase();
       return;
     }
@@ -4237,11 +4237,11 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
   case Intrinsic::vector_insert: {
     StringRef Name = F->getName();
     Name = Name.substr(5);
-    if (!Name.startswith("aarch64.sve.tuple")) {
+    if (!Name.starts_with("aarch64.sve.tuple")) {
       DefaultCase();
       return;
     }
-    if (Name.startswith("aarch64.sve.tuple.set")) {
+    if (Name.starts_with("aarch64.sve.tuple.set")) {
       unsigned I = dyn_cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
       ScalableVectorType *Ty =
           dyn_cast<ScalableVectorType>(CI->getArgOperand(2)->getType());
@@ -4251,7 +4251,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
           NewFn, {CI->getArgOperand(0), CI->getArgOperand(2), NewIdx});
       break;
     }
-    if (Name.startswith("aarch64.sve.tuple.create")) {
+    if (Name.starts_with("aarch64.sve.tuple.create")) {
       unsigned N = StringSwitch<unsigned>(Name)
                        .StartsWith("aarch64.sve.tuple.create2", 2)
                        .StartsWith("aarch64.sve.tuple.create3", 3)
@@ -4330,7 +4330,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
     StringRef Name = F->getName();
     Name = Name.substr(5); // Strip llvm.
     // Upgrade `dbg.addr` to `dbg.value` with `DW_OP_deref`.
-    if (Name.startswith("dbg.addr")) {
+    if (Name.starts_with("dbg.addr")) {
       DIExpression *Expr = cast<DIExpression>(
           cast<MetadataAsValue>(CI->getArgOperand(2))->getMetadata());
       Expr = DIExpression::append(Expr, dwarf::DW_OP_deref);
@@ -4936,7 +4936,7 @@ bool llvm::UpgradeModuleFlags(Module &M) {
     // Upgrade branch protection and return address signing module flags. The
     // module flag behavior for these fields were Error and now they are Min.
     if (ID->getString() == "branch-target-enforcement" ||
-        ID->getString().startswith("sign-return-address")) {
+        ID->getString().starts_with("sign-return-address")) {
       if (auto *Behavior =
               mdconst::dyn_extract_or_null<ConstantInt>(Op->getOperand(0))) {
         if (Behavior->getLimitedValue() == Module::Error) {
@@ -5039,7 +5039,7 @@ void llvm::UpgradeSectionAttributes(Module &M) {
 
     StringRef Section = GV.getSection();
 
-    if (!Section.startswith("__DATA, __objc_catlist"))
+    if (!Section.starts_with("__DATA, __objc_catlist"))
       continue;
 
     // __DATA, __objc_catlist, regular, no_dead_strip
@@ -5099,12 +5099,12 @@ static bool isOldLoopArgument(Metadata *MD) {
   auto *S = dyn_cast_or_null<MDString>(T->getOperand(0));
   if (!S)
     return false;
-  return S->getString().startswith("llvm.vectorizer.");
+  return S->getString().starts_with("llvm.vectorizer.");
 }
 
 static MDString *upgradeLoopTag(LLVMContext &C, StringRef OldTag) {
   StringRef OldPrefix = "llvm.vectorizer.";
-  assert(OldTag.startswith(OldPrefix) && "Expected old prefix");
+  assert(OldTag.starts_with(OldPrefix) && "Expected old prefix");
 
   if (OldTag == "llvm.vectorizer.unroll")
     return MDString::get(C, "llvm.loop.interleave.count");
@@ -5123,7 +5123,7 @@ static Metadata *upgradeLoopArgument(Metadata *MD) {
   auto *OldTag = dyn_cast_or_null<MDString>(T->getOperand(0));
   if (!OldTag)
     return MD;
-  if (!OldTag->getString().startswith("llvm.vectorizer."))
+  if (!OldTag->getString().starts_with("llvm.vectorizer."))
     return MD;
 
   // This has an old tag.  Upgrade it.
@@ -5157,7 +5157,7 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
   // The only data layout upgrades needed for pre-GCN are setting the address
   // space of globals to 1.
   if (T.isAMDGPU() && !T.isAMDGCN() && !DL.contains("-G") &&
-      !DL.startswith("G")) {
+      !DL.starts_with("G")) {
     return DL.empty() ? std::string("G1") : (DL + "-G1").str();
   }
 
@@ -5179,7 +5179,7 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
     // Add missing non-integral declarations.
     // This goes before adding new address spaces to prevent incoherent string
     // values.
-    if (!DL.contains("-ni") && !DL.startswith("ni"))
+    if (!DL.contains("-ni") && !DL.starts_with("ni"))
       Res.append("-ni:7:8");
     // Update ni:7 to ni:7:8.
     if (DL.ends_with("ni:7"))
@@ -5187,9 +5187,9 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
 
     // Add sizing for address spaces 7 and 8 (fat raw buffers and buffer
     // resources) An empty data layout has already been upgraded to G1 by now.
-    if (!DL.contains("-p7") && !DL.startswith("p7"))
+    if (!DL.contains("-p7") && !DL.starts_with("p7"))
       Res.append("-p7:160:256:256:32");
-    if (!DL.contains("-p8") && !DL.startswith("p8"))
+    if (!DL.contains("-p8") && !DL.starts_with("p8"))
       Res.append("-p8:128:128");
 
     return Res;


        


More information about the llvm-commits mailing list