aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
AgeCommit message (Collapse)AuthorFilesLines
2021-02-22[clang][patch] Inclusive language, modify filename SanitizerBlacklist.h to ↵Melanie Blower1-6/+5
NoSanitizeList.h This patch responds to a comment from @vitalybuka in D96203: suggestion to do the change incrementally, and start by modifying this file name. I modified the file name and made the other changes that follow from that rename. Reviewers: vitalybuka, echristo, MaskRay, jansvoboda11, aaron.ballman Differential Revision: https://reviews.llvm.org/D96974
2021-02-12[ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead ofAkira Hatanaka1-0/+3
explicitly emitting retainRV or claimRV calls in the IR Background: This fixes a longstanding problem where llvm breaks ARC's autorelease optimization (see the link below) by separating calls from the marker instructions or retainRV/claimRV calls. The backend changes are in https://reviews.llvm.org/D92569. https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue What this patch does to fix the problem: - The front-end adds operand bundle "clang.arc.attachedcall" to calls, which indicates the call is implicitly followed by a marker instruction and an implicit retainRV/claimRV call that consumes the call result. In addition, it emits a call to @llvm.objc.clang.arc.noop.use, which consumes the call result, to prevent the middle-end passes from changing the return type of the called function. This is currently done only when the target is arm64 and the optimization level is higher than -O0. - ARC optimizer temporarily emits retainRV/claimRV calls after the calls with the operand bundle in the IR and removes the inserted calls after processing the function. - ARC contract pass emits retainRV/claimRV calls after the call with the operand bundle. It doesn't remove the operand bundle on the call since the backend needs it to emit the marker instruction. The retainRV and claimRV calls are emitted late in the pipeline to prevent optimization passes from transforming the IR in a way that makes it harder for the ARC middle-end passes to figure out the def-use relationship between the call and the retainRV/claimRV calls (which is the cause of PR31925). - The function inliner removes an autoreleaseRV call in the callee if nothing in the callee prevents it from being paired up with the retainRV/claimRV call in the caller. It then inserts a release call if claimRV is attached to the call since autoreleaseRV+claimRV is equivalent to a release. If it cannot find an autoreleaseRV call, it tries to transfer the operand bundle to a function call in the callee. This is important since the ARC optimizer can remove the autoreleaseRV returning the callee result, which makes it impossible to pair it up with the retainRV/claimRV call in the caller. If that fails, it simply emits a retain call in the IR if retainRV is attached to the call and does nothing if claimRV is attached to it. - SCCP refrains from replacing the return value of a call with a constant value if the call has the operand bundle. This ensures the call always has at least one user (the call to @llvm.objc.clang.arc.noop.use). - This patch also fixes a bug in replaceUsesOfNonProtoConstant where multiple operand bundles of the same kind were being added to a call. Future work: - Use the operand bundle on x86-64. - Fix the auto upgrader to convert call+retainRV/claimRV pairs into calls with the operand bundles. rdar://71443534 Differential Revision: https://reviews.llvm.org/D92808
2021-02-09Revert "[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitly"Nico Weber1-3/+0
This reverts commit 4a64d8fe392449b205e59031aad5424968cf7446. Makes clang crash when buildling trivial iOS programs, see comment after https://reviews.llvm.org/D92808#2551401
2021-02-05[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitlyAkira Hatanaka1-0/+3
emitting retainRV or claimRV calls in the IR This reapplies 3fe3946d9a958b7af6130241996d9cfcecf559d4 without the changes made to lib/IR/AutoUpgrade.cpp, which was violating layering. Original commit message: Background: This patch makes changes to the front-end and middle-end that are needed to fix a longstanding problem where llvm breaks ARC's autorelease optimization (see the link below) by separating calls from the marker instructions or retainRV/claimRV calls. The backend changes are in https://reviews.llvm.org/D92569. https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue What this patch does to fix the problem: - The front-end adds operand bundle "clang.arc.rv" to calls, which indicates the call is implicitly followed by a marker instruction and an implicit retainRV/claimRV call that consumes the call result. In addition, it emits a call to @llvm.objc.clang.arc.noop.use, which consumes the call result, to prevent the middle-end passes from changing the return type of the called function. This is currently done only when the target is arm64 and the optimization level is higher than -O0. - ARC optimizer temporarily emits retainRV/claimRV calls after the calls with the operand bundle in the IR and removes the inserted calls after processing the function. - ARC contract pass emits retainRV/claimRV calls after the call with the operand bundle. It doesn't remove the operand bundle on the call since the backend needs it to emit the marker instruction. The retainRV and claimRV calls are emitted late in the pipeline to prevent optimization passes from transforming the IR in a way that makes it harder for the ARC middle-end passes to figure out the def-use relationship between the call and the retainRV/claimRV calls (which is the cause of PR31925). - The function inliner removes an autoreleaseRV call in the callee if nothing in the callee prevents it from being paired up with the retainRV/claimRV call in the caller. It then inserts a release call if the call is annotated with claimRV since autoreleaseRV+claimRV is equivalent to a release. If it cannot find an autoreleaseRV call, it tries to transfer the operand bundle to a function call in the callee. This is important since ARC optimizer can remove the autoreleaseRV returning the callee result, which makes it impossible to pair it up with the retainRV/claimRV call in the caller. If that fails, it simply emits a retain call in the IR if the implicit call is a call to retainRV and does nothing if it's a call to claimRV. Future work: - Use the operand bundle on x86-64. - Fix the auto upgrader to convert call+retainRV/claimRV pairs into calls annotated with the operand bundles. rdar://71443534 Differential Revision: https://reviews.llvm.org/D92808
2021-02-05Revert "[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitly"Akira Hatanaka1-3/+0
This reverts commit 3fe3946d9a958b7af6130241996d9cfcecf559d4. The commit violates layering by including a header from Analysis in lib/IR/AutoUpgrade.cpp.
2021-02-05[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitlyAkira Hatanaka1-0/+3
emitting retainRV or claimRV calls in the IR Background: This patch makes changes to the front-end and middle-end that are needed to fix a longstanding problem where llvm breaks ARC's autorelease optimization (see the link below) by separating calls from the marker instructions or retainRV/claimRV calls. The backend changes are in https://reviews.llvm.org/D92569. https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue What this patch does to fix the problem: - The front-end adds operand bundle "clang.arc.rv" to calls, which indicates the call is implicitly followed by a marker instruction and an implicit retainRV/claimRV call that consumes the call result. In addition, it emits a call to @llvm.objc.clang.arc.noop.use, which consumes the call result, to prevent the middle-end passes from changing the return type of the called function. This is currently done only when the target is arm64 and the optimization level is higher than -O0. - ARC optimizer temporarily emits retainRV/claimRV calls after the calls with the operand bundle in the IR and removes the inserted calls after processing the function. - ARC contract pass emits retainRV/claimRV calls after the call with the operand bundle. It doesn't remove the operand bundle on the call since the backend needs it to emit the marker instruction. The retainRV and claimRV calls are emitted late in the pipeline to prevent optimization passes from transforming the IR in a way that makes it harder for the ARC middle-end passes to figure out the def-use relationship between the call and the retainRV/claimRV calls (which is the cause of PR31925). - The function inliner removes an autoreleaseRV call in the callee if nothing in the callee prevents it from being paired up with the retainRV/claimRV call in the caller. It then inserts a release call if the call is annotated with claimRV since autoreleaseRV+claimRV is equivalent to a release. If it cannot find an autoreleaseRV call, it tries to transfer the operand bundle to a function call in the callee. This is important since ARC optimizer can remove the autoreleaseRV returning the callee result, which makes it impossible to pair it up with the retainRV/claimRV call in the caller. If that fails, it simply emits a retain call in the IR if the implicit call is a call to retainRV and does nothing if it's a call to claimRV. Future work: - Use the operand bundle on x86-64. - Fix the auto upgrader to convert call+retainRV/claimRV pairs into calls annotated with the operand bundles. rdar://71443534 Differential Revision: https://reviews.llvm.org/D92808
2021-01-26Support for instrumenting only selected files or functionsPetr Hosek1-0/+4
This change implements support for applying profile instrumentation only to selected files or functions. The implementation uses the sanitizer special case list format to select which files and functions to instrument, and relies on the new noprofile IR attribute to exclude functions from instrumentation. Differential Revision: https://reviews.llvm.org/D94820
2021-01-26Revert "Support for instrumenting only selected files or functions"Petr Hosek1-4/+0
This reverts commit 4edf35f11a9e20bd5df3cb47283715f0ff38b751 because the test fails on Windows bots.
2021-01-26Support for instrumenting only selected files or functionsPetr Hosek1-0/+4
This change implements support for applying profile instrumentation only to selected files or functions. The implementation uses the sanitizer special case list format to select which files and functions to instrument, and relies on the new noprofile IR attribute to exclude functions from instrumentation. Differential Revision: https://reviews.llvm.org/D94820
2020-11-24Avoid redundant work when computing vtable vcall visibilityTeresa Johnson1-1/+4
Add a Visited set to avoid repeatedly processing the same base classes in complex class hierarchies. This cut down the compile time of one source file from >12min to ~1min. Differential Revision: https://reviews.llvm.org/D91676
2020-11-19[AIX][FE] Support constructor/destructor attributeXiangling Liao1-1/+7
Support attribute((constructor)) and attribute((destructor)) on AIX Differential Revision: https://reviews.llvm.org/D90892
2020-11-02[darwin] add support for __isPlatformVersionAtLeast check for if (@available)Alex Lorenz1-1/+3
The __isPlatformVersionAtLeast routine is an implementation of `if (@available)` check that uses the _availability_version_check API on Darwin that's supported on macOS 10.15, iOS 13, tvOS 13 and watchOS 6. Differential Revision: https://reviews.llvm.org/D90367
2020-10-26[Annotation] Allows annotation to carry some additional constant arguments.Tyker1-0/+6
This allows using annotation in a much more contexts than it currently has. especially when annotation with template or constexpr. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D88645
2020-10-25[clang] Enable support for #pragma STDC FENV_ACCESSMelanie Blower1-0/+4
Reviewers: rjmccall, rsmith, sepavloff Differential Revision: https://reviews.llvm.org/D87528
2020-10-21[c++20] For P0732R2 / P1907R1: Basic frontend support for class types asRichard Smith1-0/+4
non-type template parameters. Create a unique TemplateParamObjectDecl instance for each such value, representing the globally unique template parameter object to which the template parameter refers. No IR generation support yet; that will follow in a separate patch.
2020-10-08[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.defJoseph Huber1-10/+0
Summary: Replace the OpenMP Runtime Library functions used in CGOpenMPRuntimeGPU for OpenMP device code generation with ones in OMPKinds.def and use OMPIRBuilder for generating runtime calls. This allows us to consolidate more OpenMP code generation into the OMPIRBuilder. Future additions to the GPU runtime functions should now go in OMPKinds.def Reviewers: jdoerfert Subscribers: aaron.ballman cfe-commits guansong llvm-commits sstefan1 yaxunl Tags: #OpenMP #LLVM #clang Differential Revision: https://reviews.llvm.org/D88430
2020-09-30Revert "[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and ↵Joseph Huber1-0/+10
OMPKinds.def" Failing tests on Arm due to the tests automatically populating incomatible pointer width architectures. Reverting until the tests are updated. Failing tests: OpenMP/distribute_parallel_for_num_threads_codegen.cpp OpenMP/distribute_parallel_for_if_codegen.cpp OpenMP/distribute_parallel_for_simd_if_codegen.cpp OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp OpenMP/teams_distribute_parallel_for_if_codegen.cpp OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp This reverts commit 90eaedda9b8ef46e2c0c1b8bce33e98a3adbb68c.
2020-09-30[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.defJoseph Huber1-10/+0
Summary: Replace the OpenMP Runtime Library functions used in CGOpenMPRuntimeGPU for OpenMP device code generation with ones in OMPKinds.def and use OMPIRBuilder for generating runtime calls. This allows us to consolidate more OpenMP code generation into the OMPIRBuilder. This patch also invalidates specifying target architectures with conflicting pointer sizes. Reviewers: jdoerfert Subscribers: aaron.ballman cfe-commits guansong llvm-commits sstefan1 yaxunl Tags: #OpenMP #Clang #LLVM Differential Revision: https://reviews.llvm.org/D88430
2020-08-10[AIX] Static init frontend recovery and backend supportXiangling Liao1-6/+7
On the frontend side, this patch recovers AIX static init implementation to use the linkage type and function names Clang chooses for sinit related function. On the backend side, this patch sets correct linkage and function names on aliases created for sinit/sterm functions. Differential Revision: https://reviews.llvm.org/D84534
2020-07-08[OpenMPIRBuilder][Fix] Move llvm::omp::types to OpenMPIRBuilder.sstefan11-4/+0
Summary: D82193 exposed a problem with global type definitions in `OMPConstants.h`. This causes a race when running in thinLTO mode. Types now live inside of OpenMPIRBuilder to prevent this from happening. Reviewers: jdoerfert Subscribers: yaxunl, hiraditya, guansong, dexonsmith, aaron.ballman, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D83176
2020-06-24Fix crash on XCore on unused inline in EmitTargetMetadataNigel Perks1-3/+0
EmitTargetMetadata passed to emitTargetMD a null pointer as returned from GetGlobalValue, for an unused inline function which has been removed from the module at that point. A FIXME in CodeGenModule.cpp commented that the calling code in EmitTargetMetadata should be moved into the one target that needs it (XCore). A review comment agreed. So the calling loop has been moved into the XCore subclass. The check for null is done in that loop. Differential Revision: https://reviews.llvm.org/D77068
2020-06-19[AIX][Frontend] Static init implementation for AIX considering no priorityXiangling Liao1-10/+21
1. Provides no piroirity supoort && disables three priority related attributes: init_priority, ctor attr, dtor attr; 2. '-qunique' in XL compiler equivalent behavior of emitting sinit and sterm functions name using getUniqueModuleId() util function in LLVM (currently no support for InternalLinkage and WeakODRLinkage symbols); 3. Add testcases to emit IR sample with __sinit80000000, __dtor, and __sterm80000000; 4. Temporarily side-steps the need to implement the functionality of llvm.global_ctors and llvm.global_dtors arrays. The uses of that functionality in this patch (with respect to the name of the functions involved) are not representative of how the functionality will be used once implemented. Differential Revision: https://reviews.llvm.org/D74166
2020-06-17[CodeGen][TLS] Set TLS Model for __tls_guard as well.Jun Ma1-0/+3
Differential Revision: https://reviews.llvm.org/D81543
2020-06-08Add a flag to debug automatic variable initializationJian Cai1-0/+2
Summary: Add -ftrivial-auto-var-init-stop-after= to limit the number of times stack variables are initialized when -ftrivial-auto-var-init= is used to initialize stack variables to zero or a pattern. This flag can be used to bisect uninitialized uses of a stack variable exposed by automatic variable initialization, such as http://crrev.com/c/2020401. Reviewers: jfb, vitalybuka, kcc, glider, rsmith, rjmccall, pcc, eugenis, vlad.tsyrklevich Reviewed By: jfb Subscribers: phosek, hubert.reinterpretcast, srhines, MaskRay, george.burgess.iv, dexonsmith, inglorion, gbiv, llozano, manojgupta, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77168
2020-05-19[CGCall] Annotate references with "align" attribute.Eli Friedman1-0/+8
If we're going to assume references are dereferenceable, we should also assume they're aligned: otherwise, we can't actually dereference them. See also D80072. Differential Revision: https://reviews.llvm.org/D80166
2020-05-16Expose IRGen API to add the default IR attributes to a function definition.John McCall1-6/+11
I've also made a stab at imposing some more order on where and how we add attributes; this part should be NFC. I wasn't sure whether the CUDA use case for libdevice should propagate CPU/features attributes, so there's a bit of unnecessary duplication.
2020-04-15Rework how UuidAttr, CXXUuidofExpr, and GUID template arguments and ↵Richard Smith1-5/+2
constants are represented. Summary: Previously, we treated CXXUuidofExpr as quite a special case: it was the only kind of expression that could be a canonical template argument, it could be a constant lvalue base object, and so on. In addition, we represented the UUID value as a string, whose source form we did not preserve faithfully, and that we partially parsed in multiple different places. With this patch, we create an MSGuidDecl object to represent the implicit object of type 'struct _GUID' created by a UuidAttr. Each UuidAttr holds a pointer to its 'struct _GUID' and its original (as-written) UUID string. A non-value-dependent CXXUuidofExpr behaves like a DeclRefExpr denoting that MSGuidDecl object. We cache an APValue representation of the GUID on the MSGuidDecl and use it from constant evaluation where needed. This allows removing a lot of the special-case logic to handle these expressions. Unfortunately, many parts of Clang assume there are only a couple of interesting kinds of ValueDecl, so the total amount of special-case logic is not really reduced very much. This fixes a few bugs and issues: * PR38490: we now support reading from GUID objects returned from __uuidof during constant evaluation. * Our Itanium mangling for a non-instantiation-dependent template argument involving __uuidof no longer depends on which CXXUuidofExpr template argument we happened to see first. * We now predeclare ::_GUID, and permit use of __uuidof without any header inclusion, better matching MSVC's behavior. We do not predefine ::__s_GUID, though; that seems like a step too far. * Our IR representation for GUID constants now uses the correct IR type wherever possible. We will still fall back to using the {i32, i16, i16, [8 x i8]} layout if a definition of struct _GUID is not available. This is not ideal: in principle the two layouts could have different padding. Reviewers: rnk, jdoerfert Subscribers: arphaman, cfe-commits, aeubanks Tags: #clang Differential Revision: https://reviews.llvm.org/D78171
2020-04-07[hip] Remove `hip_pinned_shadow`.Michael Liao1-1/+1
Summary: - Use `device_builtin_surface` and `device_builtin_texture` for surface/texture reference support. So far, both the host and device use the same reference type, which could be revised later when interface/implementation is stablized. Reviewers: yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77583
2020-03-27[OpenMP] `omp begin/end declare variant` - part 2, sema ("+CG")Johannes Doerfert1-5/+0
This is the second part loosely extracted from D71179 and cleaned up. This patch provides semantic analysis support for `omp begin/end declare variant`, mostly as defined in OpenMP technical report 8 (TR8) [0]. The sema handling makes code generation obsolete as we generate "the right" calls that can just be handled as usual. This handling also applies to the existing, albeit problematic, `omp declare variant support`. As a consequence a lot of unneeded code generation and complexity is removed. A major purpose of this patch is to provide proper `math.h`/`cmath` support for OpenMP target offloading. See PR42061, PR42798, PR42799. The current code was developed with this feature in mind, see [1]. The logic is as follows: If we have seen a `#pragma omp begin declare variant match(<SELECTOR>)` but not the corresponding `end declare variant`, and we find a function definition we will: 1) Create a function declaration for the definition we were about to generate. 2) Create a function definition but with a mangled name (according to `<SELECTOR>`). 3) Annotate the declaration with the `OMPDeclareVariantAttr`, the same one used already for `omp declare variant`, using and the mangled function definition as specialization for the context defined by `<SELECTOR>`. When a call is created we inspect it. If the target has an `OMPDeclareVariantAttr` attribute we try to specialize the call. To this end, all variants are checked, the best applicable one is picked and a new call to the specialization is created. The new call is used instead of the original one to the base function. To keep the AST printing and tooling possible we utilize the PseudoObjectExpr. The original call is the syntactic expression, the specialized call is the semantic expression. [0] https://www.openmp.org/wp-content/uploads/openmp-TR8.pdf [1] https://reviews.llvm.org/D61399#change-496lQkg0mhRN Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim, aaron.ballman Subscribers: bollu, guansong, openmp-commits, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D75779
2020-03-20[RISCV] Passing small data limitation value to RISCV backendShiva Chen1-0/+4
Passing small data limit to RISCVELFTargetObjectFile by module flag, So the backend can set small data section threshold by the value. The data will be put into the small data section if the data smaller than the threshold. Differential Revision: https://reviews.llvm.org/D57497
2020-03-18[hip] Revise `GlobalDecl` constructors. NFC.Michael Liao1-3/+0
Summary: - https://reviews.llvm.org/D68578 revises the `GlobalDecl` constructors to ensure all GPU kernels have `ReferenceKenelKind` initialized properly with an explicit constructor and static one. But, there are lots of places using the implicit constructor triggering the assertion on non-GPU kernels. That's found in compilation of many tests and workloads. - Fixing all of them may change more code and, more importantly, all of them assumes the default kernel reference kind. This patch changes that constructor to tell `CUDAGlobalAttr` and construct `GlobalDecl` properly. Reviewers: yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D76344
2020-03-09[HIP] Fix device stub nameYaxun (Sam) Liu1-0/+3
HIP emits a device stub function for each kernel in host code. The HIP debugger requires device stub function to have a different unmangled name as the kernel. Currently the name of the device stub function is the mangled name with a postfix .stub. However, this does not work with the HIP debugger since the unmangled name is the same as the kernel. This patch adds prefix __device__stub__ to the unmangled name of the device stub before mangling, therefore the device stub function has a valid mangled name which is different than the device kernel name. The device side kernel name is kept unchanged. kernels with extern "C" also gets the prefix added to the corresponding device stub function. Differential Revision: https://reviews.llvm.org/D68578
2020-03-04[HIP] Make sure, unused hip-pinned-shadow global var is kept within device codehsmahesha1-1/+1
Summary: hip-pinned-shadow global var should remain in the final code object irrespective of whether it is used or not within the code. Add it to used list, so that it will not get eliminated when it is unused. Reviewers: yaxunl, tra, hliao Reviewed By: yaxunl Subscribers: hliao, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D75402
2020-02-27Avoid ASTContext.h -> TargetInfo.h depReid Kleckner1-0/+1
This has been done before in 2008: ab13857072 But these things regress easily. Move some things out of line. Saves 316 includes + transitive stuff: 316 - ../clang/include/clang/Basic/TargetOptions.h 316 - ../clang/include/clang/Basic/TargetInfo.h 316 - ../clang/include/clang/Basic/TargetCXXABI.h 316 - ../clang/include/clang/Basic/OpenCLOptions.h 316 - ../clang/include/clang/Basic/OpenCLExtensions.def 302 - ../llvm/include/llvm/Target/TargetOptions.h 302 - ../llvm/include/llvm/Support/CodeGen.h 302 - ../llvm/include/llvm/MC/MCTargetOptions.h 302 - ../llvm/include/llvm/ADT/FloatingPointMode.h 302 - ../clang/include/clang/Basic/XRayInstr.h 302 - ../clang/include/clang/Basic/DebugInfoOptions.h 302 - ../clang/include/clang/Basic/CodeGenOptions.h 302 - ../clang/include/clang/Basic/CodeGenOptions.def 257 - ../llvm/include/llvm/Support/Regex.h 79 - ../llvm/include/llvm/ADT/SmallSet.h 68 - MSVCSTL/include/set 66 - ../llvm/include/llvm/ADT/SmallPtrSet.h 62 - ../llvm/include/llvm/ADT/StringSwitch.h
2020-02-27[WebAssembly] Mangle the argc/argv `main` as `__wasm_argc_argv`.Dan Gohman1-0/+3
WebAssembly enforces a rule that caller and callee signatures must match. This means that the traditional technique of passing `main` `argc` and `argv` even when it doesn't need them doesn't work. Currently the backend renames `main` to `__original_main`, however this doesn't interact well with LTO'ing libc, and the name isn't intuitive. This patch allows us to transition to `__main_argc_argv` instead. This implements the proposal in https://github.com/WebAssembly/tool-conventions/pull/134 with a flag to disable it when targeting Emscripten, though this is expected to be temporary, as discussed in the proposal comments. Differential Revision: https://reviews.llvm.org/D70700
2020-01-31Don't assume a reference refers to at least sizeof(T) bytes.Richard Smith1-0/+11
When T is a class type, only nvsize(T) bytes need be accessible through the reference. We had matching bugs in the application of the dereferenceable attribute and in -fsanitize=undefined.
2020-01-27Restore "[LTO/WPD] Enable aggressive WPD under LTO option"Teresa Johnson1-0/+5
This restores 59733525d37cf9ad88b5021b33ecdbaf2e18911c (D71913), along with bot fix 19c76989bb505c3117730c47df85fd3800ea2767. The bot failure should be fixed by D73418, committed as af954e441a5170a75687699d91d85e0692929d43. I also added a fix for non-x86 bot failures by requiring x86 in new test lld/test/ELF/lto/devirt_vcall_vis_public.ll.
2020-01-23Revert "[LTO/WPD] Enable aggressive WPD under LTO option"Teresa Johnson1-5/+0
This reverts commit 59733525d37cf9ad88b5021b33ecdbaf2e18911c. There is a windows sanitizer bot failure in one of the cfi tests that I will need some time to figure out: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/57155/steps/stage%201%20check/logs/stdio
2020-01-23[LTO/WPD] Enable aggressive WPD under LTO optionTeresa Johnson1-0/+5
Summary: Third part in series to support Safe Whole Program Devirtualization Enablement, see RFC here: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html This patch adds type test metadata under -fwhole-program-vtables, even for classes without hidden visibility. It then changes WPD to skip devirtualization for a virtual function call when any of the compatible vtables has public vcall visibility. Additionally, internal LLVM options as well as lld and gold-plugin options are added which enable upgrading all public vcall visibility to linkage unit (hidden) visibility during LTO. This enables the more aggressive WPD to kick in based on LTO time knowledge of the visibility guarantees. Support was added to all flavors of LTO WPD (regular, hybrid and index-only), and to both the new and old LTO APIs. Unfortunately it was not simple to split the first and second parts of this part of the change (the unconditional emission of type tests and the upgrading of the vcall visiblity) as I needed a way to upgrade the public visibility on legacy WPD llvm assembly tests that don't include linkage unit vcall visibility specifiers, to avoid a lot of test churn. I also added a mechanism to LowerTypeTests that allows dropping type test assume sequences we now aggressively insert when we invoke distributed ThinLTO backends with null indexes, which is used in testing mode, and which doesn't invoke the normal ThinLTO backend pipeline. Depends on D71907 and D71911. Reviewers: pcc, evgeny777, steven_wu, espindola Subscribers: emaste, Prazek, inglorion, arichardson, hiraditya, MaskRay, dexonsmith, dang, davidxl, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71913
2019-12-23[Sema][X86] Consider target attribute into the checks in validateOutputSize ↵Craig Topper1-8/+0
and validateInputSize. The validateOutputSize and validateInputSize need to check whether AVX or AVX512 are enabled. But this can be affected by the target attribute so we need to factor that in. This patch moves some of the code from CodeGen to create an appropriate feature map that we can pass to the function. Differential Revision: https://reviews.llvm.org/D68627
2019-12-22reland "[DebugInfo] Support to emit debugInfo for extern variables"Yonghong Song1-0/+3
Commit d77ae1552fc21a9f3877f3ed7e13d631f517c825 ("[DebugInfo] Support to emit debugInfo for extern variables") added deebugInfo for extern variables for BPF target. The commit is reverted by 891e25b02d760d0de18c7d46947913b3166047e7 as the committed tests using %clang instead of %clang_cc1 causing test failed in certain scenarios as reported by Reid Kleckner. This patch fixed the tests by using %clang_cc1. Differential Revision: https://reviews.llvm.org/D71818
2019-12-22Revert "[DebugInfo] Support to emit debugInfo for extern variables"Reid Kleckner1-3/+0
This reverts commit d77ae1552fc21a9f3877f3ed7e13d631f517c825. The tests committed along with this change do not pass, and should be changed to use %clang_cc1.
2019-12-11[OpenMP] Use the OpenMP-IR-BuilderJohannes Doerfert1-0/+5
This is a follow up patch to use the OpenMP-IR-Builder, as discussed on the mailing list ([1] and later) and at the US Dev Meeting'19. [1] http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/2019-May/000197.html Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny Tags: #clang Differential Revision: https://reviews.llvm.org/D69922
2019-12-10[DebugInfo] Support to emit debugInfo for extern variablesYonghong Song1-0/+3
Extern variable usage in BPF is different from traditional pure user space application. Recent discussion in linux bpf mailing list has two use cases where debug info types are required to use extern variables: - extern types are required to have a suitable interface in libbpf (bpf loader) to provide kernel config parameters to bpf programs. https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23PtwaZs-yAyafmXC9g@mail.gmail.com/T/#t - extern types are required so kernel bpf verifier can verify program which uses external functions more precisely. This will make later link with actual external function no need to reverify. https://lore.kernel.org/bpf/87eez4odqp.fsf@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed This patch added clang support to emit debuginfo for extern variables with a TargetInfo hook to enable it. The debuginfo for the extern variable is emitted only if that extern variable is referenced in the current compilation unit. Currently, only BPF target enables to generate debug info for extern variables. The emission of such debuginfo is disabled for C++ at this moment since BPF only supports a subset of C language. Emission with C++ can be enabled later if an appropriate use case is identified. -fstandalone-debug permits us to see more debuginfo with the cost of bloated binary size. This patch did not add emission of extern variable debug info with -fstandalone-debug. This can be re-evaluated if there is a real need. Differential Revision: https://reviews.llvm.org/D70696
2019-12-09Avoid Attr.h includes, CodeGen editionReid Kleckner1-1/+3
This saves around 20 includes of Attr.h. Not much.
2019-12-09[Attr] Move ParsedTargetAttr out of the TargetAttr classCraig Topper1-1/+1
Need to forward declare it in ASTContext.h for D68627, so it can't be a nested struct. Differential Revision: https://reviews.llvm.org/D71159
2019-12-06Revert "[Sema][X86] Consider target attribute into the checks in ↵Reid Kleckner1-0/+8
validateOutputSize and validateInputSize." This reverts commit e1578fd2b79fe5af5f80c0c166a8abd0f816c022. It introduces a dependency on Attr.h which I am removing from ASTContext.h.
2019-12-06[Sema][X86] Consider target attribute into the checks in validateOutputSize ↵Craig Topper1-8/+0
and validateInputSize. The validateOutputSize and validateInputSize need to check whether AVX or AVX512 are enabled. But this can be affected by the target attribute so we need to factor that in. This patch copies some of the code from CodeGen to create an appropriate feature map that we can pass to the function. Probably need some refactoring here to share more code with Codegen. Is there a good place to do that? Also need to support the cpu_specific attribute as well. Differential Revision: https://reviews.llvm.org/D68627
2019-11-07[CodeGenModule] Group blocks runtime globals together, NFCVedant Kumar1-4/+4
2019-10-27OpenMP: Add helper function for convergent runtime callsMatt Arsenault1-2/+13
Most of the functions emitted here should probably be convergent, but only barriers are currently marked. Introduce this helper before adding convergent to more functions.