Issue 153526
Summary [clang] No way to generate addrspacecast with C++ style cast
Labels clang, c++
Assignees
Reporter choikwa
    https://godbolt.org/z/zbrTTqMPv demonstrates C++ casts (static_cast, reinterpret_cast, etc) can't be used to generate addrspacecast. Only C style cast is lowered to addrspacecast. This is important for noalias analysis as addrspacecast is needed (vs PtrToInt) for ptr provenance and set appropriate alias.scope.

A typical scenario may be using reinterpret_cast<AS(n) T*>(reinterpret_cast<uintptr_t>(ptr)) but this inadvertently generates PtrToInt and IntToPtr which is considered as 'capturing' the pointer and llvm cannot trace it back to the underlying objects.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to