summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] new check: bugprone-too-small-loop-variableJonas Toth2018-11-128-0/+503
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new checker searches for those for loops which has a loop variable with a "too small" type which means this type can't represent all values which are part of the iteration range. For example: ``` int main() { long size = 300000; for( short int i = 0; i < size; ++i) {} } ``` The short type leads to infinite loop here because it can't store all values in the `[0..size]` interval. In a real use case, size means a container's size which depends on the user input. Which means for small amount of objects the algorithm works, but with a larger user input the software will freeze. The idea of the checker comes from the LibreOffice project, where the same check was implemented as a clang compiler plugin, called `LoopVarTooSmall` (LLVM licensed). The idea is the same behind this check, but the code is different because of the different framework. Patch by ztamas. Reviewers: alexfh, hokein, aaron.ballman, JonasToth, xazax.hun, whisperity Reviewed By: JonasToth, whisperity Differential Revision: https://reviews.llvm.org/D53974 llvm-svn: 346665
* [CostModel][X86] SK_ExtractSubvector is cheap if the (legal) subvector is ↵Simon Pilgrim2018-11-122-27/+35
| | | | | | aligned within the source vector llvm-svn: 346664
* [SystemZ::TTI] Improve accuracy of costs for vector fp <-> int conversionsJonas Paulsson2018-11-122-137/+138
| | | | | | | | | | | | | | Improve getCastInstrCost() by respecting the different types of Src and Dst for vector integer <-> fp conversions. This means that extracting from integer becomes more expensive (by the extraction penalty), and the extraction from fp becomes cheaper (no longer has a false extraction penalty). Review: Ulrich Weigand https://reviews.llvm.org/D54423 llvm-svn: 346663
* [CostModel] Add more realistic SK_InsertSubvector generic costs.Simon Pilgrim2018-11-123-65/+91
| | | | | | Instead of defaulting to a cost = 1, expand to element extract/insert like we do for other shuffles. llvm-svn: 346662
* [VectorUtils] add funnel-shifts to the list of vectorizable intrinsicsSanjay Patel2018-11-122-2/+4
| | | | | | | | | | | | | | | | This just identifies the intrinsics as candidates for vectorization. It does not mean we will attempt to vectorize under normal conditions (the test file is forcing vectorization). The cost model must be fixed to show that the transform is profitable in general. Allowing vectorization with these intrinsics is required to avoid potential regressions from canonicalizing to the intrinsics from generic IR: https://bugs.llvm.org/show_bug.cgi?id=37417 llvm-svn: 346661
* [VectorUtils] reorder list of vectorizable intrinsics; NFCSanjay Patel2018-11-121-10/+9
| | | | | | | We need to add funnel-shifts to this list, so clean up the random order before it gets worse. llvm-svn: 346660
* Revert rL346644, rL346642: the added test ↵Calixte Denizet2018-11-1210-182/+0
| | | | | | test/CodeGen/code-coverage-filter.c is failing under windows llvm-svn: 346659
* [LoopVectorize] add tests for funnel shifts; NFCSanjay Patel2018-11-121-0/+52
| | | | llvm-svn: 346658
* Fix unused variable warning. NFCI.Simon Pilgrim2018-11-121-2/+1
| | | | llvm-svn: 346657
* [CostModel] Add more realistic SK_ExtractSubvector generic costs.Simon Pilgrim2018-11-123-29/+55
| | | | | | | | Instead of defaulting to a cost = 1, expand to element extract/insert like we do for other shuffles. This exposes an issue in LoopVectorize which could call SK_ExtractSubvector with a scalar subvector type. llvm-svn: 346656
* [RISCV] Support .option relax and .option norelaxAlex Bradbury2018-11-1212-100/+296
| | | | | | | | | | | | | | | | | | | | | | This extends the .option support from D45864 to enable/disable the relax feature flag from D44886 During parsing of the relax/norelax directives, the RISCV::FeatureRelax feature bits of the SubtargetInfo stored in the AsmParser are updated appropriately to reflect whether relaxation is currently enabled in the parser. When an instruction is parsed, the parser checks if relaxation is currently enabled and if so, gets a handle to the AsmBackend and sets the ForceRelocs flag. The AsmBackend uses a combination of the original RISCV::FeatureRelax feature bits set by e.g -mattr=+/-relax and the ForceRelocs flag to determine whether to emit relocations for symbol and branch diffs. Diff relocations should therefore only not be emitted if the relax flag was not set on the command line and no instruction was ever parsed in a section with relaxation enabled to ensure correct diffs are emitted. Differential Revision: https://reviews.llvm.org/D46423 Patch by Lewis Revill. llvm-svn: 346655
* [DAGCombiner] Fix load-store forwarding of indexed loads.Nirav Dave2018-11-122-3/+50
| | | | | | | | | | | | | | | | Summary: Handle extra output from index loads in cases where we wish to forward a load value directly from a preceeding store. Fixes PR39571. Reviewers: peter.smith, rengolin Subscribers: javed.absar, hiraditya, arphaman, llvm-commits Differential Revision: https://reviews.llvm.org/D54265 llvm-svn: 346654
* Add a test checking clang-tidy can find libc++ on MacIlya Biryukov2018-11-122-0/+19
| | | | | | | | | | | | Reviewers: sammccall, arphaman, EricWF Reviewed By: sammccall Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D54311 llvm-svn: 346653
* Make clang-based tools find libc++ on MacOSIlya Biryukov2018-11-127-10/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When they read compiler args from compile_commands.json. This change allows to run clang-based tools, like clang-tidy or clangd, built from head using the compile_commands.json file produced for XCode toolchains. On MacOS clang can find the C++ standard library relative to the compiler installation dir. The logic to do this was based on resource dir as an approximation of where the compiler is installed. This broke the tools that read 'compile_commands.json' and don't ship with the compiler, as they typically change resource dir. To workaround this, we now use compiler install dir detected by the driver to better mimic the behavior of the original compiler when replaying the compilations using other tools. Reviewers: sammccall, arphaman, EricWF Reviewed By: sammccall Subscribers: ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54310 llvm-svn: 346652
* Fix an unused variable warning. NFCAlexander Kornienko2018-11-121-0/+2
| | | | llvm-svn: 346651
* [llvm-mca] Correctly update the resource strategy for processor resources ↵Andrea Di Biagio2018-11-1222-126/+132
| | | | | | | | | | | | | | | | | | | | | | | with multiple units. When looking at the tests committed by Roman at r346587, I noticed that numbers reported by the resource pressure for PdAGU01 were wrong. In particular, according to the aut-generated CHECK lines in tests memcpy-like-test.s and store-throughput.s, resource pressure for PdAGU01 was not uniformly distributed among the two AGEN pipes. It turns out that the reason why pressure was not correctly distributed, was because the "resource selection strategy" object associated with PdAGU01 was not correctly updated on the event of AGEN pipe used. As a result, llvm-mca was not simulating a round-robin pipeline allocation for PdAGU01. Instead, PdAGU1 was always prioritized over PdAGU0. This patch fixes the issue; now processor resource strategy objects for resources declaring multiple units, are correctly notified in the event of "resource used". llvm-svn: 346650
* [newpm] Fix r346645: Missing consume of the Error return by the pipeline parserPhilip Pfaffe2018-11-121-2/+3
| | | | llvm-svn: 346649
* [clangd] Remember to serialize AnyScope in FuzzyFindRequest json.Eric Liu2018-11-121-1/+2
| | | | llvm-svn: 346648
* Add an OptimizerLast EPPhilip Pfaffe2018-11-124-0/+36
| | | | | | | | | | | | | | | | | Summary: It turns out that we need an OptimizerLast PassBuilder extension point after all. I missed the relevance of this EP the first time. By legacy PM magic, function passes added at this EP get added to the last _Function_ PM, which is a feature we lost when dropping this EP for the new PM. A key difference between this and the legacy PassManager's OptimizerLast callback is that this extension point is not triggered at O0. Extensions to the O0 pipeline should append their passes to the end of the overall pipeline. Differential Revision: https://reviews.llvm.org/D54374 llvm-svn: 346645
* [GCOV] fix test after patch rL346642Calixte Denizet2018-11-121-18/+18
| | | | | | | | | | | | | | | | | Summary: Test is failing under windows, so fix it. Should fix: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1390/steps/stage%201%20check/logs/stdio Reviewers: marco-c Reviewed By: marco-c Subscribers: cfe-commits, sylvestre.ledru, marco-c Differential Revision: https://reviews.llvm.org/D54416 llvm-svn: 346644
* [LICM] Hoist guards from non-header blocksMax Kazantsev2018-11-126-14/+227
| | | | | | | | | | | This patch relaxes overconservative checks on whether or not we could write memory before we execute an instruction. This allows us to hoist guards out of loops even if they are not in the header block. Differential Revision: https://reviews.llvm.org/D50891 Reviewed By: fedor.sergeev llvm-svn: 346643
* [Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to ↵Calixte Denizet2018-11-1210-0/+182
| | | | | | | | | | | | | | | | | | | | | | filter the files to instrument with gcov Summary: These options are taking regex separated by colons to filter files. - if both are empty then all files are instrumented - if -fprofile-filter-files is empty then all the filenames matching any of the regex from exclude are not instrumented - if -fprofile-exclude-files is empty then all the filenames matching any of the regex from filter are instrumented - if both aren't empty then all the filenames which match any of the regex in filter and which don't match all the regex in filter are instrumented - this patch is a follow-up of https://reviews.llvm.org/D52033 Reviewers: marco-c, vsk Reviewed By: marco-c, vsk Subscribers: cfe-commits, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D52034 llvm-svn: 346642
* [GCOV] Add options to filter files which must be instrumented.Calixte Denizet2018-11-122-2/+88
| | | | | | | | | | | | | | | | | | | | Summary: When making code coverage, a lot of files (like the ones coming from /usr/include) are removed when post-processing gcno/gcda so finally they doen't need to be instrumented nor to appear in gcno/gcda. The goal of the patch is to be able to filter the files we want to instrument, there are several advantages to do that: - improve speed (no overhead due to instrumentation on files we don't care) - reduce gcno/gcda size - it gives the possibility to easily instrument only few files (e.g. ones modified in a patch) without changing the build system - need to accept this patch to be enabled in clang: https://reviews.llvm.org/D52034 Reviewers: marco-c, vsk Reviewed By: marco-c Subscribers: llvm-commits, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D52033 llvm-svn: 346641
* Release notes: Mention clang-cl's /Zc:dllexportInlines- flagHans Wennborg2018-11-121-0/+5
| | | | llvm-svn: 346640
* clang-cl: Add documentation for /Zc:dllexportInlines-Hans Wennborg2018-11-122-2/+80
| | | | | | Differential revision: https://reviews.llvm.org/D54319 llvm-svn: 346639
* [clangd] Fix compile on very old glibcSam McCall2018-11-121-1/+2
| | | | llvm-svn: 346638
* [SystemZ] Replicate the load with most uses in buildVector()Jonas Paulsson2018-11-122-8/+30
| | | | | | | | | | | Iterate over all elements and count the number of uses among them for each used load. Then make sure to REPLICATE the load which has the most uses in order to minimize the number of needed element insertions. Review: Ulrich Weigand https://reviews.llvm.org/D54322 llvm-svn: 346637
* [llvm-objdump] add more constraints for testsFangrui Song2018-11-122-4/+8
| | | | | | | | | | | | Patch by Higuoxing (Xing) Reviewers: jhenderson Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D54299 llvm-svn: 346636
* Fix compatibility with z3-4.8.1Jan Kratochvil2018-11-121-1/+1
| | | | | | | | | | | | | | | | | With z3-4.8.1: ../tools/clang/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:49:40: error: 'Z3_get_error_msg_ex' was not declared in this scope ../tools/clang/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:49:40: note: suggested alternative: 'Z3_get_error_msg' Formerly used Z3_get_error_msg_ex() as one could find in z3-4.7.1 states: "Retained function name for backwards compatibility within v4.1" And it is implemented only as a forwarding call: return Z3_get_error_msg(c, err); Differential Revision: https://reviews.llvm.org/D54391 llvm-svn: 346635
* Update to-do list with new work from WG21 meeting in San DiegoMarshall Clow2018-11-121-1/+71
| | | | llvm-svn: 346634
* Support Swift in platform availability attributeMichael Wu2018-11-127-0/+63
| | | | | | | | | | | | | | Summary: This adds support for Swift platform availability attributes. It's largely a port of the changes made to https://github.com/apple/swift-clang/ for Swift availability attributes. Specifically, https://github.com/apple/swift-clang/commit/84b5a21c31cb5b0d7d958a478bc01964939b6952 and https://github.com/apple/swift-clang/commit/e5b87f265aede41c8381094bbf54e2715c8293b0 . The implementation of attribute_availability_swift is a little different and additional tests in test/Index/availability.c were added. Reviewers: manmanren, friss, doug.gregor, arphaman, jfb, erik.pilkington, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, ColinKinloch, jrmuizel, cfe-commits Differential Revision: https://reviews.llvm.org/D50318 llvm-svn: 346633
* [GC] Remove unused configuration variablePhilip Reames2018-11-122-12/+1
| | | | | | The custom root mechanism didn't actually do anything. ShadowStackGC, the only one which used it, just removed the gcroots before they reached the normal lowering in SelectionDAG. As a result, the state flag had no value. llvm-svn: 346632
* [GC] Minor style modernizationPhilip Reames2018-11-121-44/+43
| | | | llvm-svn: 346631
* [NFC] Reformat std::optional testsLouis Dionne2018-11-122-4/+4
| | | | llvm-svn: 346630
* [NFC] Fix typo in <tuple>Louis Dionne2018-11-121-1/+1
| | | | llvm-svn: 346629
* [CodeGen][CXX]: Fix no_destroy CG bug under specific circumstancesKristina Brooks2018-11-122-0/+51
| | | | | | | | | | | | | | | | | | Summary: Class with no user-defined destructor that has an inherited member that has a non-trivial destructor and a non-default constructor will attempt to emit a destructor despite being marked as __attribute((no_destroy)) in which case it would trigger an assertion due to an incorrect assumption. In addition this adds missing test coverage for IR generation for no_destroy. (Note that here use of no_destroy is synonymous with its global flag counterpart `-fno-c++-static-destructors` being enabled) Differential Revision: https://reviews.llvm.org/D54344 llvm-svn: 346628
* [IPSCCP] Delete two forward declarationsFangrui Song2018-11-111-2/+0
| | | | | | | | | | | | | | Summary: Use forward declaration as the reviewer is in favor of #include and delete a redundant declaration of Function. Reviewers: fhahn Reviewed By: fhahn Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D54398 llvm-svn: 346627
* Remove header grouping comments.Jonas Devlieghere2018-11-11733-2684/+26
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-11168-936/+932
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* [llvm-nm] Use WithColor for error reportingJonas Devlieghere2018-11-112-8/+9
| | | | | | Use helpers from Support/WithError.h to print errors. llvm-svn: 346624
* [llvm-objdump] Use WithColor for error reportingJonas Devlieghere2018-11-113-68/+95
| | | | | | Use helpers from Support/WithError.h to print errors. llvm-svn: 346623
* [llvm-undname] Use WithColor for error reportingJonas Devlieghere2018-11-111-1/+2
| | | | | | Use helpers from Support/WithError.h to print errors. llvm-svn: 346622
* [GCRoot] Remove some unneccessary complexityPhilip Reames2018-11-113-68/+33
| | | | | | | | | The GCStrategy provides three configuration options were are largely redundant. 1) Support for conditionally lowering gcread and gcwrite to loads and stores. This is redundant since any GC which wished to use these abstractions would lower them out of existance before the built in lowering anyways. As such, there's no need to have the lowering being conditional. 2) Conditional initialization for allocas marked via gcroot. Semantically, roots have to be initialized before first potential use. Arguably, the frontend really should have responsibility for that, but the old API allowed the frontend to ignore this detail. Only one builtin GC used the non-initializing mode. Since no one to my knowledge actually uses the ErlangGC strategy, I decide the slight pessimization was worth the simplicity. If that turns out to be problematic, we can always improve the insertion algorithm to detect more existing initializing stores. llvm-svn: 346621
* [IPSCCP] Use forward declaration.Florian Hahn2018-11-111-0/+1
| | | | llvm-svn: 346620
* [IPSCCP,PM] Add missing #include in rL346618Fangrui Song2018-11-111-0/+1
| | | | llvm-svn: 346619
* [IPSCCP,PM] Preserve PDT in the new pass manager.Florian Hahn2018-11-114-23/+18
| | | | | | | | | | Reviewers: kuhar, chandlerc, NutshellySima, brzycki Reviewed By: NutshellySima, brzycki Differential Revision: https://reviews.llvm.org/D54317 llvm-svn: 346618
* [MC] Fix 3 objdump tests after rL346610Fangrui Song2018-11-113-10/+10
| | | | llvm-svn: 346617
* [ELF] Change GnuPub{Names,Types}Section from StringRef to LLDDWARFSectionFangrui Song2018-11-113-23/+24
| | | | | | | | | | | | | | | Summary: The debug_info_offset value may be relocated. This is lld side change of D54375. Reviewers: ruiu, dblaikie, grimar, espindola Subscribers: emaste, arichardson, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D54376 llvm-svn: 346616
* [DWARF] Change pubnames to use DWARFSection instead of StringRefFangrui Song2018-11-116-32/+72
| | | | | | | | | | | | | | Summary: The debug_info_offset values in .debug_{,gnu_}pub{name,types} may be relocated. Change it to DWARFSection so that we can get relocated values. Reviewers: ruiu, dblaikie, grimar, JDevlieghere Reviewed By: JDevlieghere Subscribers: aprantl, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D54375 llvm-svn: 346615
* [ELF] Fix relocation-common.s after rL346610Fangrui Song2018-11-111-6/+6
| | | | llvm-svn: 346614
OpenPOWER on IntegriCloud