[all-commits] [llvm/llvm-project] 9c760c: [Clang][CodeGen] `typeid` needs special care when ...
Alex Voicu via All-commits
all-commits at lists.llvm.org
Mon Aug 28 12:44:25 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9c760ca8ecfd570212b47a5e980d38575b879029
https://github.com/llvm/llvm-project/commit/9c760ca8ecfd570212b47a5e980d38575b879029
Author: Alex Voicu <alexandru.voicu at amd.com>
Date: 2023-08-28 (Mon, 28 Aug 2023)
Changed paths:
M clang/lib/CodeGen/CGExprCXX.cpp
M clang/lib/CodeGen/ItaniumCXXABI.cpp
A clang/test/CodeGenCXX/typeid-cxx11-with-address-space.cpp
A clang/test/CodeGenCXX/typeid-with-address-space.cpp
M clang/test/CodeGenCXX/typeinfo
A clang/test/CodeGenCXX/typeinfo-with-address-space.cpp
Log Message:
-----------
[Clang][CodeGen] `typeid` needs special care when `type_info` is not in the default AS
After https://reviews.llvm.org/D153092, for targets that use a non-default AS for globals, an "interesting" situation arises around typeid and its paired type, type_info:
- on the AST level, the type_info interface is defined with default / generic addresses, be it for function arguments, or for this;
- in IR, type_info values are globals, and thus pointers to type_info values are pointers to global
This leads to a mismatch between the function signature / formal type of the argument, and its actual type. Currently we try to handle such mismatches via `bitcast`, but that is wrong in this case, since an `ascast` is required. This patch ensures that iff the pointer to `type_info` points to a non-default AS, an ascast is inserted so as to match the `typeid` interface / return value type.
Reviewed by: yaxunl
Differential Revision: https://reviews.llvm.org/D157452
More information about the All-commits
mailing list