Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/include/llvm/IR/RuntimeLibcalls.td
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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">;
Expand Down
9 changes: 6 additions & 3 deletions llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down