-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
c++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"missed-optimization
Description
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.
Metadata
Metadata
Assignees
Labels
c++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"missed-optimization