diff options
author | Sasa Vuckovic <svuckovic@tenstorrent.com> | 2025-08-08 12:33:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-08 12:33:56 +0200 |
commit | 9349484e8f4c306318f75862ed25be6ec4c30ab8 (patch) | |
tree | 657a82c8611b813d895f8493b3d67856bd33e637 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | bd39ae612547cccef0f5bcc29eea8f355a7b7dd6 (diff) | |
download | llvm-9349484e8f4c306318f75862ed25be6ec4c30ab8.zip llvm-9349484e8f4c306318f75862ed25be6ec4c30ab8.tar.gz llvm-9349484e8f4c306318f75862ed25be6ec4c30ab8.tar.bz2 |
[MLIR] Make `PassPipelineOptions` virtually inheriting from PassOptions to allow diamond inheritance (#146370)
## Problem
Given 3 pipelines, A, B, and a superset pipeline AB that runs both the A
& B pipelines, it is not easy to manage their options - one needs to
manually recreate all options from A and B into AB, and maintain them.
This is tedious.
## Proposed solution
Ideally, AB options class inherits from both A and B options, making the
maintenance effortless. Today though, this causes problems as their base
classes `PassPipelineOptions<A>` and `PassPipelineOptions<B>` both
inherit from `mlir::detail::PassOptions`, leading to the so called
"diamond inheritance problem", i.e. multiple definitions of the same
symbol, in this case parseFromString that is defined in
mlir::detail::PassOptions.
Visually, the inheritance looks like this:
```
mlir::detail::PassOptions
↑ ↑
| |
PassPipelineOptions<A> PassPipelineOptions<B>
↑ ↑
| |
AOptions BOptions
↑ ↑
+---------+--------+
|
ABOptions
```
A proposed fix is to use the common solution to the diamond inheritance
problem - virtual inheritance.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions