michaelselehov wrote:
The compressed offload bundle ("CCOB") format had two independent, nearly
byte-for-byte identical implementations:
- `clang/lib/Driver/OffloadBundler.cpp` (the Clang driver copy), and
- `llvm/lib/Object/OffloadBundle.cpp` (the `llvm::object` copy, already used by
`llvm-objdump --offloading`, `comgr` and others).
Having two copies means every fix to the format has to be made (and reviewed,
and tested) twice, and they have already drifted in small ways (error strings,
the verbose-reporting API). This patch removes the duplication so that later
changes only touch one place.
What this does:
- Deletes the Clang-side `CompressedOffloadBundle` class and its supporting
code: `compress` / `decompress` / `CompressedBundleHeader::tryParse`, the
`RawCompressedBundleHeader` union, `getHeaderSize`, the `formatWithCommas`
helper and the private timer group.
- Routes the driver through `llvm::object::CompressedOffloadBundle`. The Clang
driver already links the `Object` component, so no build changes are needed,
and the file already had `using namespace llvm::object`, so the call sites are
unchanged except for the verbose argument.
- The only API difference between the two copies was the verbose-reporting
channel: the Clang copy took `bool Verbose`, the `llvm::object` copy takes
`raw_ostream *VerboseStream`. The driver now passes
`BundlerConfig.Verbose ? &llvm::errs() : nullptr`, which preserves the exact
previous behavior (verbose diagnostics still go to stderr).
This is an NFC change: net `-374` lines, no behavior change. The existing
offload tests (`clang-offload-bundler-multi-compress.c`,
`hip-offload-compress-*.hip`, `llvm-objdump/Offloading/*`) pass unchanged.
This is the first patch of a small stack; it is deliberately a pure refactor so
the following two patches (a little-endian header fix and a bundle-boundary fix)
each apply to a single implementation.
Assisted-by: Claude Opus
https://github.com/llvm/llvm-project/pull/206741
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits