[clang] [CodeGen] Remove extraneous ArrayRef (NFC) (PR #96085)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 08:46:34 PDT 2024


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

ArrayRef can infer the size of a C array.  Also, C arrays can be
implicitly cast to ArrayRef.

>From 62c24545350105e24a5be6334fe7c8075c2a633d Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 19 Jun 2024 08:43:00 -0700
Subject: [PATCH] [CodeGen] Remove extraneous ArrayRef (NFC)

ArrayRef can infer the size of a C array.  Also, C arrays can be
implicitly cast to ArrayRef.
---
 clang/lib/CodeGen/CodeGenPGO.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 2839697614595..f2cdeb5796d3a 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -1200,15 +1200,14 @@ void CodeGenPGO::emitCounterSetOrIncrement(CGBuilderTy &Builder, const Stmt *S,
 
   if (llvm::EnableSingleByteCoverage)
     Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::instrprof_cover),
-                       ArrayRef(Args, 4));
+                       Args);
   else {
     if (!StepV)
       Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::instrprof_increment),
-                         ArrayRef(Args, 4));
+                         Args);
     else
       Builder.CreateCall(
-          CGM.getIntrinsic(llvm::Intrinsic::instrprof_increment_step),
-          ArrayRef(Args));
+          CGM.getIntrinsic(llvm::Intrinsic::instrprof_increment_step), Args);
   }
 }
 



More information about the cfe-commits mailing list