aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-07-06This reverts r305820 (ARMv.2-A FP16 vector intrinsics) because it showsSjoerd Meijer1-1/+0
problems in testing, see comments in D34161 for some more details. A fix is in progres in D35011, but a revert seems better now as the fix will probably take some more time to land. llvm-svn: 307277
2017-06-20[AArch64] ADD ARMv.2-A FP16 vector intrinsicsAbderrazek Zaafrani1-0/+1
Differential Revision: https://reviews.llvm.org/D34161 llvm-svn: 305820
2017-06-20[OpenCL] Fix OpenCL and SPIR version metadata generation.Alexey Bader1-0/+34
Summary: OpenCL and SPIR version metadata must be generated once per module instead of once per mangled global value. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: ahatanak, cfe-commits Differential Revision: https://reviews.llvm.org/D34235 llvm-svn: 305796
2017-06-12IR: Replace the "Linker Options" module flag with "llvm.linker.options" ↵Peter Collingbourne1-5/+5
named metadata. The new metadata is easier to manipulate than module flags. Differential Revision: https://reviews.llvm.org/D31349 llvm-svn: 305227
2017-06-05Add support for #pragma clang sectionJaved Absar1-1/+29
This patch provides a means to specify section-names for global variables, functions and static variables, using #pragma directives. This feature is only defined to work sensibly for ELF targets. One can specify section names as: #pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText" One can "unspecify" a section name with empty string e.g. #pragma clang section bss="" data="" text="" rodata="" Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner Differential Revision: https://reviews.llvm.org/D33412 llvm-svn: 304705
2017-06-03Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova1-0/+1
llvm-svn: 304649
2017-06-02Revert "[AArch64] Add ARMv8.2-A FP16 vefctor intrinsics"Vedant Kumar1-1/+0
This reverts commit r304493. It breaks all the Darwin bots: http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_check/37168 Failure: Failing Tests (2): Clang :: CodeGen/aarch64-v8.2a-neon-intrinsics.c Clang :: CodeGen/arm_neon_intrinsics.c llvm-svn: 304509
2017-06-01[AArch64] Add ARMv8.2-A FP16 vefctor intrinsicsAbderrazek Zaafrani1-0/+1
llvm-svn: 304493
2017-06-01Fixed warningsPiotr Padlewski1-2/+2
llvm-svn: 304397
2017-06-01Emit available_externally vtables opportunisticallyPiotr Padlewski1-0/+23
Summary: We can emit vtable definition having inline function if they are all emitted. Reviewers: rjmccall, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33437 llvm-svn: 304394
2017-05-31[CodeGen] Surround assertion with parens and format.Davide Italiano1-4/+4
This should placate GCC7 with -Werror. llvm-svn: 304322
2017-05-29IRGen: Add optnone attribute on function during O0Mehdi Amini1-2/+12
Amongst other, this will help LTO to correctly handle/honor files compiled with O0, helping debugging failures. It also seems in line with how we handle other options, like how -fnoinline adds the appropriate attribute as well. Differential Revision: https://reviews.llvm.org/D28404 llvm-svn: 304127
2017-05-27[OpenMP] Create COMDAT group for OpenMP offload registration code to avoid ↵George Rokos1-2/+5
multiple copies Thanks to Sergey Dmitriev for submitting the patch. Differential Revision: https://reviews.llvm.org/D33509 llvm-svn: 304056
2017-05-24[XRay][clang] Allow imbuing arg1 logging attribute via -fxray-always-instrument=Dean Michael Berris1-0/+4
Summary: This change allows us to add arg1 logging support to functions through the special case list provided through -fxray-always-instrument=. This is useful for adding arg1 logging to functions that are either in headers that users don't have control over (i.e. cannot change the source) or would rather not do. It only takes effect when the pattern is matched through the "fun:" special case, as a category. As in: fun:*pattern=arg1 Reviewers: pelikan, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33392 llvm-svn: 303719
2017-05-20CodeGenModule: Always output wchar_size, check LLVM assumptions.Matthias Braun1-6/+13
Re-commit r303463 now that LLVM is fixed and adjust some lit tests. llvm::TargetLibraryInfo needs to know the size of wchar_t to work on functions like `wcslen`. This patch changes clang to always emit the wchar_size module flag (it would only do so for ARM previously). This also adds an `assert()` to ensure the LLVM defaults based on the target triple are in sync with clang. Differential Revision: https://reviews.llvm.org/D32982 llvm-svn: 303478
2017-05-20Revert "CodeGenModule: Always output wchar_size, check LLVM assumptions."Matthias Braun1-13/+6
Let's revert this for now (and with it the assert()) to get the bots back to green until I have LLVM synced up properly. This reverts commit r303463. llvm-svn: 303474
2017-05-19CodeGenModule: Always output wchar_size, check LLVM assumptions.Matthias Braun1-6/+13
llvm::TargetLibraryInfo needs to know the size of wchar_t to work on functions like `wcslen`. This patch changes clang to always emit the wchar_size module flag (it would only do so for ARM previously). This also adds an `assert()` to ensure the LLVM defaults based on the target triple are in sync with clang. Differential Revision: https://reviews.llvm.org/D32982 llvm-svn: 303463
2017-05-18CodeGen: Cast alloca to expected address spaceYaxun Liu1-0/+1
Alloca always returns a pointer in alloca address space, which may be different from the type defined by the language. For example, in C++ the auto variables are in the default address space. Therefore cast alloca to the expected address space when necessary. Differential Revision: https://reviews.llvm.org/D32248 llvm-svn: 303370
2017-05-09Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton1-1/+1
Use variadic templates instead of relying on <cstdarg> + sentinel. This enforces better type checking and makes code more readable. Differential revision: https://reviews.llvm.org/D32550 llvm-svn: 302572
2017-05-02Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of ↵Reid Kleckner1-10/+3
AttributeList" This time, I fixed, built, and tested clang. This reverts r301712. llvm-svn: 301981
2017-05-01Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFCSanjoy Das1-1/+1
llvm-svn: 301815
2017-05-01Remove unneeded struct; NFCSanjoy Das1-12/+9
Summary: Unless I'm missing something, the DeferredGlobal struct's GV field is unused, removing which makes the struct itself trivial. Reviewers: rafael, chandlerc Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32691 llvm-svn: 301789
2017-04-27[Profile] Add off-by-default -Wprofile-instr-missing warningVedant Kumar1-3/+7
Clang warns that a profile is out-of-date if it can't find a profile record for any function in a TU. This warning became noisy after llvm started allowing dead-stripping of instrumented functions. To fix this, this patch changes the existing profile out-of-date warning (-Wprofile-instr-out-of-date) so that it only complains about mismatched data. Further, it introduces a new, off-by-default warning about missing function data (-Wprofile-instr-missing). Differential Revision: https://reviews.llvm.org/D28867 llvm-svn: 301570
2017-04-26Revert "Update to LLVM's use of WeakTrackingVH; NFC"Sanjoy Das1-1/+1
This reverts commit r301427. llvm-svn: 301430
2017-04-26Update to LLVM's use of WeakTrackingVH; NFCSanjoy Das1-1/+1
Summary: Depends on D32266 Reviewers: davide, dblaikie Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32270 llvm-svn: 301427
2017-04-24[Devirtualization] Emit invariant.group loads with empty group mdPiotr Padlewski1-6/+2
Summary: As discussed here http://lists.llvm.org/pipermail/llvm-dev/2017-January/109332.html having different groups doesn't solve the problem entirly. Reviewers: rjmccall, rsmith Subscribers: amharc, cfe-commits Differential Revision: https://reviews.llvm.org/D32110 llvm-svn: 301178
2017-04-19Fix assertion failure in codegen on non-template deduction guide.Richard Smith1-0/+4
llvm-svn: 300762
2017-04-18Use less temporary AttributeLists NFCReid Kleckner1-4/+3
llvm-svn: 300628
2017-04-17CodeGen: Let lifetime intrinsic use alloca address spaceYaxun Liu1-0/+2
Differential Revision: https://reviews.llvm.org/D31717 llvm-svn: 300485
2017-04-13[IR] Make getParamAttributes take argument numbers, not ArgNo+1Reid Kleckner1-1/+1
Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1, Kind) everywhere. The fact that the AttributeList index for an argument is ArgNo+1 should be a hidden implementation detail. NFC llvm-svn: 300272
2017-04-13[IR] Take func, ret, and arg attrs separately in AttributeList::getReid Kleckner1-12/+8
This seems like a much more natural API, based on Derek Schuff's comments on r300015. It further hides the implementation detail of AttributeList that function attributes come last and appear at index ~0U, which is easy for the user to screw up. git diff says it saves code as well: 97 insertions(+), 137 deletions(-) This also makes it easier to change the implementation, which I want to do next. llvm-svn: 300153
2017-04-12[IR] Add AttributeSet to hide AttributeSetNode* again, NFCReid Kleckner1-1/+1
Summary: For now, it just wraps AttributeSetNode*. Eventually, it will hold AvailableAttrs as an inline bitset, and adding and removing enum attributes will be super cheap. This sinks AttributeSetNode back down to lib/IR/AttributeImpl.h. Reviewers: pete, chandlerc Subscribers: llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D31940 llvm-svn: 300014
2017-04-11Modular Codegen: Support homing debug info for types in modular objectsDavid Blaikie1-0/+5
Matching the function-homing support for modular codegen. Any type implicitly (implicit template specializations) or explicitly defined in a module is attached to that module's object file and omitted elsewhere (only a declaration used if necessary for references). llvm-svn: 299987
2017-04-10Reland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"Reid Kleckner1-10/+4
This re-lands r299875. I introduced a bug in Clang code responsible for replacing K&R, no prototype declarations with a real function definition with a prototype. The bug was here: // Collect any return attributes from the call. - if (oldAttrs.hasAttributes(llvm::AttributeList::ReturnIndex)) - newAttrs.push_back(llvm::AttributeList::get(newFn->getContext(), - oldAttrs.getRetAttributes())); + newAttrs.push_back(oldAttrs.getRetAttributes()); Previously getRetAttributes() carried AttributeList::ReturnIndex in its AttributeList. Now that we return the AttributeSetNode* directly, it no longer carries that index, and we call this overload with a single node: AttributeList::get(LLVMContext&, ArrayRef<AttributeSetNode*>) That aborted with an assertion on x86_32 targets. I added an explicit triple to the test and added CHECKs to help find issues like this in the future sooner. llvm-svn: 299899
2017-04-07[cfi] Emit __cfi_check stub in the frontend.Evgeniy Stepanov1-1/+3
Previously __cfi_check was created in LTO optimization pipeline, which means LLD has no way of knowing about the existence of this symbol without rescanning the LTO output object. As a result, LLD fails to export __cfi_check, even when given --export-dynamic-symbol flag. llvm-svn: 299806
2017-03-30Move NumRegParameters Module Flag. NFCI.Nirav Dave1-6/+5
llvm-svn: 299079
2017-03-30[XRay] Add -fxray-{always,never}-instrument= flags to clangDean Michael Berris1-0/+24
Summary: The -fxray-always-instrument= and -fxray-never-instrument= flags take filenames that are used to imbue the XRay instrumentation attributes using a whitelist mechanism (similar to the sanitizer special cases list). We use the same syntax and semantics as the sanitizer blacklists files in the implementation. As implemented, we respect the attributes that are already defined in the source file (i.e. those that have the [[clang::xray_{always,never}_instrument]] attributes) before applying the always/never instrument lists. Reviewers: rsmith, chandlerc Subscribers: jfb, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30388 llvm-svn: 299041
2017-03-23[CodeGen] Emit a CoreFoundation link guard when @available is usedAlex Lorenz1-0/+1
After r297760, __isOSVersionAtLeast in compiler-rt loads the CoreFoundation symbols at runtime. This means that `@available` will always fail when used in a binary without a linked CoreFoundation. This commit forces Clang to emit a reference to a CoreFoundation symbol when `@available` is used to ensure that linking will fail when CoreFoundation isn't linked with the build product. rdar://31039592 Differential Revision: https://reviews.llvm.org/D30977 llvm-svn: 298588
2017-03-21Update Clang for LLVM rename AttributeSet -> AttributeListReid Kleckner1-42/+34
llvm-svn: 298394
2017-03-21IRGen: Do not set dllexport on declarations.Peter Collingbourne1-1/+0
Setting dllexport on a declaration has no effect, as we do not emit export directives for declarations. Part of the fix for PR32334. Differential Revision: https://reviews.llvm.org/D31162 llvm-svn: 298330
2017-03-18[X86] Add NumRegisterParameters Module Flag.Nirav Dave1-0/+7
Reviewers: rnk, mkuper Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27051 llvm-svn: 298177
2017-03-02Promote ConstantInitBuilder to be a public CodeGen API; it'sJohn McCall1-1/+1
a generally useful utility for other frontends. NFC. llvm-svn: 296806
2017-02-15[dllimport] Check for dtor references in functionsHans Wennborg1-13/+31
Destructor references are not modelled explicitly in the AST. This adds checks for destructor calls due to variable definitions and temporaries. If a dllimport function references a non-dllimport destructor, it must not be emitted available_externally, as the referenced destructor might live across the DLL boundary and isn't exported. llvm-svn: 295258
2017-02-15[dllimport] Look through typedefs and arrays in HasNonDllImportDtorHans Wennborg1-1/+1
The function is used to check whether a type is a class with non-dllimport destructor. It needs to look through typedefs and array types. llvm-svn: 295257
2017-01-30Prototype of modules codegenDavid Blaikie1-1/+1
First pass at generating weak definitions of inline functions from module files (& skipping (-O0) or emitting available_externally (optimizations) definitions where those modules are used). External functions defined in modules are emitted into the modular object file as well (this may turn an existing ODR violation (if that module were imported into multiple translations) into valid/linkable code). Internal symbols (static functions, for example) are not correctly supported yet. The symbol will be produced, internal, in the modular object - unreferenceable from the users. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D28845 llvm-svn: 293456
2017-01-23Re-commit "Don't inline dllimport functions referencing non-imported methods"Hans Wennborg1-0/+10
This re-commits r292522 with the addition that it also handles calls through pointer to member functions without crashing. llvm-svn: 292856
2017-01-20Revert "Don't inline dllimport functions referencing non-imported methods"Reid Kleckner1-5/+0
This reverts commit r292522. It appears to be causing crashes in builds using dllimport. llvm-svn: 292643
2017-01-19Don't inline dllimport functions referencing non-imported methodsHans Wennborg1-0/+5
This is another follow-up to r246338. I had assumed methods were already handled by the AST visitor, but turns out they weren't. llvm-svn: 292522
2017-01-18Remove now redundant code that ensured debug info for class definitions was ↵David Blaikie1-17/+0
emitted under certain circumstances Introduced in r181561 - it may've been subsumed by work done to allow emission of declarations for vtable types while still emitting some of their member functions correctly for those declarations. Whatever the reason, the tests pass without this code now. llvm-svn: 292439
2017-01-17[WebAssembly] Add minimal support for the new wasm object format triple.Dan Gohman1-0/+1
llvm-svn: 292269