summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [ARM] Take into account -mcpu and -mfpu options while handling 'crypto' featureDiogo N. Sampaio2019-09-113-16/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Submittin in behalf of krisb (Kristina Bessonova) <ch.bessonova@gmail.com> Summary: '+crypto' means '+aes' and '+sha2' for arch >= ARMv8 when they were not disabled explicitly. But this is correctly handled only in case of '-march' option, though the feature may also be specified through the '-mcpu' or '-mfpu' options. In the following example: $ clang -mcpu=cortex-a57 -mfpu=crypto-neon-fp-armv8 'aes' and 'sha2' are disabled that is quite unexpected: $ clang -cc1 -triple armv8--- -target-cpu cortex-a57 <...> -target-feature -sha2 -target-feature -aes -target-feature +crypto This exposed by https://reviews.llvm.org/D63936 that makes the 'aes' and 'sha2' features disabled by default. So, while handling the 'crypto' feature we need to take into account: - a CPU name, as it provides the information about architecture (if no '-march' option specified), - features, specified by the '-mcpu' and '-mfpu' options. Reviewers: SjoerdMeijer, ostannard, labrinea, dnsampaio Reviewed By: dnsampaio Subscribers: ikudrin, javed.absar, kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66018 Author: krisb llvm-svn: 371597
* [CodeGen] Add alias for cpu_dispatch function with IFunc & Fix resolver ↵Fangrui Song2019-09-1112-86/+125
| | | | | | | | | | | | | | linkage type Multi-versioned functions defined by cpu_dispatch and implemented with IFunc can not be called outside the translation units where they are defined due to lack of symbols. This patch add function aliases for these functions and thus make them visible outside. Differential Revision: https://reviews.llvm.org/D67058 Patch by Senran Zhang llvm-svn: 371586
* clang-misexpect: Profile Guided Validation of Performance Annotations in LLVMPetr Hosek2019-09-1118-1/+376
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains the basic functionality for reporting potentially incorrect usage of __builtin_expect() by comparing the developer's annotation against a collected PGO profile. A more detailed proposal and discussion appears on the CFE-dev mailing list (http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a prototype of the initial frontend changes appear here in D65300 We revised the work in D65300 by moving the misexpect check into the LLVM backend, and adding support for IR and sampling based profiles, in addition to frontend instrumentation. We add new misexpect metadata tags to those instructions directly influenced by the llvm.expect intrinsic (branch, switch, and select) when lowering the intrinsics. The misexpect metadata contains information about the expected target of the intrinsic so that we can check against the correct PGO counter when emitting diagnostics, and the compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight. We use these branch weight values to determine when to emit the diagnostic to the user. A future patch should address the comment at the top of LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and UnlikelyBranchWeight values into a shared space that can be accessed outside of the LowerExpectIntrinsic pass. Once that is done, the misexpect metadata can be updated to be smaller. In the long term, it is possible to reconstruct portions of the misexpect metadata from the existing profile data. However, we have avoided this to keep the code simple, and because some kind of metadata tag will be required to identify which branch/switch/select instructions are influenced by the use of llvm.expect Patch By: paulkirth Differential Revision: https://reviews.llvm.org/D66324 llvm-svn: 371584
* Emit -Wmicrosoft-enum-value warning instead of error in MS ABIReid Kleckner2019-09-112-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The first NFC change is to replace a getCXXABI().isMicrosoft() check with getTriple().isWindowsMSVCEnvironment(). This code takes effect in non-C++ compilations, so it doesn't make sense to check the C++ ABI. In the MS ABI, enums are always considered to be "complete" because the underlying type of an unfixed enum will always be 'int'. This behavior was moved from -fms-compatibility to MS ABI back in r249656. The second change is functional, and it downgrades an error to a warning when the MS ABI is used rather than only under -fms-compatibility. The reasoning is that it's unreasonable for the following code to reject the following code for all MS ABI targets with -fno-ms-compatibility: enum Foo { Foo_Val = 0xDEADBEEF }; This is valid code for any other target, but in the MS ABI, Foo_Val just happens to be negative. With this change, clang emits a -Wmicrosoft-enum-value warning on this code, but compiles it without error. Fixes PR38478 Reviewers: hans, rsmith, STL_MSFT Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67304 llvm-svn: 371581
* [clang-scan-deps][NFC] Fix tests - prevent FileCheck matching test dir pathJan Korous2019-09-1113-34/+34
| | | | | | Differential Revision: https://reviews.llvm.org/D67379 llvm-svn: 371578
* [clang-format] Apply BAS_AlwaysBreak to C++11 braced listsOwen Pan2019-09-102-1/+13
| | | | | | | | See PR18455. Differential Revision: https://reviews.llvm.org/D67395 llvm-svn: 371571
* Reland "Change the X86 datalayout to add three address spacesAmy Huang2019-09-1016-35/+44
| | | | | | | | | | for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568
* Actually reorder not and env in crash-recovery-modules.mReid Kleckner2019-09-101-2/+2
| | | | llvm-svn: 371559
* When evaluating a __builtin_constant_p conditional, always enterRichard Smith2019-09-102-63/+44
| | | | | | | | | | | constant-folding mode regardless of the original evaluation mode. In order for this to be correct, we need to track whether we're checking for a potential constant expression or checking for undefined behavior separately from the evaluation mode enum, since we don't want to clobber those states when entering constant-folding mode. llvm-svn: 371557
* [OPENMP5.0]Allow teams directive outside of the target directives.Alexey Bataev2019-09-104-3/+49
| | | | | | | According to OpenMP 5.0, teams directives are allowed not only in the target context, but also in the implicit parallel regions. llvm-svn: 371553
* Re-land Remove REQUIRES:shell from tests that pass for me on WindowsReid Kleckner2019-09-1025-57/+31
| | | | | | | | | | | | This reverts r371497 (git commit 3d7e9ab7b9f8c53aa41420c54970f0fb421004a2) Reorder `not` with `env` in these two tests so they pass: Driver/rewrite-map-in-diagnostics.c Index/crash-recovery-modules.m. This will not be necessary after D66531 lands. llvm-svn: 371552
* Fix for PR43175: compiler crash when trying to emit noncapturableAlexey Bataev2019-09-102-0/+15
| | | | | | | | | | | | | | constant. If the constexpr variable is partially initialized, the initializer can be emitted as the structure, not as an array, because of some early optimizations. The llvm variable gets the type from this constant and, thus, gets the type which is pointer to struct rather than pointer to an array. We need to convert this type to be truely array, otherwise it may lead to the compiler crash when trying to emit array subscript expression. llvm-svn: 371548
* Don't emit .gnu_pubnames when tuning for LLDB.Adrian Prantl2019-09-102-2/+1
| | | | | | | | | | | | | | | | LLDB reads the various .apple* accelerator tables (and in the near future: the DWARF 5 accelerator tables) which should make .gnu_pubnames redundant. This changes the Clang driver to no longer pass -ggnu-pubnames when tuning for LLDB. Thanks to David Blaikie for pointing this out! http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190422/thread.html#646062 rdar://problem/50142073 Differential Revision: https://reviews.llvm.org/D67373 llvm-svn: 371530
* [clang][codegen][NFC] Make test patterns more permissive.Clement Courbet2019-09-101-2/+1
| | | | | | | See the discussion in: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190909/692736.html llvm-svn: 371522
* Revert Remove REQUIRES:shell from tests that pass for me on WindowsJames Henderson2019-09-1025-28/+54
| | | | | | This reverts r371478 (git commit a9980f60ce083fa6d5fd03c12c58ca0b293e3d60) llvm-svn: 371497
* [RISCV] Make -march=rv{32,64}gc the default in RISC-V LinuxRoger Ferrer Ibanez2019-09-104-10/+27
| | | | | | | | This is the logical follow-up of D65634. Differential Revision: https://reviews.llvm.org/D66003 llvm-svn: 371496
* [RISCV] Default to ilp32d/lp64d in RISC-V LinuxRoger Ferrer Ibanez2019-09-104-11/+13
| | | | | | | | | | When running clang as a native compiler in RISC-V Linux the flag -mabi=ilp32d / -mabi=lp64d is always mandatory. This change makes it the default there. Differential Revision: https://reviews.llvm.org/D65634 llvm-svn: 371494
* [RISCV] Move architecture parsing code into its own functionRoger Ferrer Ibanez2019-09-101-140/+150
| | | | | | | | | | | I plan to reuse it in a later patch. This is almost NFC except a small change in control flow when diagnosing +d without +f. Differential Revision: https://reviews.llvm.org/D66002 llvm-svn: 371492
* Revert "clang-misexpect: Profile Guided Validation of Performance ↵Petr Hosek2019-09-1017-359/+1
| | | | | | | | Annotations in LLVM" This reverts commit r371484: this broke sanitizer-x86_64-linux-fast bot. llvm-svn: 371488
* clang-misexpect: Profile Guided Validation of Performance Annotations in LLVMPetr Hosek2019-09-1017-1/+359
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains the basic functionality for reporting potentially incorrect usage of __builtin_expect() by comparing the developer's annotation against a collected PGO profile. A more detailed proposal and discussion appears on the CFE-dev mailing list (http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a prototype of the initial frontend changes appear here in D65300 We revised the work in D65300 by moving the misexpect check into the LLVM backend, and adding support for IR and sampling based profiles, in addition to frontend instrumentation. We add new misexpect metadata tags to those instructions directly influenced by the llvm.expect intrinsic (branch, switch, and select) when lowering the intrinsics. The misexpect metadata contains information about the expected target of the intrinsic so that we can check against the correct PGO counter when emitting diagnostics, and the compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight. We use these branch weight values to determine when to emit the diagnostic to the user. A future patch should address the comment at the top of LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and UnlikelyBranchWeight values into a shared space that can be accessed outside of the LowerExpectIntrinsic pass. Once that is done, the misexpect metadata can be updated to be smaller. In the long term, it is possible to reconstruct portions of the misexpect metadata from the existing profile data. However, we have avoided this to keep the code simple, and because some kind of metadata tag will be required to identify which branch/switch/select instructions are influenced by the use of llvm.expect Patch By: paulkirth Differential Revision: https://reviews.llvm.org/D66324 llvm-svn: 371484
* Remove REQUIRES:shell from tests that pass for me on WindowsReid Kleckner2019-09-1025-54/+28
| | | | | | | | | | | | | I see in the history for some of these tests REQUIRES:shell was used as a way to disable tests on Windows because they are flaky there. I tried not to re-enable such tests, but it's possible that I missed some and this will re-enable flaky tests on Windows. If so, we should disable them with UNSUPPORTED:system-windows and add a comment that they are flaky there. So far as I can tell, the lit internal shell is capable of running all of these tests, and we shouldn't use REQUIRES:shell as a proxy for Windows. llvm-svn: 371478
* Fix crash mangling an explicit lambda non-type template parameter packRichard Smith2019-09-102-1/+8
| | | | | | that is not a pack expansion. llvm-svn: 371476
* PR43242: Fix crash when typo-correcting to an operator() that should notRichard Smith2019-09-092-10/+5
| | | | | | have been visible. llvm-svn: 371468
* [analyzer] NFC: Simplify bug report equivalence classes to not be ilists.Artem Dergachev2019-09-093-27/+19
| | | | | | | | Use a vector of unique pointers instead. Differential Revision: https://reviews.llvm.org/D67024 llvm-svn: 371451
* [analyzer] NFC: Introduce sub-classes for path-sensitive and basic reports.Artem Dergachev2019-09-0975-590/+784
| | | | | | | | | | | | | Checkers are now required to specify whether they're creating a path-sensitive report or a path-insensitive report by constructing an object of the respective type. This makes BugReporter more independent from the rest of the Static Analyzer because all Analyzer-specific code is now in sub-classes. Differential Revision: https://reviews.llvm.org/D66572 llvm-svn: 371450
* [Driver] Handle default case in refactored addOpenMPRuntimePirama Arumuga Nainar2019-09-091-0/+2
| | | | | | | | | | | | | | | | | | | Summary: Appease failed builds (due to -Werror and -Wswitch) where OMPRT_Unknown is not handled in the switch statement (even though it's handled by the early exit). This fixes -Wswitch triggered by r371442. Reviewers: srhines, danalbert, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67364 llvm-svn: 371444
* [Driver] Add -static-openmp driver optionPirama Arumuga Nainar2019-09-097-12/+67
| | | | | | | | | | | | | | | | | | | | | | Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes https://github.com/android-ndk/ndk/issues/1028 Differential Revision: https://reviews.llvm.org/D67200 llvm-svn: 371437
* [X86] Allow _MM_FROUND_CUR_DIRECTION and _MM_FROUND_NO_EXC to be used ↵Craig Topper2019-09-092-1/+16
| | | | | | | | | | together on instructions that only support SAE and not embedded rounding. Current for SAE instructions we only allow _MM_FROUND_CUR_DIRECTION(bit 2) or _MM_FROUND_NO_EXC(bit 3) to be used as the immediate passed to the inrinsics. But these instructions don't perform rounding so _MM_FROUND_CUR_DIRECTION is just sort of a default placeholder when you don't want to suppress exceptions. Using _MM_FROUND_NO_EXC by itself is really bit equivalent to (_MM_FROUND_NO_EXC | _MM_FROUND_TO_NEAREST_INT) since _MM_FROUND_TO_NEAREST_INT is 0. Since we aren't rounding on these instructions we should also accept (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC) as equivalent to (_MM_FROUND_NO_EXC). icc allows this, but gcc does not. Differential Revision: https://reviews.llvm.org/D67289 llvm-svn: 371430
* [NFC] Add aacps bitfields access testDiogo N. Sampaio2019-09-091-0/+824
| | | | llvm-svn: 371410
* Merge note_ovl_builtin_candidate diagnostics; NFCSven van Haastregt2019-09-092-6/+3
| | | | | | | There is no difference between the unary and binary case, so merge them. llvm-svn: 371403
* Move prop-sink branch to monorepo.Gabor Borsik2019-09-082-29/+107
| | | | llvm-svn: 371342
* [NewPM][Sancov] Create the Sancov Pass after building the pipelinesLeonard Chan2019-09-081-17/+7
| | | | | | | | | | | | | | | | | | | | We're running into linker errors from missing sancov sections: ``` ld.lld: error: relocation refers to a discarded section: __sancov_guards >>> defined in user-arm64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.wrappers_c.cc.o >>> referenced by common.h:26 (../../zircon/third_party/ulib/scudo/common.h:26) ... many other references ``` I believe this is due to a pass in the default pipeline that somehow discards these sections. The ModuleSanitizerCoveragePass was initially added at the start of the pipeline. This now adds it to the end of the pipeline for optimized and unoptimized builds. Differential Revision: https://reviews.llvm.org/D67323 llvm-svn: 371326
* Fixes an assertion while instantiating a template with an incomplete ↵Aaron Ballman2019-09-072-2/+66
| | | | | | | | | | typo-corrected type. Fixes PR35682. When a template in instantiated with an incomplete typo corrected type an assertion can trigger if the -ferror-limit is used to reduce the number of errors. Patch by Mark de Wever. llvm-svn: 371320
* Remove stale TLI Module level pass registrationTeresa Johnson2019-09-071-1/+0
| | | | | | | | Clang patch to adapt to LLVM changes in D66428 that make the TLI require a Function. There is no longer a module-level TargetLibraryAnalysis, so remove its registration llvm-svn: 371285
* [clang][DependencyFileGenerator] Fix missing -MT option handlingJan Korous2019-09-072-5/+5
| | | | | | | | Targets in DependencyFileGenerator don't necessarily come from -MT option. Differential Revision: https://reviews.llvm.org/D67308 llvm-svn: 371279
* Fix thunks.cpp test, don't FileCheck for anon namespace idReid Kleckner2019-09-071-1/+1
| | | | | | | The anon namespace id is a hash of the main input path to the compiler, which varies in the test suite because the input path is absolute. llvm-svn: 371277
* [Sema][ObjC] Mark C union fields that have non-trivial ObjC ownershipAkira Hatanaka2019-09-077-53/+87
| | | | | | | | | | | | | | | | | qualifications as unavailable if the union is declared in a system header r365985 stopped marking those fields as unavailable, which caused the union's NonTrivialToPrimitive* bits to be set to true. This patch restores the behavior prior to r365985, except that users can explicitly specify the ownership qualification of the field to instruct the compiler not to mark it as unavailable. rdar://problem/53420753 Differential Revision: https://reviews.llvm.org/D65256 llvm-svn: 371276
* [Sema] Diagnose default-initialization, destruction, and copying ofAkira Hatanaka2019-09-0718-122/+615
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | non-trivial C union types This recommits r365985, which was reverted because it broke a few projects using unions containing non-trivial ObjC pointer fields in system headers. We now have a patch to fix the problem (see https://reviews.llvm.org/D65256). Original commit message: This patch diagnoses uses of non-trivial C unions and structs/unions containing non-trivial C unions in the following contexts, which require default-initialization, destruction, or copying of the union objects, instead of disallowing fields of non-trivial types in C unions, which is what we currently do: - function parameters. - function returns. - assignments. - compound literals. - block captures except capturing of `__block` variables by non-escaping blocks. - local and global variable definitions. - lvalue-to-rvalue conversions of volatile types. See the discussion in https://reviews.llvm.org/D62988 for more background. rdar://problem/50679094 Differential Revision: https://reviews.llvm.org/D63753 llvm-svn: 371275
* Use musttail for variadic method thunks when possibleReid Kleckner2019-09-064-19/+184
| | | | | | | | | | | | | | | | | | | | | This avoids cloning variadic virtual methods when the target supports musttail and the return type is not covariant. I think we never implemented this previously because it doesn't handle the covariant case. But, in the MS ABI, there are some cases where vtable thunks must be emitted even when the variadic method defintion is not available, so it looks like we need to implement this. Do it for both ABIs, since it's a nice size improvement and simplification for Itanium. Emit an error when emitting thunks for variadic methods with a covariant return type. This case is essentially not implementable unless the ABI provides a way to perfectly forward variadic arguments without a tail call. Fixes PR43173. Differential Revision: https://reviews.llvm.org/D67028 llvm-svn: 371269
* [analyzer] Add minimal support for fix-it hints.Artem Dergachev2019-09-0615-95/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow attaching fixit hints to Static Analyzer BugReports. Fixits are attached either to the bug report itself or to its notes (path-sensitive event notes or path-insensitive extra notes). Add support for fixits in text output (including the default text output that goes without notes, as long as the fixit "belongs" to the warning). Add support for fixits in the plist output mode. Implement a fixit for the path-insensitive DeadStores checker. Only dead initialization warning is currently covered. Implement a fixit for the path-sensitive VirtualCall checker when the virtual method is not pure virtual (in this case the "fix" is to suppress the warning by qualifying the call). Both fixits are under an off-by-default flag for now, because they require more careful testing. Differential Revision: https://reviews.llvm.org/D65182 llvm-svn: 371257
* [analyzer] pr43179: Make CallDescription defensive against C variadic functions.Artem Dergachev2019-09-064-6/+33
| | | | | | | | | | | | | | | | | | | | | Most functions that our checkers react upon are not C-style variadic functions, and therefore they have as many actual arguments as they have formal parameters. However, it's not impossible to define a variadic function with the same name. This will crash any checker that relies on CallDescription to check the number of arguments but silently assumes that the number of parameters is the same. Change CallDescription to check both the number of arguments and the number of parameters by default. If we're intentionally trying to match variadic functions, allow specifying arguments and parameters separately (possibly omitting any of them). For now we only have one CallDescription which would make use of those, namely __builtin_va_start itself. Differential Revision: https://reviews.llvm.org/D67019 llvm-svn: 371256
* Update comment for <template-param-decl> mangling to match extended mangling ↵Richard Smith2019-09-061-0/+1
| | | | | | rule in r371004. llvm-svn: 371252
* [clang][Index][NFC] Put IndexingOptions to a separate headerJan Korous2019-09-062-20/+43
| | | | llvm-svn: 371250
* [LifetimeAnalysis] don't use raw string literals in macrosMatthias Gehre2019-09-061-29/+23
| | | | | | They broke the AArch64 bots (gcc does not support it) llvm-svn: 371241
* [NFCI] Unbreak buildbotsDavid Bolvansky2019-09-063-52/+10
| | | | llvm-svn: 371226
* [NFC] Added new tests for r371222David Bolvansky2019-09-061-0/+26
| | | | llvm-svn: 371223
* [Diagnostics] Refactor code for -Wsizeof-pointer-div, catch more cases; also ↵David Bolvansky2019-09-064-21/+40
| | | | | | | | | | | | | | | | add -Wsizeof-array-div Previously, -Wsizeof-pointer-div failed to catch: const int *r; sizeof(r) / sizeof(int); Now fixed. Also introduced -Wsizeof-array-div which catches bugs like: sizeof(r) / sizeof(short); (Array element type does not match type of sizeof operand). llvm-svn: 371222
* [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): pass a vector to EmitCheck()Roman Lebedev2019-09-061-2/+6
| | | | | | | | Will be easier to add a new 'check' in a follow-up. This was originally part of https://reviews.llvm.org/D67122 llvm-svn: 371208
* [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): refactor ↵Roman Lebedev2019-09-061-25/+52
| | | | | | | | | | | EmitGEPOffsetInBytes() helper It shouldn't really be inlined into the EmitCheckedInBoundsGEP(). Refactoring it beforehand will make follow-up changes more obvious. This was originally part of https://reviews.llvm.org/D67122 llvm-svn: 371207
* [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): add some comments to ↵Roman Lebedev2019-09-061-8/+18
| | | | | | | | | | pointer-overflow check It's rather eye-twiching, some comments may help here.. This was originally part of https://reviews.llvm.org/D67122 llvm-svn: 371206
OpenPOWER on IntegriCloud