[all-commits] [llvm/llvm-project] b56df1: [BitcodeReader] Allow reading pointer types from o...
Sebastian Neubauer via All-commits
all-commits at lists.llvm.org
Tue Jan 17 04:20:08 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b56df190b01335506ce30a4559d880da76d1a181
https://github.com/llvm/llvm-project/commit/b56df190b01335506ce30a4559d880da76d1a181
Author: Sebastian Neubauer <Sebastian.Neubauer at amd.com>
Date: 2023-01-17 (Tue, 17 Jan 2023)
Changed paths:
M llvm/include/llvm/Bitcode/BitcodeReader.h
M llvm/include/llvm/IRReader/IRReader.h
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/Bitcode/Reader/MetadataLoader.cpp
M llvm/lib/Bitcode/Reader/MetadataLoader.h
M llvm/lib/IRReader/IRReader.cpp
M llvm/tools/llc/llc.cpp
M llvm/tools/opt/opt.cpp
M llvm/unittests/Bitcode/BitReaderTest.cpp
Log Message:
-----------
[BitcodeReader] Allow reading pointer types from old IR
When opaque pointers are enabled and old IR with typed pointers is read,
the BitcodeReader automatically upgrades all typed pointers to opaque
pointers. This is a lossy conversion, i.e. when a function argument is a
pointer and unused, it’s impossible to reconstruct the original type
behind the pointer.
There are cases where the type information of pointers is needed. One is
reading DXIL, which is bitcode of old LLVM IR and makes a lot of use of
pointers in function signatures.
We’d like to keep using up-to-date llvm to read in and process DXIL, so
in the face of opaque pointers, we need some way to access the type
information of pointers from the read bitcode.
This patch allows extracting type information by supplying functions to
parseBitcodeFile that get called for each function signature or metadata
value. The function can access the type information via the reader’s
type IDs and the getTypeByID and getContainedTypeID functions.
The tests exemplarily shows how type info from pointers can be stored in
metadata for use after the BitcodeReader finished.
Differential Revision: https://reviews.llvm.org/D127728
More information about the All-commits
mailing list