Newer
Older
RepeatInstruction = processMemMove(M);
else if (CallSite CS = (Value*)I) {
for (unsigned i = 0, e = CS.arg_size(); i != e; ++i)
Nick Lewycky
committed
if (CS.isByValArgument(i))
MadeChange |= processByValArgument(CS, i);
}
// Reprocess the instruction if desired.
if (RepeatInstruction) {
Chris Lattner
committed
if (BI != BB->begin()) --BI;
MadeChange = true;
Owen Anderson
committed
}
}
Owen Anderson
committed
}
// MemCpyOpt::runOnFunction - This is the main transformation entry point for a
// function.
//
bool MemCpyOpt::runOnFunction(Function &F) {
if (skipOptnoneFunction(F))
return false;
bool MadeChange = false;
MD = &getAnalysis<MemoryDependenceAnalysis>();
DL = getAnalysisIfAvailable<DataLayout>();
TLI = &getAnalysis<TargetLibraryInfo>();
// If we don't have at least memset and memcpy, there is little point of doing
// anything here. These are required by a freestanding implementation, so if
// even they are disabled, there is no point in trying hard.
if (!TLI->has(LibFunc::memset) || !TLI->has(LibFunc::memcpy))
return false;
while (1) {
if (!iterateOnFunction(F))
break;
MadeChange = true;
}
return MadeChange;
}