Don't leak TargetMachine in ExecutionEngine::setupTargetTriple

PiperOrigin-RevId: 268361054
This commit is contained in:
MLIR Team 2019-09-10 19:02:54 -07:00 committed by A. Unique TensorFlower
parent ee8cbccacf
commit d732aaf2cb
1 changed files with 2 additions and 2 deletions

View File

@ -119,8 +119,8 @@ bool ExecutionEngine::setupTargetTriple(Module *llvmModule) {
errs() << "NO target: " << errorMessage << "\n";
return true;
}
auto machine =
target->createTargetMachine(targetTriple, "generic", "", {}, {});
std::unique_ptr<llvm::TargetMachine> machine(
target->createTargetMachine(targetTriple, "generic", "", {}, {}));
llvmModule->setDataLayout(machine->createDataLayout());
llvmModule->setTargetTriple(targetTriple);
return false;