According to CUDA documentation, global variables declared with device,
constant can be initialized from host code, so mark them as
externally initialized. Because shared variables cannot have an
initialization as part of their declaration and since the value maybe kept
across different kernel invocation, the value of shared is effectively
undefined instead of zero initialized.
Wrongly using zero initializer may cause illegitimate optimization, e.g.
removing unused constant variable because it's not updated in the device
code and the value is initialized with zero.
Test Plan: test/CodeGenCUDA/address-spaces.cu
Patch by Xuetian Weng
please use getLangOpts()