P4 to Git Change 1209623 by yaxunl@yaxunl_stg_win50 on 2015/11/10 15:33:51
SWDEV-67990 - SPIR-V: Fix duplicate creation of opaque types in SPIR-V/LLVM translation.
Fix mem leak in drop-in LLVM/SPIR-V translator.
Add warning for undefined function in linker.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/linker.cpp#135 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/SPIRV/SPIRVReader.cpp#5 edit
[ROCm/clr commit: 45746f1d16]
This commit is contained in:
@@ -517,7 +517,10 @@ translateSpirv(llvm::Module *&M, const std::string &DumpSpirv,
|
||||
OFS.close();
|
||||
}
|
||||
|
||||
if (!llvm::ReadSPIRV(M->getContext(), SS, M, Err)) {
|
||||
auto &Ctx = M->getContext();
|
||||
delete M;
|
||||
M = nullptr;
|
||||
if (!llvm::ReadSPIRV(Ctx, SS, M, Err)) {
|
||||
llvm::errs() << "Fails to load SPIR-V as LLVM Module: " << Err << '\n';
|
||||
return false;
|
||||
}
|
||||
@@ -823,5 +826,19 @@ amdcl::OCLLinker::link(llvm::Module* input, std::vector<llvm::Module*> &libs)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// check undefined function
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
auto M = LLVMBinary();
|
||||
for (auto I = M->begin(), E = M->end(); I != E; ++I) {
|
||||
if (!I->isDeclaration() || I->use_empty() || (I->hasName() &&
|
||||
(I->getName().startswith("__") ||
|
||||
I->getName().startswith("llvm."))))
|
||||
continue;
|
||||
llvm::errs() << "Warning: Undefined function: " << *I << '\n';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user