Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Sep 3, 2025

This pass currently doesn't have TargetLoweringInfo, but technically
it should verify the call is available from a future RuntimeLibcallsInfo
analysis.

Copy link
Contributor Author

arsenm commented Sep 3, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm marked this pull request as ready for review September 3, 2025 01:11
@llvmbot
Copy link
Member

llvmbot commented Sep 3, 2025

@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-hexagon

Author: Matt Arsenault (arsenm)

Changes

This pass currently doesn't have TargetLoweringInfo, but technically
it should verify the call is available from a future RuntimeLibcallsInfo
analysis.


Full diff: https://github.com/llvm/llvm-project/pull/156561.diff

2 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+3)
  • (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+6)
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..c6e643f9ea40f 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"
@@ -2246,6 +2247,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 =
+          RuntimeLibcallsInfo::getLibcallImplName(
+              RTLIB::impl_hexagon_memcpy_forward_vp4cp4n2);
       FunctionCallee Fn = M->getOrInsertFunction(
           HexagonVolatileMemcpyName, VoidTy, PtrTy, PtrTy, Int32Ty);
 

@androm3da
Copy link
Member

@iajbar can you help w/this pull req?

@arsenm arsenm force-pushed the users/arsenm/hexagon/add-runtime-libcall-entries-volatile-memcpy branch from d14d840 to 867cbd4 Compare September 4, 2025 23:09
@llvmbot llvmbot added the llvm:ir label Sep 4, 2025
Copy link
Contributor

@aankit-ca aankit-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @arsenm

This pass currently doesn't have TargetLoweringInfo, but technically
it should verify the call is available from a future RuntimeLibcallsInfo
analysis.
@arsenm arsenm force-pushed the users/arsenm/hexagon/add-runtime-libcall-entries-volatile-memcpy branch from 867cbd4 to 25a4489 Compare September 6, 2025 00:20
@arsenm arsenm enabled auto-merge (squash) September 6, 2025 00:23
@arsenm arsenm merged commit f8a77f3 into main Sep 6, 2025
9 checks passed
@arsenm arsenm deleted the users/arsenm/hexagon/add-runtime-libcall-entries-volatile-memcpy branch September 6, 2025 00:53
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 6, 2025

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu-dwarf5 running on doug-worker-1b while building llvm at step 6 "test-build-unified-tree-check-cross-project".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/163/builds/26035

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-cross-project) failure: test (failure)
******************** TEST 'cross-project-tests :: debuginfo-tests/dexter-tests/memvars/unused-merged-value.c' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
unused-merged-value.c: nan/nan (nan) [Command '['/usr/bin/python3.10', '/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dex/../dexter.py', 'run-debugger-internal-', '/tmp/lit-tmp-uvah_6dr/dexter/tmpb9bjyy6p/tmpjpcjsm0f', '--working-directory=/tmp/lit-tmp-uvah_6dr/dexter/tmpb9bjyy6p', '--unittest=off', '--indent-timer-level=3']' returned non-zero exit status 1.]


--
Command Output (stderr):
--
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang -std=gnu11 -O3 -glldb /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/unused-merged-value.c -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/memvars/Output/unused-merged-value.c.tmp # RUN: at line 8
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang -std=gnu11 -O3 -glldb /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/unused-merged-value.c -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/memvars/Output/unused-merged-value.c.tmp
"/usr/bin/python3.10" "/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py" test --fail-lt 0.1 -w --lldb-executable "/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/lldb-dap" --debugger lldb-dap --binary /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/memvars/Output/unused-merged-value.c.tmp -- /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/unused-merged-value.c # RUN: at line 9
+ /usr/bin/python3.10 /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py test --fail-lt 0.1 -w --lldb-executable /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/lldb-dap --debugger lldb-dap --binary /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/memvars/Output/unused-merged-value.c.tmp -- /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/unused-merged-value.c


****************************************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants