30#define DEBUG_TYPE "nvptx"
49 static const unsigned MaxAggrCopySize = 128;
52 return "Lower aggregate copies/intrinsics into loops";
56char NVPTXLowerAggrCopies::ID = 0;
58bool NVPTXLowerAggrCopies::runOnFunction(
Function &
F) {
65 getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
74 if (
DL.getTypeStoreSize(LI->getType()) < MaxAggrCopySize)
78 if (
SI->getOperand(0) != LI)
86 if (LenCI->getZExtValue() >= MaxAggrCopySize) {
96 if (AggrLoads.
size() == 0 && MemCalls.
size() == 0) {
105 Value *SrcAddr = LI->getOperand(0);
106 Value *DstAddr =
SI->getOperand(1);
107 unsigned NumLoads =
DL.getTypeStoreSize(LI->getType());
120 SI->eraseFromParent();
121 LI->eraseFromParent();
133 MemCall->eraseFromParent();
142 "Lower aggregate copies, and llvm.mem* intrinsics into loops",
146 return new NVPTXLowerAggrCopies();
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool runOnFunction(Function &F, bool PostInlining)
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM Basic Block Representation.
This is the shared class of boolean and integer constants.
A parsed version of the target data layout string in and methods for querying it.
FunctionPass class - This class is used to implement most global optimizations.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
This class wraps the llvm.memcpy intrinsic.
This is the common base class for memset/memcpy/memmove.
This class wraps the llvm.memmove intrinsic.
This class wraps the llvm.memset and llvm.memset.inline intrinsics.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVM Value Representation.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr, Value *DstAddr, ConstantInt *CopyLen, Align SrcAlign, Align DestAlign, bool SrcIsVolatile, bool DstIsVolatile, bool CanOverlap, const TargetTransformInfo &TTI, std::optional< uint32_t > AtomicCpySize=std::nullopt)
Emit a loop implementing the semantics of an llvm.memcpy whose size is a compile time constant.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI bool expandMemMoveAsLoop(MemMoveInst *MemMove, const TargetTransformInfo &TTI)
Expand MemMove as a loop.
FunctionPass * createLowerAggrCopies()
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE=nullptr)
Expand MemCpy as a loop. MemCpy is not deleted.
LLVM_ABI void expandMemSetAsLoop(MemSetInst *MemSet)
Expand MemSet as a loop. MemSet is not deleted.