1. Apr 19, 2019
    • Martin Storsjo's avatar
      [MinGW] Add an --appcontainer flag, passed through to lld-link · 2c1f3ea5
      Martin Storsjo authored
      GNU ld doesn't have such a flag though, so this is a lld specific
      option.
      
      Differential Revision: https://reviews.llvm.org/D60860
      
      llvm-svn: 358759
      2c1f3ea5
    • Sylvestre Ledru's avatar
      Debian: Add two missing version code in sid · 5505ad34
      Sylvestre Ledru authored
      llvm-svn: 358758
      5505ad34
    • Sylvestre Ledru's avatar
    • Sylvestre Ledru's avatar
      Add support of the next Ubuntu (Ubuntu 19.10 - Eoan EANIMAL) · 45401419
      Sylvestre Ledru authored
      llvm-svn: 358756
      45401419
    • Nico Weber's avatar
      gn build: Merge r358722 · e579800b
      Nico Weber authored
      llvm-svn: 358755
      e579800b
    • Nico Weber's avatar
      gn build: Merge r358691 · ea622ef4
      Nico Weber authored
      llvm-svn: 358754
      ea622ef4
    • Florian Hahn's avatar
      [LTO] Add plumbing to save stats during LTO on Darwin. · b340497f
      Florian Hahn authored
      Gold and ld on Linux already support saving stats, but the
      infrastructure is missing on Darwin. Unfortunately it seems like the
      configuration from lib/LTO/LTO.cpp is not used.
      
      This patch adds a new LTOStatsFile option and adds plumbing in Clang to
      use it on Darwin, similar to the way remarks are handled.
      
      Currnetly the handling of LTO flags seems quite spread out, with a bunch
      of duplication. But I am not sure if there is an easy way to improve
      that?
      
      Reviewers: anemet, tejohnson, thegameg, steven_wu
      
      Reviewed By: steven_wu
      
      Differential Revision: https://reviews.llvm.org/D60516
      
      llvm-svn: 358753
      b340497f
    • Kristof Umann's avatar
      [analyzer][NFC] Reimplement checker options · b4788b26
      Kristof Umann authored
      TL;DR:
      
      * Add checker and package options to the TableGen files
      * Added a new class called CmdLineOption, and both Package and Checker recieved
         a list<CmdLineOption> field.
      * Added every existing checker and package option to Checkers.td.
      * The CheckerRegistry class
        * Received some comments to most of it's inline classes
        * Received the CmdLineOption and PackageInfo inline classes, a list of
           CmdLineOption was added to CheckerInfo and PackageInfo
        * Added addCheckerOption and addPackageOption
        * Added a new field called Packages, used in addPackageOptions, filled up in
           addPackage
      
      Detailed description:
      
      In the last couple months, a lot of effort was put into tightening the
      analyzer's command line interface. The main issue is that it's spectacularly
      easy to mess up a lenghty enough invocation of the analyzer, and the user was
      given no warnings or errors at all in that case.
      
      We can divide the effort of resolving this into several chapters:
      
      * Non-checker analyzer configurations:
          Gather every analyzer configuration into a dedicated file. Emit errors for
          non-existent configurations or incorrect values. Be able to list these
          configurations. Tighten AnalyzerOptions interface to disallow making such
          a mistake in the future.
      
      * Fix the "Checker Naming Bug" by reimplementing checker dependencies:
          When cplusplus.InnerPointer was enabled, it implicitly registered
          unix.Malloc, which implicitly registered some sort of a modeling checker
          from the CStringChecker family. This resulted in all of these checker
          objects recieving the name "cplusplus.InnerPointer", making AnalyzerOptions
          asking for the wrong checker options from the command line:
            cplusplus.InnerPointer:Optimisic
          istead of
            unix.Malloc:Optimistic.
          This was resolved by making CheckerRegistry responsible for checker
          dependency handling, instead of checkers themselves.
      
      * Checker options: (this patch included!)
          Same as the first item, but for checkers.
      
      (+ minor fixes here and there, and everything else that is yet to come)
      
      There were several issues regarding checker options, that non-checker
      configurations didn't suffer from: checker plugins are loaded runtime, and they
      could add new checkers and new options, meaning that unlike for non-checker
      configurations, we can't collect every checker option purely by generating code.
      Also, as seen from the "Checker Naming Bug" issue raised above, they are very
      rarely used in practice, and all sorts of skeletons fell out of the closet while
      working on this project.
      
      They were extremely problematic for users as well, purely because of how long
      they were. Consider the following monster of a checker option:
      
        alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=false
      
      While we were able to verify whether the checker itself (the part before the
      colon) existed, any errors past that point were unreported, easily resulting
      in 7+ hours of analyses going to waste.
      
      This patch, similarly to how dependencies were reimplemented, uses TableGen to
      register checker options into Checkers.td, so that Checkers.inc now contains
      entries for both checker and package options. Using the preprocessor,
      Checkers.inc is converted into code in CheckerRegistry, adding every builtin
      (checkers and packages that have an entry in the Checkers.td file) checker and
      package option to the registry. The new addPackageOption and addCheckerOption
      functions expose the same functionality to statically-linked non-builtin and
      plugin checkers and packages as well.
      
      Emitting errors for incorrect user input, being able to list these options, and
      some other functionalies will land in later patches.
      
      Differential Revision: https://reviews.llvm.org/D57855
      
      llvm-svn: 358752
      b4788b26
    • Fangrui Song's avatar
      Change \r\n -> \n for llvm-symbolizer/help.test after rL358749 · a64fcb6d
      Fangrui Song authored
      llvm-svn: 358751
      a64fcb6d
    • Kristof Umann's avatar
      [analyzer] Fix an assertion failure if plugins added dependencies · cd3f1474
      Kristof Umann authored
      Ideally, there is no reason behind not being able to depend on checkers that
      come from a different plugin (or on builtin checkers) -- however, this is only
      possible if all checkers are added to the registry before resolving checker
      dependencies. Since I used a binary search in my addDependency method, this also
      resulted in an assertion failure (due to CheckerRegistry::Checkers not being
      sorted), since the function used by plugins to register their checkers
      (clang_registerCheckers) calls addDependency.
      
      This patch resolves this issue by only noting which dependencies have to
      established when addDependency is called, and resolves them at a later stage
      when no more checkers are added to the registry, by which point
      CheckerRegistry::Checkers is already sorted.
      
      Differential Revision: https://reviews.llvm.org/D59461
      
      llvm-svn: 358750
      cd3f1474
    • Igor Kudrin's avatar
      [llvm-symbolizer] Add llvm-addr2line · 99f641cc
      Igor Kudrin authored
      This adds an alias for llvm-symbolizer with different defaults so that
      it can be used as a drop-in replacement for GNU's addr2line.
      
      If a substring "addr2line" is found in the tool's name:
        * it defaults "-i", "-f" and "-C" to OFF;
        * it uses "--output-style=GNU" by default.
      
      Differential Revision: https://reviews.llvm.org/D60067
      
      llvm-svn: 358749
      99f641cc
    • Igor Kudrin's avatar
      [llvm-symbolizer] Unhide and document the "-output-style" option · 1b71b7f3
      Igor Kudrin authored
      With the latest changes, the option gets useful for users of
      llvm-symbolizer, not only for the upcoming llvm-addr2line.
      
      Differential Revision: https://reviews.llvm.org/D60816
      
      llvm-svn: 358748
      1b71b7f3
    • Igor Kudrin's avatar
      [llvm-symbolizer] Make the output with -output-style=GNU closer to addr2line's · 4bc29cbf
      Igor Kudrin authored
      This patch addresses two differences in the output of llvm-symbolizer
      and GNU's addr2line:
      
      * llvm-symbolizer prints an empty line after the report for an address.
      
      * With "-f -i=0", llvm-symbolizer replaces the name of an inlined
        function with the name from the symbol table, i. e., the top caller
        function in the inlining chain. addr2line preserves the name of the
        inlined function.
      
      Differential Revision: https://reviews.llvm.org/D60770
      
      llvm-svn: 358747
      4bc29cbf
    • Simon Pilgrim's avatar
      [AMDGPU] Regenerate extractelt->truncate test. · 4c09b7d9
      Simon Pilgrim authored
      Prep work for D60462
      
      llvm-svn: 358746
      4c09b7d9
    • Bjorn Pettersson's avatar
      [LibTooling] Fix -Wsign-compare after r358697 · 18b04425
      Bjorn Pettersson authored
      llvm-svn: 358745
      18b04425
    • Bjorn Pettersson's avatar
      [CodeGen] Add "const" to MachineInstr::mayAlias · 238c9d63
      Bjorn Pettersson authored
      Summary:
      The basic idea here is to make it possible to use
      MachineInstr::mayAlias also when the MachineInstr
      is const (or the "Other" MachineInstr is const).
      
      The addition of const in MachineInstr::mayAlias
      then rippled down to the need for adding const
      in several other places, such as
      TargetTransformInfo::getMemOperandWithOffset.
      
      Reviewers: hfinkel
      
      Reviewed By: hfinkel
      
      Subscribers: hfinkel, MatzeB, arsenm, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60856
      
      llvm-svn: 358744
      238c9d63
    • James Molloy's avatar
      [PATCH] [MachineScheduler] Check pending instructions when an instruction is scheduled · 9ad4cb3d
      James Molloy authored
      Pending instructions that may have been blocked from being available by the HazardRecognizer may no longer may not be blocked any more when an instruction is scheduled; pending instructions should be re-checked in this case.
      
      This is primarily aimed at VLIW targets with large parallelism and esoteric constraints.
      
      No testcase as no in-tree targets have this behavior.
      
      Differential revision: https://reviews.llvm.org/D60861
      
      llvm-svn: 358743
      9ad4cb3d
    • Fangrui Song's avatar
      [MergeFunc] Delete unused FunctionNode::release() · 7137b54a
      Fangrui Song authored
      llvm-svn: 358742
      7137b54a
    • Fangrui Song's avatar
      [MergeFunc] removeUsers: call remove() only on direct users · 884f557b
      Fangrui Song authored
      removeUsers uses a work list to collect indirect users and call remove()
      on those functions. However it has a bug (`if (!Visited.insert(UU).second)`).
      
      Actually, we don't have to collect indirect users.
      After the merge of F and G, G's callers will be considered (added to
      Deferred). If G's callers can be merged, G's callers' callers will be
      considered.
      
      Update the test unnamed-addr-reprocessing.ll to make it clear we can
      still merge indirect callers.
      
      llvm-svn: 358741
      884f557b
    • Piotr Sobczak's avatar
      [AMDGPU] Ignore non-SUnits edges · 72e2960e
      Piotr Sobczak authored
      Summary:
      Ignore edges to non-SUnits (e.g. ExitSU) when checking
      for low latency instructions.
      
      When calling the function isLowLatencyInstruction(),
      an ExitSU could be on the list of successors, not necessarily
      a regular SU. In other places in the code there is a check
      "Succ->NodeNum >= DAGSize" to prevent further processing of
      ExitSU as "Succ->getInstr()" is NULL in such a case.
      Also, 8 out of 9 cases of "SUnit *Succ = SuccDep.getSUnit())"
      has the guard, so it is clearly an omission here.
      
      Change-Id: Ica86f0327c7b2e6bcb56958e804ea6c71084663b
      
      Reviewers: nhaehnle
      
      Reviewed By: nhaehnle
      
      Subscribers: MatzeB, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60864
      
      llvm-svn: 358740
      72e2960e
    • Chandler Carruth's avatar
      [CallSite removal] Move the legacy PM, call graph, and some inliner · ce3f75df
      Chandler Carruth authored
      code to `CallBase`.
      
      This patch focuses on the legacy PM, call graph, and some of inliner and legacy
      passes interacting with those APIs from `CallSite` to the new `CallBase` class.
      No interesting changes.
      
      Differential Revision: https://reviews.llvm.org/D60412
      
      llvm-svn: 358739
      ce3f75df
    • Fangrui Song's avatar
      82216048
    • Craig Topper's avatar
      [X86] Turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the AND could match a movzx. · bb769a29
      Craig Topper authored
      Could get further improvements by recognizing (i64 and (anyext (i32 shl))).
      
      llvm-svn: 358737
      bb769a29
    • Craig Topper's avatar
      [X86] Add test cases for turning (and (shl X, C1), C2) into (shl (and X, (C1... · 2099ccbe
      Craig Topper authored
      [X86] Add test cases for turning (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) when the AND could match to a movzx.
      
      We already reorder when C1 >> C2 would allow a smaller immediate encoding.
      
      llvm-svn: 358736
      2099ccbe
    • Craig Topper's avatar
      [X86] Make sure we copy the HandleSDNode back to N before executing the... · f73caae9
      Craig Topper authored
      [X86] Make sure we copy the HandleSDNode back to N before executing the default code after the switch in matchAddressRecursively
      
      Summary:
      There are two places where we create a HandleSDNode in address matching in order to handle the case where N is changed by CSE. But if we end up not matching, we fall back to code at the bottom of the switch that really would like N to point to something that wasn't CSEd away. So we should make sure we copy the handle back to N on any paths that can reach that code.
      
      This appears to be the true reason we needed to check DELETED_NODE in the negation matching. In pr32329.ll we had two subtracts back to back. We recursed through the first subtract, and onto the second subtract. The second subtract called matchAddressRecursively on its LHS which caused that subtract to CSE. We ultimately failed the match and ended up in the default code. But N was pointing at the old node that had been deleted, but the default code didn't know that and took it as the base register. Then we unwound back to the first subtract and tried to access this bogus base reg requiring the check for deleted node. With this patch we now use the CSE result as the base reg instead.
      
      matchAdd has been broken since sometime in 2015 when it was pulled out of the switch into a helper function. The assignment to N at the end was still there, but N was passed by value and not by reference so the update didn't go anywhere.
      
      Reviewers: niravd, spatel, RKSimon, bkramer
      
      Reviewed By: niravd
      
      Subscribers: llvm-commits, hiraditya
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60843
      
      llvm-svn: 358735
      f73caae9
    • Fangrui Song's avatar
      [DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732 · 9a331bba
      Fangrui Song authored
      llvm-svn: 358734
      9a331bba
    • Richard Smith's avatar
      Fix overly-long line after r358731. · 96451e3a
      Richard Smith authored
      llvm-svn: 358733
      96451e3a
    • Ali Tamur's avatar
      [llvm] Prevent duplicate files in debug line header in dwarf 5: another attempt · 783d84bb
      Ali Tamur authored
      Another attempt to land the changes in debug line header to prevent duplicate
      files in Dwarf 5. I rolled back my previous commit because of a mistake in
      generating the object file in a test. Meanwhile, I addressed some offline
      comments and changed the implementation; the largest difference is that
      MCDwarfLineTableHeader does not keep DwarfVersion but gets it as a parameter. I
      also merged the patch to fix two lld tests that will strt to fail into this
      patch.
      
      Original Commit:
      
      https://reviews.llvm.org/D59515
      
      Original Message:
      Motivation: In previous dwarf versions, file name indexes started from 1, and
      the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes
      the primary source file to be explicitly given an entry with an index number 0.
      
      The current implementation honors the specification by just duplicating the
      main source file, once with index number 0, and later maybe with another
      index number. While this is compliant with the letter of the standard, the
      duplication causes problems for consumers of this information such as lldb.
      (Some files are duplicated, where only some of them have a line table although
      all refer to the same file)
      
      With this change, dwarf 5 debug line section files always start from 0, and
      the zeroth entry is not duplicated whenever possible. This requires different
      handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns
      an index zero for a file name, it signals an error in dwarf 4, but not in dwarf
      5) However, I think the minor complication is worth it, because it enables all
      consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the
      file name list homogenously.
      
      llvm-svn: 358732
      783d84bb
    • Ali Tamur's avatar
      Fix typo in function name [NFC] · b6a8a6ca
      Ali Tamur authored
      llvm-svn: 358731
      b6a8a6ca
    • Fangrui Song's avatar
      [APInt] Optimize umul_ov · acc7641b
      Fangrui Song authored
      Change two costly udiv() calls to lshr(1)*RHS + left-shift + plus
      
      On one 64-bit umul_ov benchmark, I measured an obvious improvement: 12.8129s -> 3.6257s
      
      Note, there may be some value to special case 64-bit (the most common
      case) with __builtin_umulll_overflow().
      
      Differential Revision: https://reviews.llvm.org/D60669
      
      llvm-svn: 358730
      acc7641b
    • Fangrui Song's avatar
      [analyzer] Fix -Wunused-local-typedef after rC358695 · 9206335e
      Fangrui Song authored
      llvm-svn: 358729
      9206335e
    • Saleem Abdulrasool's avatar
      MergeFunc: preserve COMDAT information when creating a thunk · b96d9b34
      Saleem Abdulrasool authored
      We would previously drop the COMDAT on the thunk we generated when replacing a
      function body with the forwarding thunk. This would result in a function that
      may have been multiply emitted and multiply merged to be emitted with the same
      name without the COMDAT. This is a hard error with PE/COFF where the COMDAT is
      used for the deduplication of Value Witness functions for Swift.
      
      llvm-svn: 358728
      b96d9b34
    • Kostya Serebryany's avatar
      [libFuzzer] revert part of r358726 committed by mistake (oops) · 14ada6d1
      Kostya Serebryany authored
      llvm-svn: 358727
      14ada6d1
    • Kostya Serebryany's avatar
      [libFuzzer] in fork mode, make sure the child stats are always collected. This... · bbb8522b
      Kostya Serebryany authored
      [libFuzzer] in fork mode, make sure the child stats are always collected. This should fix the flakiness in fork-ubsan.test
      
      llvm-svn: 358726
      bbb8522b
    • Thomas Anderson's avatar
      [libc++] Make __debug_less::operator() constexpr · 6ab51de0
      Thomas Anderson authored
      This is a followup to [1] which added a new `__debug_less::operator()` overload.
      [2] added `_LIBCPP_CONSTEXPR_AFTER_CXX17` to the original
      `__debug_less::operator()` between the time of writing [1] and landing it.  This
      change adds `_LIBCPP_CONSTEXPR_AFTER_CXX17` to the new overload too.
      
      [1] https://reviews.llvm.org/rL358423
      [2] https://reviews.llvm.org/rL358252
      
      Differential Revision: https://reviews.llvm.org/D60724
      
      llvm-svn: 358725
      6ab51de0
    • Ali Tamur's avatar
      Add header guard to Reusables.h [NFC] · 5377748d
      Ali Tamur authored
      llvm-svn: 358724
      5377748d
    • Alina Sbirlea's avatar
      [LoopUnroll] Move list of params into a struct [NFCI]. · da0f71af
      Alina Sbirlea authored
      Summary: Cleanup suggested in review of r358304.
      
      Reviewers: sanjoy, efriedma
      
      Subscribers: jlebar, zzheng, dmgreen, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60638
      
      llvm-svn: 358723
      da0f71af
    • Artem Dergachev's avatar
      [analyzer] Make default bindings to variables actually work. · 9b02a9b4
      Artem Dergachev authored
      Default RegionStore bindings represent values that can be obtained by loading
      from anywhere within the region, not just the specific offset within the region
      that they are said to be bound to. For example, default-binding a character \0
      to an int (eg., via memset()) means that the whole int is 0, not just
      that its lower byte is 0.
      
      Even though memset and bzero were modeled this way, it didn't work correctly
      when applied to simple variables. Eg., in
      
        int x;
        memset(x, 0, sizeof(x));
      
      we did produce a default binding, but were unable to read it later, and 'x'
      was perceived as an uninitialized variable even after memset.
      
      At the same time, if we replace 'x' with a variable of a structure or array
      type, accessing fields or elements of such variable was working correctly,
      which was enough for most cases. So this was only a problem for variables of
      simple integer/enumeration/floating-point/pointer types.
      
      Fix loading default bindings from RegionStore for regions of simple variables.
      
      Add a unit test to document the API contract as well.
      
      Differential Revision: https://reviews.llvm.org/D60742
      
      llvm-svn: 358722
      9b02a9b4
    • Davide Italiano's avatar
      [Python] Simplify the code. NFCI. · 185de8ee
      Davide Italiano authored
      llvm-svn: 358721
      185de8ee
    • Artem Dergachev's avatar
      [analyzer] NFC: Make reusable unittest mocks reusable. · 7cc87be4
      Artem Dergachev authored
      Put them in a header for other Analyzer unittests to include.
      
      Differential Revision: https://reviews.llvm.org/D60739
      
      llvm-svn: 358720
      7cc87be4