1. Oct 10, 2019
  2. Oct 09, 2019
    • Alina Sbirlea's avatar
      [MemorySSA] Make the use of moveAllAfterMergeBlocks consistent. · 7faa14a9
      Alina Sbirlea authored
      Summary:
      The rule for the moveAllAfterMergeBlocks API si for all instructions
      from `From` to have been moved to `To`, while keeping the CFG edges (and
      block terminators) unchanged.
      Update all the callsites for moveAllAfterMergeBlocks to follow this.
      
      Pending follow-up: since the same behavior is needed everytime, merge
      all callsites into one. The common denominator may be the call to
      `MergeBlockIntoPredecessor`.
      
      Resolves PR43569.
      
      Reviewers: george.burgess.iv
      
      Subscribers: Prazek, sanjoy.google, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68659
      
      llvm-svn: 374177
      7faa14a9
    • Mitchell Balan's avatar
      [NFC] Reverting changes from test commit. · 77c9736e
      Mitchell Balan authored
      llvm commit access test succeeded.
      
      llvm-svn: 374175
      77c9736e
    • Mitchell Balan's avatar
      [NFC] Test commit. · 791b0e41
      Mitchell Balan authored
      Testing llvm commit access only.
      
      llvm-svn: 374174
      791b0e41
    • Kostya Kortchinsky's avatar
      [scudo][standalone] Get statistics in a char buffer · f7b1489f
      Kostya Kortchinsky authored
      Summary:
      Following up on D68471, this CL introduces some `getStats` APIs to
      gather statistics in char buffers (`ScopedString` really) instead of
      printing them out right away. Ultimately `printStats` will just
      output the buffer, but that allows us to potentially do some work
      on the intermediate buffer, and can be used for a `mallocz` type
      of functionality. This allows us to pretty much get rid of all the
      `Printf` calls around, but I am keeping the function in for
      debugging purposes.
      
      This changes the existing tests to use the new APIs when required.
      
      I will add new tests as suggested in D68471 in another CL.
      
      Reviewers: morehouse, hctim, vitalybuka, eugenis, cferris
      
      Reviewed By: morehouse
      
      Subscribers: delcypher, #sanitizers, llvm-commits
      
      Tags: #llvm, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D68653
      
      llvm-svn: 374173
      f7b1489f
    • Krasimir Georgiev's avatar
      [clang-format] Update noexcept reference qualifiers detection · ae1b7859
      Krasimir Georgiev authored
      Summary:
      r373165 fixed an issue where a templated noexcept member function with a
      reference qualifier would be indented more than expected:
      ```
      // Formatting produced with LLVM style with AlwaysBreakTemplateDeclarations: Yes
      
      // before r373165:
      struct f {
        template <class T>
            void bar() && noexcept {}
      };
      
      // after:
      struct f {
        template <class T>
        void bar() && noexcept {}
      };
      
      ```
      The way this is done is that in the AnnotatingParser in
      `lib/FormatTokenAnnotator.cpp` the determination of the usage of a `&` or `&&`
      (the line in determineTokenType
      
      ```
      Current.Type = determineStarAmpUsage(...
      ```
      is not performed in some cases anymore, combining with a few additional related
      checks afterwards. The net effect of these checks results in the `&` or `&&`
      token to start being classified as `TT_Unknown` in cases where before `r373165`
      it would be classified as `TT_UnaryOperator` or `TT_PointerOrReference` by
      `determineStarAmpUsage`.
      
      This inadvertently caused 2 classes of regressions I'm aware of:
      
      - The address-of `&` after a function assignment would be classified as
        `TT_Unknown`, causing spaces to surround it, disregarding style options:
      ```
      // before r373165:
      void (*fun_ptr)(void) = &fun;
      
      // after:
      void (*fun_ptr)(void) = & fun;
      ```
      
      - In cases where there is a function declaration list -- looking macro between
        a template line and the start of the function declaration, an `&` as part of
        the return type would be classified as `TT_Unknown`, causing spaces to
        surround it:
      ```
      // before r373165:
      template <class T>
      DEPRECATED("lala")
      Type& foo();
      
      // after:
      template <class T>
      DEPRECATED("lala")
      Type & foo();
      ```
      
      In these cases the problems are rooted in the skipping of the classification of
      a `&` (and similarly `&&`) by determineStarAmpUsage which effects the formatting
      decisions later in the pipeline.
      
      I've looked into the goal of r373165 and noticed that replacing `noexcept` with
      `const` in the given example produces no extra indentation with the old code:
      ```
      // before r373165:
      struct f {
        template <class T>
        int foo() & const {}
      };
      
      struct f {
        template <class T>
            int foo() & noexcept {}
      };
      ```
      
      I investigated how clang-format annotated these two examples differently to
      determine the places where the processing of both diverges in the pipeline.
      There were two places where the processing diverges, causing the extra indent in
      the `noexcept` case:
      1. The `const` is annotated as a `TT_TrailingAnnotation`, whereas `noexcept`
         is annotated as `TT_Unknown`. I've updated the `determineTokenType` function
         to account for this by adding a missing `tok:kw_noexcept` to the clause that
         marks a token as `TT_TrailingAnnotation`.
      2. The `&` in the second example is wrongly identified as `TT_BinaryOperator`
         in `determineStarAmpUsage`. This is the reason for the extra indentation --
         clang-format gets confused and thinks this is an expression.
         I've updated `determineStarAmpUsage` to check for `tok:kw_noexcept`.
      
      With these two updates in place, the additional parsing introduced by r373165
      becomes unnecessary and all added tests pass (with updates, as now clang-format
      respects the style configuration for spaces around the `&` in the test
      examples).
      I've removed these additions and added regression tests for the cases above.
      
      Reviewers: AndWass, MyDeveloperDay
      
      Reviewed By: MyDeveloperDay
      
      Subscribers: cfe-commits
      
      Tags: #clang, #clang-format
      
      Differential Revision: https://reviews.llvm.org/D68695
      
      llvm-svn: 374172
      ae1b7859
    • Simon Pilgrim's avatar
      Fix Wdocumentation unknown parameter warning. NFCI. · 604b7c22
      Simon Pilgrim authored
      llvm-svn: 374171
      604b7c22
    • Clement Courbet's avatar
      [llvm-exegesis] Ensure that ExecutableFunction are aligned. · 04a9a0eb
      Clement Courbet authored
      Summary: Experiments show that this is the alignment we get (for ELF+Linux), but let's ensure that we have it.
      
      Reviewers: gchatelet
      
      Subscribers: tschuett, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68703
      
      llvm-svn: 374170
      04a9a0eb
    • David Green's avatar
      Add and adjust saturating tests. NFC · fcc9c462
      David Green authored
      This adds some extra testing to the existing [su][add/sub]_sat X86 and AArch64
      tests and adds equivalent tests for ARM.
      
      llvm-svn: 374169
      fcc9c462
    • Kadir Cetinkaya's avatar
      [clangd] Make sure ReplyCallbacks are destroyed before RequestCancelersMutex · 9a3a87d1
      Kadir Cetinkaya authored
      Summary:
      After rL374163, replycallbacks might have a cancellable context, which
      will try to access RequestCancellers on destruction. See
      http://45.33.8.238/mac/1245/step_7.txt for a sample failure.
      
      Reviewers: sammccall
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits, thakis
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D68702
      
      llvm-svn: 374168
      9a3a87d1
    • Michael Liao's avatar
      [clang-offload-bundler] Support `.cui` and `.d`. · 2ae54aba
      Michael Liao authored
      Reviewers: tra, yaxunl
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D68663
      
      llvm-svn: 374167
      2ae54aba
    • Sjoerd Meijer's avatar
      [LV] Emitting SCEV checks with OptForSize · d1170dbe
      Sjoerd Meijer authored
      When optimising for size and SCEV runtime checks need to be emitted to check
      overflow behaviour, the loop vectorizer can run in this assert:
      
        LoopVectorize.cpp:2699: void llvm::InnerLoopVectorizer::emitSCEVChecks(
        llvm::Loop *, llvm::BasicBlock *): Assertion `!BB->getParent()->hasOptSize()
        && "Cannot SCEV check stride or overflow when opt
      
      We should not generate predicates while optimising for size because
      code will be generated for predicates such as these SCEV overflow runtime
      checks.
      
      This should fix PR43371.
      
      Differential Revision: https://reviews.llvm.org/D68082
      
      llvm-svn: 374166
      d1170dbe
    • Simon Atanasyan's avatar
      [mips] Rename local variable. NFC · dde0fe5d
      Simon Atanasyan authored
      llvm-svn: 374165
      dde0fe5d
    • Simon Atanasyan's avatar
      [mips] Split expandLoadImmReal into multiple methods. NFC · 83c8853f
      Simon Atanasyan authored
      The `expandLoadImmReal` handles four different and almost non-overlapping
      cases: loading a "single" float immediate into a GPR, loading a "single"
      float immediate into a FPR, and the same couple for a "double" float
      immediate.
      
      It's better to move each `else if` branch into separate methods.
      
      llvm-svn: 374164
      83c8853f
    • Kadir Cetinkaya's avatar
      [clangd] Propagate context into reply handlers · 1bb91093
      Kadir Cetinkaya authored
      llvm-svn: 374163
      1bb91093
    • Clement Courbet's avatar
      [llvm-exegesis] Fix r374158 · 64a83bb2
      Clement Courbet authored
      Some bots complain about missing 'class':
      
      LlvmState.h:70:40: error: declaration of ‘std::unique_ptr<const llvm::TargetMachine> llvm::exegesis::LLVMState::TargetMachine’ [-fpermissive]
         std::unique_ptr<const TargetMachine> TargetMachine;
      
      llvm-svn: 374162
      64a83bb2
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
    • David Green's avatar
      [ARM] Add saturating arithmetic tests for MVE. NFC · e2c72929
      David Green authored
      llvm-svn: 374159
      e2c72929
    • Clement Courbet's avatar
      [llvm-exegesis][NFC] Remove extra `llvm::` qualifications. · 50cdd56b
      Clement Courbet authored
      Summary: Second patch: in the lib.
      
      Reviewers: gchatelet
      
      Subscribers: nemanjai, tschuett, MaskRay, mgrang, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68692
      
      llvm-svn: 374158
      50cdd56b
    • Clement Courbet's avatar
      [llvm-exegesis][NFC] Remove extra `llvm::` qualifications. · d422d3a7
      Clement Courbet authored
      Summary: First patch: in unit tests.
      
      Subscribers: nemanjai, tschuett, MaskRay, jsji, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68687
      
      llvm-svn: 374157
      d422d3a7
    • Simon Atanasyan's avatar
      [mips] Set default float ABI to "soft" on FreeBSD · 60db8b79
      Simon Atanasyan authored
      Initial patch by Kyle Evans.
      
      Fix PR43596
      
      llvm-svn: 374154
      60db8b79
    • Nikola Prica's avatar
      [DebugInfo] Enable call site debug info for ARM and AArch64 · f71bac6f
      Nikola Prica authored
      ARM and AArch64 SelectionDAG support for tacking parameter forwarding
      register is implemented so we can allow clang invocations for those two
      targets.
      Beside that restrict debug entry value support to be emitted for
      LimitedDebugInfo info and FullDebugInfo. Other types of debug info do
      not have functions nor variables debug info.
      
      Reviewers: aprantl, probinson, dstenb, vsk
      
      Reviewed By: vsk
      
      Differential Revision: https://reviews.llvm.org/D67004
      
      llvm-svn: 374153
      f71bac6f
    • Ilya Biryukov's avatar
      [Sema] Emit diagnostics for uncorrected delayed typos at the end of TU · aeae71cd
      Ilya Biryukov authored
      Summary:
      Instead of asserting all typos are corrected in the sema destructor.
      
      The sema destructor is not run in the common case of running the compiler
      with the -disable-free cc1 flag (which is the default in the driver).
      
      Having this assertion led to crashes in libclang and clangd, which are not
      reproducible when running the compiler.
      
      Asserting at the end of the TU could be an option, but finding all
      missing typo correction cases is hard and having worse diagnostics instead
      of a failing assertion is a better trade-off.
      
      For more discussion on this, see:
      https://lists.llvm.org/pipermail/cfe-dev/2019-July/062872.html
      
      Reviewers: sammccall, rsmith
      
      Reviewed By: rsmith
      
      Subscribers: usaxena95, dgoldman, jkorous, vsapsai, rnk, kadircet, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D64799
      
      llvm-svn: 374152
      aeae71cd
    • Ilya Biryukov's avatar
      Revert r374006: Reland 'Add VFS support for sanitizers' blacklist' · df7ea71c
      Ilya Biryukov authored
      Also revert follow-up changes to the test.
      Reason: the patch breaks our internal clang-tidy integration.
      
      It's also unclear why we should use getRealPath instead of plumbing the
      VFS to SanitizerBlacklist, see original commit thread of cfe-commits for
      a discussion.
      
      llvm-svn: 374151
      df7ea71c
    • James Molloy's avatar
      [TableGen] Fix crash when using HwModes in CodeEmitterGen · 9948fe69
      James Molloy authored
      When an instruction has an encoding definition for only a subset of
      the available HwModes, ensure we just avoid generating an encoding
      rather than crash.
      
      llvm-svn: 374150
      9948fe69
    • Clement Courbet's avatar
      [llvm-exegesis] Add missing std::move in rL374146. · 66f05d73
      Clement Courbet authored
      This was breaking some bots:
      
      /home/buildbots/ppc64le-clang-lnt-test/clang-ppc64le-lnt/llvm/include/llvm/Support/Error.h:483:5:   required from ‘llvm::Expected<T>::Expected(OtherT&&, typename std::enable_if<std::is_convertible<_Rep2, _Rep>::value>::type*) [with OtherT = std::vector<llvm::exegesis::CodeTemplate>&; T = std::vector<llvm::exegesis::CodeTemplate>; typename std::enable_if<std::is_convertible<_Rep2, _Rep>::value>::type = void]’
      /home/buildbots/ppc64le-clang-lnt-test/clang-ppc64le-lnt/llvm/tools/llvm-exegesis/lib/X86/Target.cpp:238:20:   required from here
      /usr/include/c++/6/bits/stl_construct.h:75:7: error: use of deleted function ‘llvm::exegesis::CodeTemplate::CodeTemplate(const llvm::exegesis::CodeTemplate&)’
           { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      llvm-svn: 374149
      66f05d73
    • Hans Wennborg's avatar
      Unify the two CRC implementations · 1e1e3ba2
      Hans Wennborg authored
      David added the JamCRC implementation in r246590. More recently, Eugene
      added a CRC-32 implementation in r357901, which falls back to zlib's
      crc32 function if present.
      
      These checksums are essentially the same, so having multiple
      implementations seems unnecessary. This replaces the CRC-32
      implementation with the simpler one from JamCRC, and implements the
      JamCRC interface in terms of CRC-32 since this means it can use zlib's
      implementation when available, saving a few bytes and potentially making
      it faster.
      
      JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef.
      This patch changes it to ArrayRef<uint8_t> which I think is the best
      choice, and simplifies a few of the callers nicely.
      
      Differential revision: https://reviews.llvm.org/D68570
      
      llvm-svn: 374148
      1e1e3ba2
    • Clement Courbet's avatar
      [llvm-exegesis][NFC] Fix rL374146. · f8d482c0
      Clement Courbet authored
      Remove extra semicolon: Target.cpp:187:2: warning: extra ‘;’ [-Wpedantic]
      
      llvm-svn: 374147
      f8d482c0
    • Clement Courbet's avatar
      [llvm-exegesis] Explore LEA addressing modes. · c3a7fb75
      Clement Courbet authored
      Summary:
      This will help for PR32326.
      
      This shows the well-known issue with `RBP` and `R13` as base registers.
      
      Reviewers: gchatelet
      
      Subscribers: tschuett, llvm-commits, RKSimon, andreadb
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68646
      
      llvm-svn: 374146
      c3a7fb75
    • Raphael Isemann's avatar
      [lldb] Don't crash when the ASTImporter produces diagnostics but instead log them. · 4e969da3
      Raphael Isemann authored
      When playing with the C++ module prototype I noticed I can get LLDB to crash
      by making a result type that depends on __make_integer_seq (a BuiltinTemplate)
      which is not supported by the ASTImporter yet. This causes the ASTImporter to emit
      a diagnostic when copying the type to the ScratchASTContext. As deporting the result
      type is done after we are done parsing and the Clang's diagnostic engine asserts that
      it can only be used during parsing, it crashes LLDB while trying to render the diagnostic
      in the HandleDiagnostic method of ClangDiagnosticManagerAdapter.
      
      This patch just moves the HandleDiagnostic call to Clang behind our check that we still
      have a DiagnosticManager (which we remove after parsing) which prevents the assert
      from firing. We also shouldn't ignore such diagnostics, so I added a log statement for
      them.
      
      There doesn't seem to way to test this as these diagnostic only happen when we copy
      a node that's not supported by the ASTImporter which should never happen once
      we can copy everything with the ASTImporter, so every test case we add here will
      eventually become invalid.
      
      (Note that most of this diff is just whitespace changes as we now use an early exit
      instead of a huge 'if' block).
      
      llvm-svn: 374145
      4e969da3
    • Jeremy Morse's avatar
      Revert r374139, "[dsymutil] Fix handling of common symbols in multiple object files." · e9c8f6fe
      Jeremy Morse authored
      The added test files ("com", "com1.o", "com2.o") are reserved names on
      Windows, and makes 'git checkout' fail with a filesystem error.
      
      llvm-svn: 374144
      e9c8f6fe
    • Clement Courbet's avatar
      [llvm-exegesis][NFC] Remove unecessary `using llvm::` directives. · 2caa3a26
      Clement Courbet authored
      We've been in namespace llvm for at least a year.
      
      llvm-svn: 374143
      2caa3a26
    • Rui Ueyama's avatar
      Use lld-link instead of llvm-dlltool to create an implib · 07775b20
      Rui Ueyama authored
      Suggested by Martin Storsjö.
      
      llvm-svn: 374142
      07775b20
    • Rui Ueyama's avatar
      [lld] Don't create hints-section if Hint/Name Table is empty · c3c5e0fb
      Rui Ueyama authored
      Fixes assert in addLinkerModuleCoffGroup() when using by-ordinal imports
      only.
      
      Patch by Stefan Schmidt.
      
      Differential revision: https://reviews.llvm.org/D68352
      
      llvm-svn: 374140
      c3c5e0fb
    • Jonas Devlieghere's avatar
      [dsymutil] Fix handling of common symbols in multiple object files. · 4ac388f7
      Jonas Devlieghere authored
      For common symbols the linker emits only a single symbol entry in the
      debug map. This caused dsymutil to not relocate common symbols when
      linking DWARF coming form object files that did not have this entry.
      This patch fixes that by keeping track of common symbols in the object
      files and synthesizing a debug map entry for them using the address from
      the main binary.
      
      Differential revision: https://reviews.llvm.org/D68680
      
      llvm-svn: 374139
      4ac388f7
    • Kristina Brooks's avatar
      [TypeSize] Fix module builds (cassert) · 0746aafd
      Kristina Brooks authored
      TypeSize.h uses `assert` statements without including
      the <cassert> header first which leads to failures
      in modular builds.
      
      llvm-svn: 374138
      0746aafd
    • Eric Fiselier's avatar
      Optimize operator=(const basic_string&) for tail call. · 78153b3a
      Eric Fiselier authored
      Patch by Martijn Vels (mvels@google.com)
      Reviewed as https://reviews.llvm.org/D68276
      
      This is a non trivial win for externally templated assignment operator.
      
      x86 without tail call (current libc++)
      
      0000000000000000 <std::string::operator=(std::string const&)>:
         0:   55                      push   %rbp
         1:   48 89 e5                mov    %rsp,%rbp
         4:   53                      push   %rbx
         5:   50                      push   %rax
         6:   48 89 fb                mov    %rdi,%rbx
         9:   48 39 f7                cmp    %rsi,%rdi
         c:   74 17                   je     25 <std::string::operator=(std::string const&)+0x25>
         e:   0f b6 56 17             movzbl 0x17(%rsi),%edx
        12:   84 d2                   test   %dl,%dl
        14:   79 07                   jns    1d <std::string::operator=(std::string const&)+0x1d>
        16:   48 8b 56 08             mov    0x8(%rsi),%rdx
        1a:   48 8b 36                mov    (%rsi),%rsi
        1d:   48 89 df                m...
      78153b3a
    • Richard Smith's avatar
      [c++20] P1152R4: warn on any simple-assignment to a volatile lvalue · 4a6861a7
      Richard Smith authored
      whose value is not ignored.
      
      We don't warn on all the cases that are deprecated: specifically, we
      choose to not warn for now if there are parentheses around the
      assignment but its value is not actually used. This seems like a more
      defensible rule, particularly for cases like sizeof(v = a), where the
      parens are part of the operand rather than the sizeof syntax.
      
      llvm-svn: 374135
      4a6861a7
    • Richard Smith's avatar
      [c++20] Implement most of P1152R4. · 84ef9c64
      Richard Smith authored
      Diagnose some now-deprecated uses of volatile types:
       * as function parameter types and return types
       * as the type of a structured binding declaration
       * as the type of the lvalue operand of an increment / decrement /
         compound assignment operator
      
      This does not implement a check for the deprecation of simple
      assignments whose results are used; that check requires somewhat
      more complexity and will be addressed separately.
      
      llvm-svn: 374133
      84ef9c64