summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Change the implementation of scalar masked load/store intrinsics to ↵Craig Topper2018-05-102-28/+12
| | | | | | | | | | not use a 512-bit intermediate vector. This is unnecessary for AVX512VL supporting CPUs like SKX. We can just emit a 128-bit masked load/store here no matter what. The backend will widen it to 512-bits on KNL CPUs. Fixes the frontend portion of PR37386. Need to fix the backend to optimize the new sequences well. llvm-svn: 331958
* [Itanium] Emit type info names with external linkage.Eric Fiselier2018-05-101-58/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed. Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos. For example: ``` // header.h struct T; extern std::type_info const& Info; // tu_one.cpp #include "header.h" std::type_info const& Info = typeid(T*); // tu_two.cpp #include "header.h" struct T {}; int main() { auto &TI1 = Info; auto &TI2 = typeid(T*); assert(TI1 == TI2); // Fails assert(TI1.hash_code() == TI2.hash_code()); // Fails } ``` This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type. Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to: (A) Always perform strcmp/string hashes. (B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++. Reviewers: rsmith, rjmccall, majnemer, vsapsai Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46665 llvm-svn: 331957
* [Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to ↵Craig Topper2018-05-101-24/+12
| | | | | | | | | | | | | | | | | | | | | | | match what the middle and backends understand Previously we emitted something like rotl(x, n) { n &= bitwidth-1; return n != 0 ? ((x << n) | (x >> (bitwidth - n)) : x; } We use a select to avoid the undefined behavior on the (bitwidth - n) shift. The middle and backend don't really recognize this as a rotate and end up emitting a cmov or control flow because of the select. A better pattern is (x << (n & mask)) | (x << (-n & mask)) where mask is bitwidth - 1. Fixes the main complaint in PR37387. There's still some work to be done if the user writes that sequence directly on a short or char where type promotion rules can prevent it from being recognized. The builtin is emitting direct IR with unpromoted types so that isn't a problem for it. Differential Revision: https://reviews.llvm.org/D46656 llvm-svn: 331943
* [CUDA] Added -f[no-]cuda-short-ptr optionArtem Belevich2018-05-094-2/+12
| | | | | | | | | The option enables use of 32-bit pointers for accessing const/local/shared memory. The feature is disabled by default. Differential Revision: https://reviews.llvm.org/D46148 llvm-svn: 331938
* Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"Julie Hockett2018-05-099-45/+30
| | | | | | This reverts commit r331904 because of a memory leak. llvm-svn: 331932
* [Clang] Implement function attribute no_stack_protector.Manoj Gupta2018-05-092-6/+12
| | | | | | | | | | | | | | | | | | | | | | Summary: This attribute tells clang to skip this function from stack protector when -stack-protector option is passed. GCC option for this is: __attribute__((__optimize__("no-stack-protector"))) and the equivalent clang syntax would be: __attribute__((no_stack_protector)) This is used in Linux kernel to selectively disable stack protector in certain functions. Reviewers: aaron.ballman, rsmith, rnk, probinson Reviewed By: aaron.ballman Subscribers: probinson, srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D46300 llvm-svn: 331925
* Add SourceManagerForFile helper which sets up SourceManager and dependencies ↵Eric Liu2018-05-095-99/+67
| | | | | | | | | | | | | | | | for a single file with code snippet Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets. Reviewers: sammccall, klimek Reviewed By: sammccall Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D46176 llvm-svn: 331923
* [clang] Adding CharacteristicKind to PPCallbacks::InclusionDirectiveJulie Hockett2018-05-099-30/+45
| | | | | | | | | | | Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective in PPCallbacks, and updating calls to that function. This will be useful in https://reviews.llvm.org/D43778 to determine which includes are system headers. Differential Revision: https://reviews.llvm.org/D46614 llvm-svn: 331904
* [OPENMP] Generate unique names for offloading regions id.Alexey Bataev2018-05-091-1/+1
| | | | | | | It is required to emit unique names for offloading regions ids. Required to support compilation and linking of several compilation units. llvm-svn: 331899
* [OpenCL] Fix typos in emitted enqueue kernel function namesYaxun Liu2018-05-091-4/+4
| | | | | | | | | | Two typos: vaarg => vararg get_kernel_preferred_work_group_multiple => get_kernel_preferred_work_group_size_multiple Differential Revision: https://reviews.llvm.org/D46601 llvm-svn: 331895
* [OPENMP] Mark global tors/dtors as used.Alexey Bataev2018-05-091-0/+2
| | | | | | | | | | | If the global variables are marked as declare target and they need ctors/dtors, these ctors/dtors are emitted and then invoked by the offloading runtime library. They are not explicitly used in the emitted code and thus can be optimized out. Patch marks these functions as used, so the optimizer cannot remove these function during the optimization phase. llvm-svn: 331879
* [OpenCL] Add constant address space to __func__ in AST.Anastasia Stulova2018-05-093-14/+18
| | | | | | | | | | | | Added string literal helper function to obtain the type attributed by a constant address space. Also fixed predefind __func__ expr to use the helper to constract the string literal correctly. Differential Revision: https://reviews.llvm.org/D46049 llvm-svn: 331877
* [OpenCL] Restrict various keywords in OpenCL C++ modeSven van Haastregt2018-05-096-11/+52
| | | | | | | | | | | | | | | | | | | | | | | Restrict the following keywords in the OpenCL C++ language mode, according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification. - dynamic_cast - typeid - register (already restricted in OpenCL C, update the diagnostic) - thread_local - exceptions (try/catch/throw) - access qualifiers read_only, write_only, read_write Support the `__global`, `__local`, `__constant`, `__private`, and `__generic` keywords in OpenCL C++. Leave the unprefixed address space qualifiers such as global available, i.e., do not mark them as reserved keywords in OpenCL C++. libclcxx provides explicit address space pointer classes such as `global_ptr` and `global<T>` that are implemented using the `__`-prefixed qualifiers. Differential Revision: https://reviews.llvm.org/D46022 llvm-svn: 331874
* Fixes issue introduced by r331556.Alexander Kornienko2018-05-091-3/+5
| | | | | | | | | | Closes bug: https://bugs.llvm.org/show_bug.cgi?id=37357 Patch by Rafael Stahl! Differential revision: https://reviews.llvm.org/D46633 llvm-svn: 331870
* Revert r331843 "[DebugInfo] Generate debug information for labels."Hans Wennborg2018-05-093-39/+0
| | | | | | | | | | | | | | | | It broke the Chromium build (see reply on the review). > Generate DILabel metadata and call llvm.dbg.label after label > statement to associate the metadata with the label. > > Differential Revision: https://reviews.llvm.org/D45045 > > Patch by Hsiangkai Wang. This doesn't revert the change to backend-unsupported-error.ll that seems to correspond to an llvm-side change. llvm-svn: 331861
* Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"Martin Storsjo2018-05-091-2/+2
| | | | | | | | | | | | This reverts commit SVN r331666. It was afterwards pointed out in https://reviews.llvm.org/D46520 that #line directives lose information about what parts come from a system header. That means the result of -E usually won't compile, since Windows headers are typically full of warnings and default-error warnings. llvm-svn: 331858
* [clang-format] Respect BreakBeforeClosingBrace while calculating lengthKrasimir Georgiev2018-05-093-20/+87
| | | | | | | | | | | | | | | | | | Summary: This patch makes `getLengthToMatchingParen` respect the `BreakBeforeClosingBrace` ParenState for matching scope closers. In order to distinguish between paren states introduced by real vs. fake parens, I've added the token opening the ParensState to that struct. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46519 llvm-svn: 331857
* _Atomic of empty struct shouldn't assertJF Bastien2018-05-091-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: An _Atomic of an empty struct is pretty silly. In general we just widen empty structs to hold a byte's worth of storage, and we represent size and alignment as 0 internally and let LLVM figure out what to do. For _Atomic it's a bit different: the memory model mandates concrete effects occur when atomic operations occur, so in most cases actual instructions need to get emitted. It's really not worth trying to optimize empty struct atomics by figuring out e.g. that a fence would do, even though sane compilers should do optimize atomics. Further, wg21.link/p0528 will fix C++20 atomics with padding bits so that cmpxchg on them works, which means that we'll likely need to do the zero-init song and dance for empty atomic structs anyways (and I think we shouldn't special-case this behavior to C++20 because prior standards are just broken). This patch therefore makes a minor change to r176658 "Promote atomic type sizes up to a power of two": if the width of the atomic's value type is 0, just use 1 byte for width and leave alignment as-is (since it should never be zero, and over-aligned zero-width structs are weird but fine). This fixes an assertion: (NumBits >= MIN_INT_BITS && "bitwidth too small"), function get, file ../lib/IR/Type.cpp, line 241. It seems like this has run into other assertions before (namely the unreachable Kind check in ImpCastExprToType), but I haven't reproduced that issue with tip-of-tree. <rdar://problem/39678063> Reviewers: arphaman, rjmccall Subscribers: aheejin, cfe-commits Differential Revision: https://reviews.llvm.org/D46613 llvm-svn: 331845
* [DebugInfo] Generate debug information for labels.Shiva Chen2018-05-093-0/+39
| | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. Differential Revision: https://reviews.llvm.org/D45045 Patch by Hsiangkai Wang. llvm-svn: 331843
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-09280-3566/+3566
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Fix float->int conversion warnings when near barriers.Erich Keane2018-05-081-20/+12
| | | | | | | | | | | | As Eli brought up here: https://reviews.llvm.org/D46535 I'd previously messed up this fix by missing conversions that are just slightly outside the range. This patch fixes this by no longer ignoring the return value of convertToInteger. Additionally, one of the error messages wasn't very sensical (mentioning out of range value, when it really was not), so it was cleaned up as well. llvm-svn: 331812
* [HIP] Add hip offload kindYaxun Liu2018-05-083-17/+34
| | | | | | | | | There are quite differences in HIP action builder and action job creation, which justifies to define a separate offload kind. Differential Revision: https://reviews.llvm.org/D46471 llvm-svn: 331811
* Add a mno-outline flag to disable the MachineOutlinerJessica Paquette2018-05-081-1/+2
| | | | | | | | | | | Since we're working on turning the MachineOutliner by default under -Oz for AArch64, it makes sense to have an -mno-outline flag available. This currently doesn't do much (it basically just undoes -moutline). When the MachineOutliner is on by default under AArch64, this flag should set -mllvm -enable-machine-outliner=never. llvm-svn: 331810
* [Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targetsMartin Storsjo2018-05-081-1/+1
| | | | | | | | | | | | | | -dwarf-column-info is omitted if -gcodeview is specified for msvc targets at the moment, but since -gcodeview is an option that can be specified for any target, there's little reason to restrict this handling to msvc targets. This allows getting proper codeview debug info by passing -gcodeview for e.g. MinGW targets as well. Differential Revision: https://reviews.llvm.org/D46287 llvm-svn: 331807
* Change -foutline to -moutlineJessica Paquette2018-05-081-1/+1
| | | | | | | | | Nitpicky, but the MachineOutliner is a machine-level pass, and so we should reflect that by using "m" instead of "n". Figured we should get this in before people get used to the letter f. :) llvm-svn: 331806
* [OPENMP, NVPTX] Fix linkage of the global entries.Alexey Bataev2018-05-081-5/+5
| | | | | | | The linkage of the global entries must be weak to enable support of redefinition of the same target regions in multiple compilation units. llvm-svn: 331768
* [OpenCL] Factor out language version printingSven van Haastregt2018-05-083-11/+9
| | | | | | | | | Generate a printable OpenCL language version number in a single place and select between the OpenCL C or OpenCL C++ version accordingly. Differential Revision: https://reviews.llvm.org/D46382 llvm-svn: 331766
* [ASTImporter] Properly import SourceLocations of AttrsAleksei Sidorin2018-05-081-13/+12
| | | | | | | | Patch by Rafael Stahl! Differential Revision: https://reviews.llvm.org/D46115 llvm-svn: 331762
* Fix 'not all control paths return a value' MSVC warnings. NFCI.Simon Pilgrim2018-05-082-0/+2
| | | | llvm-svn: 331753
* [x86] Introduce the encl[u|s|v] intrinsicsGabor Buella2018-05-084-0/+76
| | | | | | | | | | Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46435 llvm-svn: 331743
* [x86] Introduce the pconfig intrinsicGabor Buella2018-05-087-0/+65
| | | | | | | | | | Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46431 llvm-svn: 331740
* [C++2a] operator<=>: Fix incorrect use of Twine.Eric Fiselier2018-05-081-3/+3
| | | | llvm-svn: 331713
* [C++2a] Implement operator<=>: Address bugs and post-commit review comments ↵Eric Fiselier2018-05-084-42/+35
| | | | | | | | | | | | after r331677. This patch addresses some mostly trivial post-commit review comments received on r331677. Additionally, this patch fixes an assertion in `getNarrowingKind` caused by the use of an uninitialized value from `checkThreeWayNarrowingConversion`. llvm-svn: 331707
* PR37352: mangle numbering for decomposition declarations.Richard Smith2018-05-071-1/+59
| | | | | | | | | | In order to match our mangling scheme, use a different set of numbers for decomposition declarations, and consider all binding names when forming the numbering. This does not yet affect any mangled names we produce, because local decomposition declarations can't yet have linkage, but a C++ standard proposal to change that is currently being processed. llvm-svn: 331692
* [X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.Craig Topper2018-05-071-6/+10
| | | | | | | | Without this we throw an error on the header file instead of the user code when the right features aren't enabled in clang. Rename the other DEFAULT_FN_ATTRS defines to _Z for 512-bit since I used _Y for this case. llvm-svn: 331682
* [C++2a] Implement operator<=> CodeGen and ExprConstantEric Fiselier2018-05-0710-339/+1181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch tackles long hanging fruit for the builtin operator<=> expressions. It is currently needs some cleanup before landing, but I want to get some initial feedback. The main changes are: * Lookup, build, and store the required standard library types and expressions in `ASTContext`. By storing them in ASTContext we don't need to store (and duplicate) the required expressions in the BinaryOperator AST nodes. * Implement [expr.spaceship] checking, including diagnosing narrowing conversions. * Implement `ExprConstant` for builtin spaceship operators. * Implement builitin operator<=> support in `CodeGenAgg`. Initially I emitted the required comparisons using `ScalarExprEmitter::VisitBinaryOperator`, but this caused the operand expressions to be emitted once for every required cmp. * Implement [builtin.over] with modifications to support the intent of P0946R0. See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround. Reviewers: rsmith, aaron.ballman, majnemer, rnk, compnerd, rjmccall Reviewed By: rjmccall Subscribers: rjmccall, rsmith, aaron.ballman, junbuml, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D45476 llvm-svn: 331677
* [CFI] Force LLVM to die if the implicit blacklist files cannot be found.Peter Collingbourne2018-05-071-0/+4
| | | | | | | | | | | | | | Currently LLVM CFI tries to use an implicit blacklist file, currently in /usr/lib64/clang/<version>/share. If the file is not there, LLVM happily continues, which causes CFI to add checks to files/functions that are known to fail, generating binaries that fail. This CL causes LLVM to die (I hope) if it can't find these implicit blacklist files. Patch by Caroline Tice! Differential Revision: https://reviews.llvm.org/D46403 llvm-svn: 331674
* Correct warning on Float->Integer conversions.Erich Keane2018-05-071-0/+17
| | | | | | | | | | | | | | | | | | As identified and briefly discussed here: https://bugs.llvm.org/show_bug.cgi?id=37305 Converting a floating point number to an integer type when the integral part is out of the range of the integer type is undefined behavior in C. Additionally, CodeGen emits an undef in this situation. HOWEVER, we've been giving a warning that says that the value is changed. This patch corrects the warning to list that it is actually undefined behavior. Differential Revision: https://reviews.llvm.org/D46535 llvm-svn: 331673
* [Driver] Use -fuse-line-directives by default in MSVC modeMartin Storsjo2018-05-071-2/+2
| | | | | | | | Don't use the GNU extension form of line markers in MSVC mode. Differential Revision: https://reviews.llvm.org/D46520 llvm-svn: 331666
* [OPENMP, NVPTX] Codegen for critical construct.Alexey Bataev2018-05-072-0/+70
| | | | | | Added correct codegen for the critical construct on NVPTX devices. llvm-svn: 331652
* Fix explicit template parameter reporting for narrowing conversionsErich Keane2018-05-071-0/+4
| | | | | | | | | | | | | | | | | | I found that explicit template parameters that caused a narrowing integer conversion resulted in the incorrect parameter being mentioned in the note (see test attached). This is because the argument checking code doesn't check to see if it caused SFINAE errors when checking the arguments, so instead of giving up on the first error, it continues through the list. This makes the error reporting pick up the last template param every time. This patch checks these parameters on each argument and gives up if there is an error. The result is that only the required amount of arguments are checked, and that the 'Converted' array contains only the successful arguments before the first failure, as the calls seem to all expect. llvm-svn: 331651
* [OPENMP, NVPTX] Added support for L2 parallelism.Alexey Bataev2018-05-074-127/+384
| | | | | | | Added initial codegen for level 2, 3 etc. parallelism. Currently, all the second, the third etc. parallel regions will run sequentially. llvm-svn: 331642
* [mips] Improve handling of -fno-[pic/PIC] optionAleksandar Beserminji2018-05-072-3/+20
| | | | | | | | | | | | | | | In order to disable PIC and to match GCC behaviour, -mno-abicalls option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls, warning is reported. An error is reported when -fno-pic or -fno-PIC is used in combination with -mabicalls. In this commit, test case is added. Depends on D44381. Differential Revision: https://reviews.llvm.org/D44684 llvm-svn: 331640
* Revert "[mips] Improve handling of -fno-[pic/PIC] option"Aleksandar Beserminji2018-05-072-20/+3
| | | | | | This reverts commit r331636. Forgot to add the test case. llvm-svn: 331639
* [mips] Improve handling of -fno-[pic/PIC] optionAleksandar Beserminji2018-05-072-3/+20
| | | | | | | | | | | | | In order to disable PIC and to match GCC behaviour, -mno-abicalls option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls, warning is reported. An error is reported when -fno-pic or -fno-PIC is used in combination with -mabicalls. Depends on D44381. Differential Revision: https://reviews.llvm.org/D44684 llvm-svn: 331636
* [ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, ↵Peter Szecsi2018-05-071-1/+86
| | | | | | | | | | DependentScopeDeclRefExpr The visit callback implementations for the 3 C++ AST Node added to the ASTImporter. Differential Revision: https://reviews.llvm.org/D38845 llvm-svn: 331630
* Remove now-unnecessary check for non-zero nvsize in addition toRichard Smith2018-05-071-2/+2
| | | | | | emptyness in MS record layout. llvm-svn: 331621
* Non-zero-length bit-fields make a class non-empty.Richard Smith2018-05-071-9/+13
| | | | | | | | | | | | | | | | | | | | This implements the rule intended by the standard (see LWG 2358) and the rule intended by the Itanium C++ ABI (see https://github.com/itanium-cxx-abi/cxx-abi/pull/51), and makes Clang match the behavior of GCC, ICC, and MSVC. A pedantic reading of both the standard and the ABI indicate that Clang is currently technically correct, but that's not worth much when it's clear that the wording is wrong in both those places. This is an ABI break for classes that derive from a class that is empty other than one or more unnamed non-zero-length bit-fields. Such cases are expected to be rare, but -fclang-abi-compat=6 restores the old behavior just in case. Differential Revision: https://reviews.llvm.org/D45174 llvm-svn: 331620
* Disallow pointers to const in __sync_fetch_and_xxx.Aaron Ballman2018-05-051-0/+6
| | | | | | | | | | | | Diagnoses code like: void f(const int *ptr) { __sync_fetch_and_add(ptr, 1); } which matches the behavior of GCC and ICC. llvm-svn: 331598
* [ThinLTO] Support opt remarks options with distributed ThinLTO backendsTeresa Johnson2018-05-052-2/+6
| | | | | | | | | | | | | | | | | Summary: Passes down the necessary code ge options to the LTO Config to enable -fdiagnostics-show-hotness and -fsave-optimization-record in the ThinLTO backend for a distributed build. Also, remove warning about not having PGO when the input is IR. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D46464 llvm-svn: 331592
OpenPOWER on IntegriCloud