[PATCH] D122270: Support converting pointers from opaque to typed

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 14:54:14 PDT 2022


aeubanks added a comment.

In D122270#3402489 <https://reviews.llvm.org/D122270#3402489>, @beanz wrote:

> A few notes about this PR.
>
> For those not familiar with the bitcode writing infrastructure, the ValueEnumerator assigns stable IDs to IR constructs (llvm::Values, llvm::Types...) so they can refer to each other. It is not directly involved in writing bitcode, and the general approach in the ValueEnumerator has been unchanged for a very long time.
>
> I'm trying to balance two conflicting factors with the work to support DXIL:
> (1) Keeping the DirectX backend small and easy to maintain by avoiding unnecessary code duplication
> -and-
> (2) Keeping the DXIL writer contained in the backend
>
> This patch adds a small override to the ValueEnumerator to insert an i8* type at the beginning of the type list. Having i8* at the beginning of the list is required to satisfy TypeList ordering constraints that the 3.7 bitcode reader (and the modern one too) requires.

I would consider forking the bitcode writer and its dependencies like ValueEnumerator rather than trying to share code. Having to support 3.7 bitcode features in the "official" bitcode writer doesn't seem appealing, however small the features may be. I see 3.7 bitcode as a completely new backend rather than a slight variation on LLVM head IR. The bitcode reader is already quite complicated due to maintaining backward compatibility, I would prefer if that didn't happen with the bitcode writer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122270



More information about the llvm-commits mailing list