[clang] [clang] Replace uses of CreatePointerBitCastOrAddrSpaceCast (NFC) (PR #68277)
Sergei Barannikov via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 5 16:54:53 PDT 2023
================
@@ -3088,9 +3088,6 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs(
CharUnits Align = CGM.getContext().getDeclAlign(VD);
Val = Builder.CreateAlignedLoad(Var->getValueType(), Val, Align);
}
- if (Val->getType() != Wrapper->getReturnType())
- Val = Builder.CreatePointerBitCastOrAddrSpaceCast(
----------------
s-barannikov wrote:
I couldn't break it with something like:
```
using int_as1 = int __attribute((address_space(1)));
using int_as2 = int __attribute((address_space(2)));
extern int_as1 foo();
//thread_local const int_as2 &r = foo(); // error
//thread_local const int_as1 &r = foo(); // error (?)
thread_local const int & __attribute((address_space(1))) r = foo(); // compiles (?)
```
The behavior is not intuitive to me, however.
https://github.com/llvm/llvm-project/pull/68277
More information about the cfe-commits
mailing list