[llvm-dev] Aggressive optimization opportunity

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 15 10:53:12 PST 2019

On 1/15/2019 12:31 PM, Troy Johnson via llvm-dev wrote:
> Restrict is supported by Clang for C++ via __restrict__, so it seems 
> strange to block using this proposed option for C++.

In C the functions whose code the compiler will compile typically come 
from the application's sources. In C++ there is usually a lot more code 
coming from the standard library and other template-based headers. Even 
if you apply that option to selected source files, you may end up with 
two different instatiations of the same template: unsafe (compiled with 
"restrict") and safe (without "restrict"). If template instatiations are 
marked as "weak", in the end the unsafe versions may end up being used 
where the safe versions are required.


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

More information about the llvm-dev mailing list