[PATCH] D108254: [llvm-profgen] Move profiled binary loading out of PerfReader

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 17 16:29:17 PDT 2021


wlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:259
-
-  if (!llvm::sys::fs::exists(BinaryPath)) {
-    std::string Msg = "Input binary(" + BinaryPath.str() + ") doesn't exist!";
----------------
hoy wrote:
> Is this moved to anywhere?
Good catch, I was thinking the code below should catch the error, but I got it's better to remain the original logic.
```
// Attempt to open the binary.
OwningBinary<Binary> OBinary = unwrapOrError(createBinary(Path), Path);
Binary &Binary = *OBinary.getBinary();

auto *Obj = dyn_cast<ELFObjectFileBase>(&Binary);
if (!Obj)
  exitWithError("not a valid Elf image", Path);
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108254/new/

https://reviews.llvm.org/D108254



More information about the llvm-commits mailing list