llvm-project/clang/test
Jon Chesterfield c45eaeabb7 [Clang] Undef attribute for global variables
Summary:
[Clang] Attribute to allow defining undef global variables

Initializing global variables is very cheap on hosted implementations. The
C semantics of zero initializing globals work very well there. It is not
necessarily cheap on freestanding implementations. Where there is no loader
available, code must be emitted near the start point to write the appropriate
values into memory.

At present, external variables can be declared in C++ and definitions provided
in assembly (or IR) to achive this effect. This patch provides an attribute in
order to remove this reason for writing assembly for performance sensitive
freestanding implementations.

A close analogue in tree is LDS memory for amdgcn, where the kernel is
responsible for initializing the memory after it starts executing on the gpu.
Uninitalized variables in LDS are observably cheaper than zero initialized.

Patch is loosely based on the cuda __shared__ and opencl __local variable
implementation which also produces undef global variables.

Reviewers: kcc, rjmccall, rsmith, glider, vitalybuka, pcc, eugenis, vlad.tsyrklevich, jdoerfert, gregrodgers, jfb, aaron.ballman

Reviewed By: rjmccall, aaron.ballman

Subscribers: Anastasia, aaron.ballman, davidb, Quuxplusone, dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74361
2020-03-17 21:22:23 +00:00
..
ARCMT
AST [OPENMP50]Mark expression in detach clause as firstprivate. 2020-03-17 14:05:13 -04:00
ASTMerge
Analysis Add triple for non-x86 environments. 2020-03-10 15:26:03 -07:00
CXX Add a test triple to avoid failure under MS ABI. 2020-03-12 16:44:09 -07:00
ClangScanDeps [clang][clang-scan-deps] Aggregate the full dependency information. 2020-01-23 16:58:50 -08:00
CodeCompletion Another fix for 7d91633a2b 2020-02-19 17:15:11 -05:00
CodeGen [Clang] Undef attribute for global variables 2020-03-17 21:22:23 +00:00
CodeGenCUDA [HIP] Let clang recognize .hip extension 2020-03-17 11:22:55 -04:00
CodeGenCXX [Clang] Undef attribute for global variables 2020-03-17 21:22:23 +00:00
CodeGenCoroutines [Coroutines] Do not evaluate InitListExpr of a co_return 2020-03-16 12:42:44 +08:00
CodeGenHIP Don't dump IR output from this test to stdout. 2020-01-16 19:19:45 -08:00
CodeGenObjC Fix conflict value for metadata "Objective-C Garbage Collection" in the mix of swift and Objective-C bitcode 2020-03-11 13:26:06 -07:00
CodeGenObjCXX Fix the type of the capture passed to LambdaIntroducer::addCapture in 2020-03-09 12:25:28 -07:00
CodeGenOpenCL Recommit #2 "[Driver] Default to -fno-common for all targets" 2020-03-09 19:57:03 +00:00
CodeGenOpenCLCXX
Coverage
CoverageMapping Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Driver [HIP] Let clang recognize .hip extension 2020-03-17 11:22:55 -04:00
FixIt [objc_direct] Small updates to help with adoption. 2020-02-16 16:32:41 -08:00
Format
Frontend Recommit #2 "[Driver] Default to -fno-common for all targets" 2020-03-09 19:57:03 +00:00
Headers [ARM,CDE] Generalize MVE intrinsics infrastructure to support CDE 2020-03-10 14:03:16 +00:00
Import [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
Index [Index/USRGeneration] Make sure that ObjC properties in categories also get namescoped properly for USR generation 2020-03-07 15:07:37 -08:00
Integration
InterfaceStubs [clang][IFS][test] Temporary work around for in-process cc1 ASAN issues. 2020-01-21 22:56:20 -05:00
Layout
Lexer Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang 2020-02-18 16:16:37 -08:00
Misc [Clang] Undef attribute for global variables 2020-03-17 21:22:23 +00:00
Modules Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
OpenMP [OPENMP50]Mark expression in detach clause as firstprivate. 2020-03-17 14:05:13 -04:00
PCH [clang] Prune 'IsOMPStructuredBlock' Stmt bit 2020-03-12 14:48:57 +03:00
Parser PR45063: Fix crash on invalid processing an elaborated class template-id 2020-03-13 18:53:49 -07:00
Preprocessor [ARM,CDE] Implement CDE feature test macros 2020-03-09 16:14:06 +00:00
Profile Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Refactor
Rewriter
Sema [Clang] Undef attribute for global variables 2020-03-17 21:22:23 +00:00
SemaCUDA Revert "[CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese" 2020-02-18 14:45:34 -05:00
SemaCXX [Sema][SVE] Reject "delete" with sizeless types 2020-03-17 12:45:00 +00:00
SemaObjC [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
SemaObjCXX [Sema][C++] Propagate conversion kind to specialize the diagnostics 2020-02-25 16:05:37 +00:00
SemaOpenCL [Sema][C++] Propagate conversion kind to specialize the diagnostics 2020-02-25 16:05:37 +00:00
SemaOpenCLCXX [OpenCL] Restrict addr space conversions in nested pointers 2020-02-07 12:04:35 +00:00
SemaSYCL [SYCL] Driver option to select SYCL version 2020-03-07 18:28:54 +03:00
SemaTemplate PR45207: Fix crash if constrained-type-specifier annotation forms a 2020-03-17 13:18:23 -07:00
TableGen
Templight
Tooling [PowerPC] Delete PPCMachObjectWriter and powerpc{,64}-apple-darwin 2020-03-05 11:05:26 -08:00
Unit
VFS [VFS] More consistent support for Windows 2020-02-05 11:38:20 -08:00
clang-rename [clang-rename] Fix the failure rename test. 2020-02-11 10:07:00 +01:00
utils/update_cc_test_checks Move update_cc_test_checks.py tests to clang 2020-02-14 14:39:55 +00:00
.clang-format
CMakeLists.txt Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
TestRunner.sh
cxx-sections.data
lit.cfg.py Quote a python executable path 2020-03-04 15:23:48 +00:00
lit.site.cfg.py.in Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
make_test_dirs.pl