mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-05 11:17:53 +00:00
Add an option to the LTO code generator to disable vectorization during LTO
We used to always vectorize (slp and loop vectorize) in the LTO pass pipeline. r220345 changed it so that we used the PassManager's fields 'LoopVectorize' and 'SLPVectorize' out of the desire to be able to disable vectorization using the cl::opt flags 'vectorize-loops'/'slp-vectorize' which the before mentioned fields default to. Unfortunately, this turns off vectorization because those fields default to false. This commit adds flags to the LTO library to disable lto vectorization which reconciles the desire to optionally disable vectorization during LTO and the desired behavior of defaulting to enabled vectorization. We really want tools to set PassManager flags directly to enable/disable vectorization and not go the route via cl::opt flags *in* PassManagerBuilder.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -188,6 +188,7 @@ bool LTOCodeGenerator::compile_to_file(const char** name,
|
||||
bool disableOpt,
|
||||
bool disableInline,
|
||||
bool disableGVNLoadPRE,
|
||||
bool disableVectorization,
|
||||
std::string& errMsg) {
|
||||
// make unique temp .o file to put generated object file
|
||||
SmallString<128> Filename;
|
||||
@@ -202,8 +203,9 @@ bool LTOCodeGenerator::compile_to_file(const char** name,
|
||||
// generate object file
|
||||
tool_output_file objFile(Filename.c_str(), FD);
|
||||
|
||||
bool genResult = generateObjectFile(objFile.os(), disableOpt, disableInline,
|
||||
disableGVNLoadPRE, errMsg);
|
||||
bool genResult =
|
||||
generateObjectFile(objFile.os(), disableOpt, disableInline,
|
||||
disableGVNLoadPRE, disableVectorization, errMsg);
|
||||
objFile.os().close();
|
||||
if (objFile.os().has_error()) {
|
||||
objFile.os().clear_error();
|
||||
@@ -226,10 +228,11 @@ const void* LTOCodeGenerator::compile(size_t* length,
|
||||
bool disableOpt,
|
||||
bool disableInline,
|
||||
bool disableGVNLoadPRE,
|
||||
bool disableVectorization,
|
||||
std::string& errMsg) {
|
||||
const char *name;
|
||||
if (!compile_to_file(&name, disableOpt, disableInline, disableGVNLoadPRE,
|
||||
errMsg))
|
||||
disableVectorization, errMsg))
|
||||
return nullptr;
|
||||
|
||||
// read .o file into memory buffer
|
||||
@@ -441,6 +444,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||
bool DisableOpt,
|
||||
bool DisableInline,
|
||||
bool DisableGVNLoadPRE,
|
||||
bool DisableVectorization,
|
||||
std::string &errMsg) {
|
||||
if (!this->determineTarget(errMsg))
|
||||
return false;
|
||||
@@ -459,6 +463,8 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||
Triple TargetTriple(TargetMach->getTargetTriple());
|
||||
PassManagerBuilder PMB;
|
||||
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
|
||||
PMB.LoopVectorize = !DisableVectorization;
|
||||
PMB.SLPVectorize = !DisableVectorization;
|
||||
if (!DisableInline)
|
||||
PMB.Inliner = createFunctionInliningPass();
|
||||
PMB.LibraryInfo = new TargetLibraryInfo(TargetTriple);
|
||||
|
Reference in New Issue
Block a user