[llvm] f8a77f3 - Hexagon: Add runtime libcall entries for volatile memcpy call (#156561)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 5 17:53:17 PDT 2025
Author: Matt Arsenault
Date: 2025-09-06T00:53:13Z
New Revision: f8a77f32ff2989ff8142faab9f0a7c8395b0c4ce
URL: https://github.com/llvm/llvm-project/commit/f8a77f32ff2989ff8142faab9f0a7c8395b0c4ce
DIFF: https://github.com/llvm/llvm-project/commit/f8a77f32ff2989ff8142faab9f0a7c8395b0c4ce.diff
LOG: Hexagon: Add runtime libcall entries for volatile memcpy call (#156561)
This pass currently doesn't have TargetLoweringInfo, but technically
it should verify the call is available from a future RuntimeLibcallsInfo
analysis.
Added:
Modified:
llvm/include/llvm/IR/RuntimeLibcalls.td
llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 24ea92cc6865d..c909ec6c660b7 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -446,6 +446,7 @@ def AEABI_MEMCLR8 : RuntimeLibcall;
// Hexagon calls
def HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES : RuntimeLibcall;
+def HEXAGON_VOLATILE_MEMCPY : RuntimeLibcall;
// XCore calls
def MEMCPY_ALIGN_4 : RuntimeLibcall;
@@ -1875,6 +1876,8 @@ def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<FAST_SQRT_F64>;
def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
: RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
+
+def hexagon_memcpy_forward_vp4cp4n2 : RuntimeLibcallImpl<HEXAGON_VOLATILE_MEMCPY>;
}
def isHexagon : RuntimeLibcallPredicate<"TT.getArch() == Triple::hexagon">;
diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
index 72575f2560a34..1057b88530f40 100644
--- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
@@ -42,6 +42,7 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/PatternMatch.h"
+#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
@@ -104,9 +105,6 @@ static cl::opt<bool> HexagonVolatileMemcpy(
static cl::opt<unsigned> SimplifyLimit("hlir-simplify-limit", cl::init(10000),
cl::Hidden, cl::desc("Maximum number of simplification steps in HLIR"));
-static const char *HexagonVolatileMemcpyName
- = "hexagon_memcpy_forward_vp4cp4n2";
-
namespace {
class HexagonLoopIdiomRecognize {
@@ -2246,6 +2244,11 @@ bool HexagonLoopIdiomRecognize::processCopyingStore(Loop *CurLoop,
Type *PtrTy = PointerType::get(Ctx, 0);
Type *VoidTy = Type::getVoidTy(Ctx);
Module *M = Func->getParent();
+
+ // FIXME: This should check if the call is supported
+ StringRef HexagonVolatileMemcpyName =
+ RTLIB::RuntimeLibcallsInfo::getLibcallImplName(
+ RTLIB::impl_hexagon_memcpy_forward_vp4cp4n2);
FunctionCallee Fn = M->getOrInsertFunction(
HexagonVolatileMemcpyName, VoidTy, PtrTy, PtrTy, Int32Ty);
More information about the llvm-commits
mailing list