summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [CodeGen][ARM] ARM runtime helper functions are not always soft-fpPeter Smith2017-07-271-10/+7
| | | | | | | | | | | | | | | | | | | The ARM Runtime ABI document (IHI0043) defines the AEABI floating point helper functions in 4.1.2 The floating-point helper functions. These functions always use the base PCS (soft-fp). However helper functions defined outside of this document such as the complex-number multiply and divide helpers are not covered by this requirement and should use hard-float PCS if the target is hard-float as both compiler-rt and libgcc for a hard-float sysroot implement these functions with a hard-float PCS. All of the floating point helper functions that are explicitly soft float are expanded in the llvm ARM backend. This change makes clang not force the BuiltinCC to AAPCS for AAPCS_VFP. With this change the ARM compiler-rt tests involving _Complex pass with both hard-fp and soft-fp targets. Differential Revision: https://reviews.llvm.org/D35538 llvm-svn: 309257
* [Coverage] NFC: Simplify sanity checks with a SpellingRange utilityVedant Kumar2017-07-271-21/+41
| | | | | | This should simplify D35925. llvm-svn: 309245
* [Coverage] NFC: Save a pair of calls to get{Start,End}Vedant Kumar2017-07-271-3/+5
| | | | llvm-svn: 309244
* Add branch weights to branches for static initializers.Richard Smith2017-07-264-7/+57
| | | | | | | | | | | | | | | | | | | The initializer for a static local variable cannot be hot, because it runs at most once per program. That's not quite the same thing as having a low branch probability, but under the assumption that the function is invoked many times, modeling this as a branch probability seems reasonable. For TLS variables, the situation is less clear, since the initialization side of the branch can run multiple times in a program execution, but we still expect initialization to be rare relative to non-initialization uses. It would seem worthwhile to add a PGO counter along this path to make this estimation more accurate in future. For globals with guarded initialization, we don't yet apply any branch weights. Due to our use of COMDATs, the guard will be reached exactly once per DSO, but we have no idea how many DSOs will define the variable. llvm-svn: 309195
* [OpenCL] Fix access qualifiers metadata for kernel arguments with typedefAlexey Sotkin2017-07-261-1/+4
| | | | | | | | Subscribers: cfe-commits, yaxunl, Anastasia Differential Revision: https://reviews.llvm.org/D35420 llvm-svn: 309155
* [CodeGen] Correctly model std::byte's aliasing propertiesDavid Majnemer2017-07-251-0/+6
| | | | | | | | | | | | std::byte, when defined as an enum, needs to be given special treatment with regards to its aliasing properties. An array of std::byte is allowed to be used as storage for other types. This fixes PR33916. Differential Revision: https://reviews.llvm.org/D35824 llvm-svn: 309058
* [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)Vedant Kumar2017-07-251-5/+20
| | | | | | | | | | | | | | | | | | | The instrumentation generated by -fsanitize=vptr does not null check a user pointer before loading from it. This causes crashes in the face of UB member calls (this=nullptr), i.e it's causing user programs to crash only after UBSan is turned on. The fix is to make run-time null checking a prerequisite for enabling -fsanitize=vptr, and to then teach UBSan to reuse these run-time null checks to make -fsanitize=vptr safe. Testing: check-clang, check-ubsan, a stage2 ubsan-enabled build Differential Revision: https://reviews.llvm.org/D35735 https://bugs.llvm.org/show_bug.cgi?id=33881 llvm-svn: 309007
* [OPENMP] Codegen for 'task_reduction' clause.Alexey Bataev2017-07-251-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added codegen for taskgroup directive with task_reduction clause. ``` <body> ``` The next code is emitted: ``` %struct.kmp_task_red_input_t red_init[n]; void *td; call void @__kmpc_taskgroup(%ident_t id, i32 gtid) ... red_init[i].shar = &<item>; red_init[i].size = sizeof(<item>); red_init[i].init = (void*)initializer_function; red_init[i].fini = (void*)destructor_function; red_init[i].comb = (void*)combiner_function; red_init[i].flags = flags; ... td = call i8* @__kmpc_task_reduction_init(i32 gtid, i32 n, i8* (void*)red_init); call void @__kmpc_end_taskgroup(%ident_t id, i32 gtid) void initializer_function(i8* priv) { *(<type>*)priv = <red_init>; ret void; } void destructor_function(i8* priv) { (<type>*)priv->~(); ret void; } void combiner_function(i8* inout, i8* in) { *(<type>*)inout = *(<type>*)inout <red_id> *(<type>*)in; ret void; } ``` llvm-svn: 308979
* [PM] Setup TargetLibraryInfo correctly for the new pass manager.Chandler Carruth2017-07-251-0/+8
| | | | | | | Without this, -fno-builtin and friends doesn't work. Added the obvious RUN lines to the test for -fno-builtin and they pass now. llvm-svn: 308967
* Debug Info: Avoid completing class types when a definition is in a module.Adrian Prantl2017-07-241-23/+27
| | | | | | | | | | This patch adds an early exit to CGDebugInfo::completeClassData() when compiling with -gmodules and the to-be-completed type is available in a clang module. rdar://problem/23599990 llvm-svn: 308938
* [CodeGen] Propagate dllexport to thunksShoaib Meenai2017-07-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under Windows Itanium, we need to export virtual and non-virtual thunks if the functions being thunked are exported. These thunks would previously inherit their dllexport attribute from the declaration, but r298330 changed declarations to not have dllexport attributes. We therefore need to add the dllexport attribute to the definition ourselves now. This is consistent with MinGW GCC's behavior. This redoes r306770 but limits the logic to Itanium. MicrosoftCXXABI's setThunkLinkage ensures that thunks aren't exported under that ABI, so I'm handling this in ItaniumCXXABI's setThunkLinkage for symmetry. We need to export these thunks because they can be referenced outside the library they're defined in. For example, if a child class without a key function inherits from a parent class with a key function, the parent's thunks will only be defined in the library with the key function, but the construction vtable for the parent in the child might be emitted outside the library (since the child doesn't have a key function), and it needs to reference the parent's thunks. We don't need to mark these thunks as imported since any references to them will occur in data, so the compiler can't generate the IAT load sequence anyway. Instead, we rely on the linker generating import thunks for the thunks. Differential Revision: https://reviews.llvm.org/D34972 llvm-svn: 308899
* Remove Bitrig: Clang ChangesErich Keane2017-07-211-1/+0
| | | | | | | | Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned. Differential Revision: https://reviews.llvm.org/D35708 llvm-svn: 308797
* Complex Long Double classification In RegCall calling conventionErich Keane2017-07-211-13/+28
| | | | | | | | | | | | | This change is part of the RegCall calling convention support for LLVM. Existing RegCall implementation was extended to include correct handling of Complex Long Double type. Complex long double types should be returned/passed in memory and not register stack. This patch implements this behavior. Patch by: eandrews Differential Revision: https://reviews.llvm.org/D35259 llvm-svn: 308769
* [OPENMP] Initial support for 'in_reduction' clause.Alexey Bataev2017-07-211-0/+1
| | | | | | | Parsing/sema analysis for 'in_reduction' clause for task-based directives. llvm-svn: 308768
* [CodeGen][mips] Support `long_call/far/near` attributesSimon Atanasyan2017-07-204-44/+98
| | | | | | | | | | | This patch adds support for the `long_call`, `far`, and `near` attributes for MIPS targets. The `long_call` and `far` attributes are synonyms. All these attributes override `-mlong-calls` / `-mno-long-calls` command line options for particular function. Differential revision: https://reviews.llvm.org/D35479 llvm-svn: 308667
* [AArch64] Produce correct defaultlib directives for windows in MSVC styleMartin Storsjo2017-07-201-1/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D35546 llvm-svn: 308584
* Update for LLVM IR metadata changes (DIImportedEntity now needs a DIFile).Adrian Prantl2017-07-191-9/+13
| | | | | | | | | <rdar://problem/33357889> https://bugs.llvm.org/show_bug.cgi?id=33822 Differential Revision: https://reviews.llvm.org/D35583 llvm-svn: 308399
* Debug Info: Set the MainFileName when generating -gmodules debug info for PCM.Adrian Prantl2017-07-181-0/+3
| | | | | | | Previously it was uninitialized and thus always defaulted to "<stdin>". This is mostly a cosmetic change that helps making the debug info more readable. llvm-svn: 308397
* Convert attribute 'target' parsing from a 'pair' to a 'struct' to make ↵Erich Keane2017-07-182-6/+7
| | | | | | | | | | | | | | further improvements easier Convert attribute 'target' parsing from a 'pair' to a 'struct' to make further improvements easier The attribute 'target' parse function previously returned a pair. Convert this to a 'pair' in order to add more functionality, and improve usability. Differential Revision: https://reviews.llvm.org/D35574 llvm-svn: 308357
* [OPENMP] Initial support for 'task_reduction' clause.Alexey Bataev2017-07-181-0/+1
| | | | | | Parsing/sema analysis of the 'task_reduction' clause. llvm-svn: 308352
* CodeGen: Insert addr space cast for automatic/temp var at right positionYaxun Liu2017-07-181-0/+3
| | | | | | | | | | | The uses of alloca may be in different blocks other than the block containing the alloca. Therefore if the alloca addr space is non-zero and it needs to be casted to default address space, the cast needs to be inserted in the same BB as the alloca insted of the current builder insert point since the current insert point may be in a different BB. Differential Revision: https://reviews.llvm.org/D35438 llvm-svn: 308313
* [AArch64] Add support for __builtin_ms_va_list on aarch64Martin Storsjo2017-07-173-28/+30
| | | | | | | | | | | Move builtins from the x86 specific scope into the global scope. Their use is still limited to x86_64 and aarch64 though. This allows wine on aarch64 to properly handle variadic functions. Differential Revision: https://reviews.llvm.org/D34475 llvm-svn: 308218
* Update use of llvm::CallingConv:X86_64_Win64 after LLVM commit r308208Martin Storsjo2017-07-171-1/+1
| | | | llvm-svn: 308209
* [SystemZ] Add support for IBM z14 processor (1/3)Ulrich Weigand2017-07-171-3/+99
| | | | | | | | | | | This patch series adds support for the IBM z14 processor. This part includes: - Basic support for the new processor and its features. - Support for low-level builtins mapped to new LLVM intrinsics. Support for the -fzvector extension to vector float and the new high-level vector intrinsics is provided by separate patches. llvm-svn: 308197
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-2/+2
| | | | | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. I will also directly update some extra clang tooling that is broken by the change from Argument to Parameter. Hopefully the bots will stay appeased. Thanks! llvm-svn: 308190
* [OPENMP] Codegen for reduction clauses in 'taskloop' directives.Alexey Bataev2017-07-173-20/+560
| | | | | | Adds codegen for taskloop-based directives. llvm-svn: 308174
* Revert changes from my previous refactoring - will need to fix dependencies ↵Faisal Vali2017-07-171-2/+2
| | | | | | | | in clang's extra tooling (such as clang-tidy etc.). Sorry about that. llvm-svn: 308158
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-2/+2
| | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. Thanks! llvm-svn: 308157
* Change dyn_casts with unused variables to isa statements to avoid unused ↵Eric Christopher2017-07-141-2/+2
| | | | | | variables. llvm-svn: 307988
* [ubsan] Teach the pointer overflow check that "p - <unsigned> <= p" (PR33430)Vedant Kumar2017-07-133-16/+33
| | | | | | | | | | | | | | | | | | | | | The pointer overflow check gives false negatives when dealing with expressions in which an unsigned value is subtracted from a pointer. This is summarized in PR33430 [1]: ubsan permits the result of the subtraction to be greater than "p", but it should not. To fix the issue, we should track whether or not the pointer expression is a subtraction. If it is, and the indices are unsigned, we know to expect "p - <unsigned> <= p". I've tested this by running check-{llvm,clang} with a stage2 ubsan-enabled build. I've also added some tests to compiler-rt, which are in D34122. [1] https://bugs.llvm.org/show_bug.cgi?id=33430 Differential Revision: https://reviews.llvm.org/D34121 llvm-svn: 307955
* [AArch64] Produce the right kind of va_arg for windowsMartin Storsjo2017-07-131-3/+18
| | | | | | | | On windows on arm64, the va_list is a plain pointer. Differential Revision: https://reviews.llvm.org/D35008 llvm-svn: 307933
* Fix spelling mistakes in comments. NFCI.Simon Pilgrim2017-07-131-14/+14
| | | | llvm-svn: 307932
* Fix -Wdocumentation warning. NFCISimon Pilgrim2017-07-131-1/+0
| | | | llvm-svn: 307931
* [OPENMP] Generalization of codegen for reduction clauses.Alexey Bataev2017-07-133-387/+564
| | | | | | | Reworked codegen for reduction clauses for future support of reductions in task-based directives. llvm-svn: 307910
* [Sema] Mark a virtual CXXMethodDecl as used if a call to it can beAkira Hatanaka2017-07-133-88/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | devirtualized. The code to detect devirtualized calls is already in IRGen, so move the code to lib/AST and make it a shared utility between Sema and IRGen. This commit fixes a linkage error I was seeing when compiling the following code: $ cat test1.cpp struct Base { virtual void operator()() {} }; template<class T> struct Derived final : Base { void operator()() override {} }; Derived<int> *d; int main() { if (d) (*d)(); return 0; } rdar://problem/33195657 Differential Revision: https://reviews.llvm.org/D34301 llvm-svn: 307883
* [OPENMP] Emit implicit taskgroup block around taskloop directives.Alexey Bataev2017-07-122-8/+24
| | | | | | | | | If taskloop directive has no associated nogroup clause, it must emitted inside implicit taskgroup block. Runtime supports it, but we need to generate implicit taskgroup block explicitly to support future reductions codegen. llvm-svn: 307822
* Expose some type-conversion functions as part of the IRGen ABI.John McCall2017-07-121-0/+16
| | | | | | Patch by Benoit Vey! llvm-svn: 307760
* Enhance synchscope representation (clang)Konstantin Zhuravlyov2017-07-111-14/+13
| | | | | | | | Relevant changes required for r307722. Differential Revision: https://reviews.llvm.org/D33109 llvm-svn: 307723
* Use DenseMap instead std::map for GVSummaryMapTyDehao Chen2017-07-101-1/+1
| | | | | | | | | | | | | | Summary: Frontend change for https://reviews.llvm.org/D35148 Reviewers: tejohnson Reviewed By: tejohnson Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D35153 llvm-svn: 307584
* Fix build failure with gcc about mixing enum and non-enumYaxun Liu2017-07-082-3/+6
| | | | llvm-svn: 307483
* [CodeGen] Fold variable into assert.Benjamin Kramer2017-07-081-2/+2
| | | | | | Avoids warnings in Release builds. llvm-svn: 307472
* CodeGen: Fix address space of global variableYaxun Liu2017-07-088-62/+160
| | | | | | | | | | | | | Certain targets (e.g. amdgcn) require global variable to stay in global or constant address space. In C or C++ global variables are emitted in the default (generic) address space. This patch introduces virtual functions TargetCodeGenInfo::getGlobalVarAddressSpace and TargetInfo::getConstantAddressSpace to handle this in a general approach. It only affects IR generated for amdgcn target. Differential Revision: https://reviews.llvm.org/D33842 llvm-svn: 307470
* [X86] Move AVX512VPOPCNTDQ in __builtin_cpu_support's enum to match trunk gcc.Craig Topper2017-07-081-0/+2
| | | | | | | | There are two other features before it that we don't currently support in the the frontend or backend so I left placeholders to keep the encoding correct. I think the compiler-rt implementation of this feature is even further out of date. llvm-svn: 307456
* [modules ts] Basic for module linkage.Richard Smith2017-07-073-1/+5
| | | | | | | | | | In addition to the formal linkage rules, the Modules TS includes cases where internal-linkage symbols within a module interface unit can be referenced from outside the module via exported inline functions / templates. We give such declarations "module-internal linkage", which is formally internal linkage, but results in an externally-visible symbol. llvm-svn: 307434
* This reverts r305820 (ARMv.2-A FP16 vector intrinsics) because it showsSjoerd Meijer2017-07-063-179/+7
| | | | | | | | 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
* [CodeGen] Check key function for typeinfo importShoaib Meenai2017-07-041-3/+7
| | | | | | | If the imported class does not have a key function, we should emit its typeinfo locally instead of attempting to import it. llvm-svn: 307052
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-032-2/+2
| | | | llvm-svn: 307007
* Changed Opts.EABIVersion type string to llvm::EABI enum classYuka Takahashi2017-07-011-5/+1
| | | | | | | | | | Summary: Changed EABIVersion type from string to llvm::EABI. It seems it was just a typo and this is intended implementation. Differential Revision: https://reviews.llvm.org/D34595 llvm-svn: 306953
* Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-011-0/+3
| | | | | | | | Summary: Un-revert https://reviews.llvm.org/D34868, but with a slight tweak to the documentation to fix an error -- I had used the wrong syntax for a link. llvm-svn: 306948
* Revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-011-3/+0
| | | | | | | Summary: The commit caused a documentation breakage. llvm-svn: 306946
OpenPOWER on IntegriCloud