Fix mainutils win32 (#239)

* Detect llvm-project commit change in utils/clone-mlir.sh and rebuild llvm-project
for zLinux Jenkins build bot

* Fix MainUtils.cpp compilation on Windows

* Fix clang-format

* Update comments on Windows not to delete the constant pack object file
This commit is contained in:
gongsu832 2020-07-29 09:31:30 -04:00 committed by GitHub
parent a611c145f4
commit 7a2bb1f2a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -161,7 +161,7 @@ void LoadMLIR(string inputFilename, mlir::MLIRContext &context,
}
void genConstPackObj(const mlir::OwningModuleRef &module,
llvm::Optional<string> &constPackObjPath) {
llvm::Optional<string> &constPackObjPath, string outputBaseName) {
// Extract constant pack file name, which is embedded as a symbol in the
// module being compiled.
auto constPackFilePathSym = (*module).lookupSymbol<mlir::LLVM::GlobalOp>(
@ -223,6 +223,12 @@ void genConstPackObj(const mlir::OwningModuleRef &module,
.exec();
#else
/* The final constant pack object file on Windows is NOT embedded into
* the shared library but rather is kept in a separate .bin file. So
* do not set it in constPackObjPath so that when this function returns
* the caller (compileModuleToSharedLibrary and compileModuleToJniJar)
* won't put it into llvm::FileRemover.
*/
llvm::SmallVector<char, 10> permConstPackFileName(
constPackFilePath.begin(), constPackFilePath.end());
llvm::sys::path::replace_extension(permConstPackFileName, "bin");
@ -309,7 +315,7 @@ void compileModuleToSharedLibrary(
const mlir::OwningModuleRef &module, std::string outputBaseName) {
llvm::Optional<string> constPackObjPath;
genConstPackObj(module, constPackObjPath);
genConstPackObj(module, constPackObjPath, outputBaseName);
llvm::FileRemover constPackObjRemover(constPackObjPath.getValue());
string bitcodePath = outputBaseName + ".bc";
@ -330,7 +336,7 @@ void compileModuleToJniJar(
const mlir::OwningModuleRef &module, std::string outputBaseName) {
llvm::Optional<string> constPackObjPath;
genConstPackObj(module, constPackObjPath);
genConstPackObj(module, constPackObjPath, outputBaseName);
llvm::FileRemover constPackObjRemover(constPackObjPath.getValue());
string bitcodePath = outputBaseName + ".bc";