Started 11 mo ago
Took 47 min on green-dragon-19

Failed Build rL:349976 - C:349955 - #43 - green-dragon-19 (Dec 23, 2018 11:02:15 AM)

Revisions
  • http://llvm.org/svn/llvm-project/llvm/trunk : 349976
  • http://llvm.org/svn/llvm-project/cfe/trunk : 349955
  • http://llvm.org/svn/llvm-project/compiler-rt/trunk : 349961
  • http://llvm.org/svn/llvm-project/debuginfo-tests/trunk : 346271
  • http://llvm.org/svn/llvm-project/zorg/trunk : 349855
  • http://llvm.org/svn/llvm-project/libcxx/trunk : 349947
  • http://llvm.org/svn/llvm-project/clang-tools-extra/trunk : 349953
Changes
  1. [MC] Enable .file support on COFF and diagnose it on unsupported targets

    Summary:
    The "single parameter" .file directive appears to be an ELF-only feature
    that is intended to insert the main source filename into the string
    table table.

    I noticed that if you assemble an ELF .s file for COFF, typically it
    will assert right away on a .file directive near the top of the file. My
    first change was to make this emit a proper error in the asm parser so
    that we don't assert so easily.

    However, COFF actually does have some support for this directive, and if
    you emit an object file, llvm-mc does not assert. When emitting a COFF
    object, MC will take those file names and create "debug" symbol table
    entries for them. I'm not familiar with these kinds of symbol table
    entries, and I'm not aware of any users of them, but @compnerd added
    them a while ago. They don't introduce absolute paths, and most main
    source file paths are short enough that this extra entry shouldn't cause
    any problems, so I enabled the flag in MCAsmInfoCOFF that indicates that
    it's supported.

    This has the side effect of adding an extra debug symbol to every object
    produced by clang, which is a pretty big functional change. My question
    is, should we keep the functionality or remove it in the name of symbol
    table minimalism?

    Reviewers: mstorsjo, compnerd

    Subscribers: hiraditya, compnerd, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55900 (detail)
    by rnk
  2. Silence warning in assert introduced in rL349973.

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D56030 (detail)
    by mtrofin
  3. [llvm] API for encoding/decoding DWARF discriminators.

    Summary:
    Added a pair of APIs for encoding/decoding the 3 components of a DWARF discriminator described in http://lists.llvm.org/pipermail/llvm-dev/2016-October/106532.html: the base discriminator, the duplication factor (useful in profile-guided optimization) and the copy index (used to identify copies of code in cases like loop unrolling)

    The encoding packs 3 unsigned values in 32 bits. This CL addresses 2 issues:
    - communicates overflow back to the user
    - supports encoding all 3 components together. Current APIs assume a sequencing of events. For example, creating a new discriminator based on an existing one by changing the base discriminator was not supported.

    Reviewers: davidxl, danielcdh, wmi, dblaikie

    Reviewed By: dblaikie

    Subscribers: zzheng, dmgreen, aprantl, JDevlieghere, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55681 (detail)
    by mtrofin
  4. Reapply: DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

    Originally committed in r349333, reverted in r349353.

    GCC emitted these unconditionally on/before 4.4/March 2012
    Clang emitted these unconditionally on/before 3.5/March 2014

    This improves performance when parsing CUs (especially those using split
    DWARF) that contain no code ranges (such as the mini CUs that may be
    created by ThinLTO importing - though generally they should be/are
    avoided, especially for Split DWARF because it produces a lot of very
    small CUs, which don't scale well in a bunch of other ways too
    (including size)).

    The revert was due to a (Google internal) test that had some checked in old
    object files missing DW_AT_ranges. That's since been fixed. (detail)
    by dblaikie
  5. [IR] Add Instruction::isLifetimeStartOrEnd, NFC

    Instruction::isLifetimeStartOrEnd() checks whether an Instruction is an
    llvm.lifetime.start or an llvm.lifetime.end intrinsic.

    This was suggested as a cleanup in D55967.

    Differential Revision: https://reviews.llvm.org/D56019 (detail)
    by Vedant Kumar
  6. [TextAPI][elfabi] Fix failing tests from D56020 (detail)
    by amontanez
  7. [X86] Add isel patterns to match BMI/TBMI instructions when lowering has turned the root nodes into one of the flag producing binops.

    This fixes the patterns that have or/and as a root. 'and' is handled differently since thy usually have a CMP wrapped around them.

    I had to look for uses of the CF flag because all these nodes have non-standard CF flag behavior. A real or/xor would always clear CF. In practice we shouldn't be using the CF flag from these nodes as far as I know.

    Differential Revision: https://reviews.llvm.org/D55813 (detail)
    by ctopper
  8. Fix comment typo. (detail)
    by delcypher
  9. Fix `static_assert()` scope in `CombinedAllocator`.

    It should be at the class scope and not inside the `Init(...)` function
    because we want to error out as soon as the wrong type is constructed.
    At the function scope the `static_assert` is only checked if the
    function might be called.

    This is a follow up to r349957.

    rdar://problem/45284065 (detail)
    by delcypher
  10. Fix `static_assert()` scope in `SizeClassAllocator32`.

    It should be at the class scope and not inside the `Init(...)` function
    because we want to error out as soon as the wrong type is constructed.
    At the function scope the `static_assert` is only checked if the
    function might be called.

    This is a follow up to r349138.

    rdar://problem/45284065 (detail)
    by delcypher
  11. [DAGCombiner] simplify code leading to scalarizeExtractedVectorLoad; NFC (detail)
    by spatel
  12. Introduce `AddressSpaceView` template parameter to `CombinedAllocator`.

    Summary:
    This is a follow up to https://reviews.llvm.org/D55764 .

    For the ASan and LSan allocatorsthe type declarations have been modified
    so that it's possible to create a combined allocator type that
    consistently uses a different type of `AddressSpaceView`. We intend to
    use this in future patches. For the other sanitizers they just use
    `LocalAddressSpaceView` by default because we have no plans to use these
    allocators in an out-of-process manner.

    rdar://problem/45284065

    Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov, yln

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55766 (detail)
    by delcypher
  13. [X86] Don't allow optimizeCompareInstr to replace a CMP with BEXTR if the sign flag is used.

    The BEXTR instruction documents the SF bit as undefined.

    The TBM BEXTR instruction has the same issue, but I'm not sure how to test it. With the control being an immediate we can determine the sign bit is 0 or the BEXTR would have been removed.

    Fixes PR40060

    Differential Revision: https://reviews.llvm.org/D55807 (detail)
    by ctopper
  14. Switch from static_cast<> to cast<>, update identifier for coding conventions; NFC. (detail)
    by aaronballman
  15. Introduce `AddressSpaceView` template parameter to `SizeClassAllocator64`.

    Summary:
    This is a follow up patch to r349138.

    This patch makes a `AddressSpaceView` a type declaration in the
    allocator parameters used by `SizeClassAllocator64`. For ASan, LSan, and
    the unit tests the AP64 declarations have been made templated so that
    `AddressSpaceView` can be changed at compile time. For the other
    sanitizers we just hard-code `LocalAddressSpaceView` because we have no
    plans to use these allocators in an out-of-process manner.

    rdar://problem/45284065

    Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55764 (detail)
    by delcypher
  16. [clang-tidy] Be more liberal about literal zeroes in abseil checks

    Summary:
    Previously, we'd only match on literal floating or integral zeroes, but I've now also learned that some users spell that value as int{0} or float{0}, which also need to be matched.

    Differential Revision: https://reviews.llvm.org/D56012 (detail)
    by hwright
  17. Convert some ObjC retain/release msgSends to runtime calls.

    It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions.

    Differential Revision: https://reviews.llvm.org/D55869

    Reviewed By: rjmccall (detail)
    by Pete Cooper
  18. AMDGPU: Don't peel of the offset if the resulting base could possibly be negative in Indirect addressing.

    Summary:
      Don't peel of the offset if the resulting base could possibly be negative in Indirect addressing.
    This is because the M0 field is of unsigned.

    This patch achieves the similar goal as https://reviews.llvm.org/D55241, but keeps the optimization
    if the base is known unsigned.

    Reviewers:
      arsemn

    Differential Revision:
      https://reviews.llvm.org/D55568 (detail)
    by chfang
  19. [TextAPI][elfabi] Fix YAML support for weak symbols

    Weak symbols are supposed to be supported in the ELF TextAPI
    implementation, but the YAML handler didn't read or write the `Weak`
    member of ELFSymbol. This change adds the YAML mapping and updates tests
    to ensure correct behavior.

    Differential Revision: https://reviews.llvm.org/D56020 (detail)
    by amontanez
  20. [Sema][NFC] Fix a Wimplicit-fallthrough warning in CheckSpecializationInstantiationRedecl

    All cases are covered so add an llvm_unreachable. NFC. (detail)
    by brunoricci
  21. [AST][NFC] Remove stale comment in CXXRecordDecl::is(Virtually)DerivedFrom.

    The "this" capture was removed in r291939. (detail)
    by brunoricci
  22. [libcxx] Remove unused macro _LIBCPP_HAS_UNIQUE_TYPEINFO

    Summary:
    We already have the negation of that as _LIBCPP_HAS_NONUNIQUE_TYPEINFO.
    Having both defined is confusing, since only one of them is used.

    Reviewers: EricWF, mclow.lists

    Subscribers: christof, jkorous, dexonsmith, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54537 (detail)
    by Louis Dionne
  23. [BasicAA] Fix AA bug on dynamic allocas and stackrestore

    Summary:
    BasicAA has special logic for unescaped allocas, which normally applies
    equally well to dynamic and static allocas. However, llvm.stackrestore
    has the power to end the lifetime of dynamic allocas, without referring
    to them directly.

    stackrestore is already marked with the most conservative memory
    modification attributes, but because the alloca is not escaped, the
    normal logic produces incorrect results. I think BasicAA needs a special
    case here to teach it about the relationship between dynamic allocas and
    stackrestore.

    Fixes PR40118

    Reviewers: gbiv, efriedma, george.burgess.iv

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55969 (detail)
    by rnk
  24. [RuntimeUnrolling] NFC: Add TODO and comments in connectProlog

    Currently, runtime unrolling does not support loops where multiple
    exiting blocks exit to the latchExit. Added TODO and other code
    clarifications for ConnectProlog code. (detail)
    by annat
  25. [analyzer] Tests quickfix. (detail)
    by George Karpenkov
  26. Remove stat cache chaining as it's no longer needed after PTH support has been
    removed

    Stat cache chaining was implemented for a StatListener in the PTH writer so that
    it could write out the stat information to PTH. r348266 removed support for PTH,
    and it doesn't seem like there are other uses of stat cache chaining. We can
    remove the chaining support.

    Differential Revision: https://reviews.llvm.org/D55455 (detail)
    by arphaman
  27. Switch from cast<> to dyn_cast<>.

    This avoids a potential failed assertion that is happening on someone's out-of-tree build. (detail)
    by aaronballman
  28. Revert "Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in RetainCountChecker on type mismatch even for inlined functions"

    This reverts commit b44b33f6e020a2c369da2b0c1d53cd52975f2526.

    Revert the revert with the fix. (detail)
    by George Karpenkov
  29. [analyzer] Correct the summary violation diagnostics for the retain count checker

    It should be in the past tense. (detail)
    by George Karpenkov
  30. [x86] add movddup specialization for build vector lowering (PR37502)

    This is admittedly a narrow fix for the problem:
    https://bugs.llvm.org/show_bug.cgi?id=37502
    ...but as the XOP restriction shows, it's a maze to get this right.
    In the motivating example, note that we have movddup before SSE4.1 and
    again with AVX2. That's because insertps isn't available pre-SSE41 and
    vbroadcast is (more generally) available with AVX2 (and the splat is
    reduced to movddup via isel pattern).

    Differential Revision: https://reviews.llvm.org/D55898 (detail)
    by spatel
  31. [ARM] Set Defs = [CPSR] for COPY_STRUCT_BYVAL, as it clobbers CPSR.

    Fixes PR35023.

    Reviewers: MatzeB, t.p.northover, sunfish, qcolombet, efriedma

    Reviewed By: efriedma

    Differential Revision: https://reviews.llvm.org/D55909 (detail)
    by fhahn
  32. [AST][NFC] Fix Wsign-compare warning introduced in CXXOperatorCallExpr (detail)
    by brunoricci
  33. [Sema][NFC] Fix Wimplicit-fallthrough warning in getCursorKindForDecl

    All cases are covered so add an llvm_unreachable. NFC. (detail)
    by brunoricci
  34. [NFC] Fix typo in comment (detail)
    by Louis Dionne
  35. [SelectionDAG] Remove KnownBits output paramater version.

    Completes the work started by @bogner in rL340594. (detail)
    by rksimon
  36. [clang-tidy] Add export-fixes flag to clang-tidy-diff

    Differential Revision: https://reviews.llvm.org/D55848 (detail)
    by juliehockett
  37. [x86] remove excess check lines; NFC

    Forgot that the integer variants have an extra 's'. (detail)
    by spatel
  38. [x86] move misplaced tests; NFC

    Mixed up integer and FP in rL349923. (detail)
    by spatel
  39. [GlobalISel][AArch64] Add support for widening G_FCEIL

    This adds support for widening G_FCEIL in LegalizerHelper and
    AArch64LegalizerInfo. More specifically, it teaches the AArch64 legalizer to
    widen G_FCEIL from a 16-bit float to a 32-bit float when the subtarget doesn't
    support full FP 16.

    This also updates AArch64/f16-instructions.ll to show that we perform the
    correct transformation. (detail)
    by paquette
  40. [AST][NFC] Pack CXXOperatorCallExpr

    Use the space available in the bit-fields of Stmt.
    This saves 8 bytes per CXXOperatorCallExpr. NFC. (detail)
    by brunoricci
  41. [x86] add tests for possible horizontal op transform; NFC (detail)
    by spatel
  42. ReleaseNotes: Document removal of add_llvm_loadable_module CMake macro

    This was removed in r349839. (detail)
    by tstellar
  43. [x86] move test for movddup; NFC

    This adds an AVX512 run as suggested in D55936.
    The test didn't really belong with other build vector tests
    because that's not the pattern here. I don't see much value
    in adding 64-bit RUNs because they wouldn't exercise the
    isel patterns that we're aiming to expose. (detail)
    by spatel
  44. [pstl] Initial integration with LLVM's CMake

    Summary:
    This commit adds a check-pstl CMake target that will run the tests
    we currently have for pstl. Those tests are not using LLVM lit yet,
    but switching them over should be a transparent change. With this
    change, we can start relying on the `check-pstl` target for workflows
    and CI.

    Note that this commit purposefully does not support the pre-monorepo
    layout (with subprojects in projects/), since LLVM is moving towards
    the monorepo layout anyway.

    Reviewers: jfb

    Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits, mclow.lists, rodgert

    Differential Revision: https://reviews.llvm.org/D55963 (detail)
    by Louis Dionne
  45. [AArch64] Refactor Exynos predicate (NFC)

    Change order of conditions in predicate. (detail)
    by evandro
  46. [Sanitizer] Move the unit test in the right place. (detail)
    by David CARLIER
  47. [Sanitizer] Enable strtonum in FreeBSD

    Reviewers: krytarowski, vitalybuka

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55993 (detail)
    by David CARLIER
  48. [XCore] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  49. [Sparc] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  50. [AMDGPU] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  51. [WebAssembly] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  52. [AST] Store the callee and argument expressions of CallExpr in a trailing array.

    Since CallExpr::setNumArgs has been removed, it is now possible to store the
    callee expression and the argument expressions of CallExpr in a trailing array.
    This saves one pointer per CallExpr, CXXOperatorCallExpr, CXXMemberCallExpr,
    CUDAKernelCallExpr and UserDefinedLiteral.

    Given that CallExpr is used as a base of the above classes we cannot use
    llvm::TrailingObjects. Instead we store the offset in bytes from the this pointer
    to the start of the trailing objects and manually do the casts + arithmetic.

    Some notes:

    1.) I did not try to fit the number of arguments in the bit-fields of Stmt.
        This leaves some space for future additions and avoid the discussion about
        whether x bits are sufficient to hold the number of arguments.

    2.) It would be perfectly possible to recompute the offset to the trailing
        objects before accessing the trailing objects. However the trailing objects
        are frequently accessed and benchmarks show that it is slightly faster to
        just load the offset from the bit-fields. Additionally, because of 1),
        we have plenty of space in the bit-fields of Stmt.

    Differential Revision: https://reviews.llvm.org/D55771

    Reviewed By: rjmccall (detail)
    by brunoricci
  53. [ARM] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  54. [AArch64] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  55. [SelectionDAG] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  56. [SystemZ] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  57. [Lanai] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  58. [Sema][NFC] Remove some unnecessary calls to getASTContext.

    The AST context is already easily available. NFC. (detail)
    by brunoricci
  59. [PPC] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version. (detail)
    by rksimon
  60. [X86] Always use the version of computeKnownBits that returns a value. NFCI.

    Continues the work started by @bogner in rL340594 to remove uses of the old KnownBits output paramater version. (detail)
    by rksimon
  61. [AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.

    All of the other constructors already take a reference to the AST context.
    This avoids calling Decl::getASTContext in most cases. Additionally move
    the definition of the constructor from Expr.h to Expr.cpp since it is calling
    DeclRefExpr::computeDependence. NFC. (detail)
    by brunoricci
  62. [AArch64] Adding missing REQUIRES in aarch64 dwarf test (detail)
    by lukecheeseman
  63. [xray] [tests] Detect and handle missing LLVMTestingSupport gracefully

    Add a code to properly test for presence of LLVMTestingSupport library
    when performing a stand-alone build, and skip tests requiring it when
    it is not present.  Since the library is not installed, llvm-config
    reported empty --libs for it and the tests failed to link with undefined
    references.  Skipping the two fdr_* test files is better than failing to
    build, and should be good enough until we find a better solution.

    NB: both installing LLVMTestingSupport and building it automatically
    from within compiler-rt sources are non-trivial.  The former due to
    dependency on gtest, the latter due to tight integration with LLVM
    source tree.

    Differential Revision: https://reviews.llvm.org/D55891 (detail)
    by mgorny
  64. [ADT] IntervalMap: add overlaps(a, b) method

    Summary:
    This function checks whether the mappings in the interval map overlap
    with the given range [a;b]. The motivation is to enable checking for
    overlap before inserting a new interval into the map.

    Reviewers: vsk, dblaikie

    Subscribers: dexonsmith, kristina, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55760 (detail)
    by labath
  65. [CMake] Print out the list of sanitizers that the sanitizer_common tests will run against.

    Summary:
    This is a change requested by Vitaly Buka as prerequisite to landing
    https://reviews.llvm.org/D55740.

    Reviewers: vitalybuka, kubamracek

    Subscribers: mgorny, #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55939 (detail)
    by delcypher
  66. [NewPM] -print-module-scope -print-after now prints module even after invalidated Loop/SCC

    -print-after IR printing generally can not print the IR unit (Loop or SCC)
    which has just been invalidated by the pass. However, when working in -print-module-scope
    mode even if Loop was invalidated there is still a valid module that we can print.

    Since we can not access invalidated IR unit from AfterPassInvalidated instrumentation
    point we can remember the module to be printed *before* pass. This change introduces
    BeforePass instrumentation that stores all the information required for module printing
    into the stack and then after pass (in AfterPassInvalidated) just print whatever
    has been placed on stack.

    Reviewed By: philip.pfaffe
    Differential Revision: https://reviews.llvm.org/D55278 (detail)
    by fedor.sergeev
  67. [Dwarf/AArch64] Return address signing B key dwarf support

    - When signing return addresses with -msign-return-address=<scope>{+<key>},
      either the A key instructions or the B key instructions can be used. To
      correctly authenticate the return address, the unwinder/debugger must know
      which key was used to sign the return address.
    - When and exception is thrown or a break point reached, it may be necessary to
      unwind the stack. To accomplish this, the unwinder/debugger must be able to
      first authenticate an the return address if it has been signed.
    - To enable this, the augmentation string of CIEs has been extended to allow
      inclusion of a 'B' character. Functions that are signed using the B key
      variant of the instructions should have and FDE whose associated CIE has a 'B'
      in the augmentation string.
    - One must also be able to preserve these semantics when first stepping from a
      high level language into assembly and then, as a second step, into an object
      file. To achieve this, I have introduced a new assembly directive
      '.cfi_b_key_frame ', that tells the assembler the current frame uses return
      address signing with the B key.
    - This ensures that the FDE is associated with a CIE that has 'B' in the
      augmentation string.

    Differential Revision: https://reviews.llvm.org/D51798 (detail)
    by lukecheeseman
  68. Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in RetainCountChecker on type mismatch even for inlined functions

    The fix done in D55465 did not previously apply when the function was inlined.

    rdar://46889541

    Differential Revision: https://reviews.llvm.org/D55976
    ........
    Fixes broken buildbot: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/14764 (detail)
    by rksimon
  69. [clangd] Cleanup syntax errors in the test, NFC. (detail)
    by hokein
  70. [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsics (llvm)

    This auto upgrades the signed SSE saturated math intrinsics to SADD_SAT/SSUB_SAT generic intrinsics.

    Clang counterpart: https://reviews.llvm.org/D55890

    Differential Revision: https://reviews.llvm.org/D55894 (detail)
    by rksimon
  71. Fix warning about unused variable [NFC] (detail)
    by bjope
  72. [Sema] Produce diagnostics when C++17 aligned allocation/deallocation
    functions that are unavailable on Darwin are explicitly called or called
    from deleting destructors.

    rdar://problem/40736230

    Differential Revision: https://reviews.llvm.org/D47757 (detail)
    by ahatanak
  73. [WebAssembly] Fix invalid machine instrs in -O0, verify in tests

    Reviewers: aheejin, dschuff

    Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55956 (detail)
    by tlively
  74. Fix test case breakages caused by lexically_relative change (detail)
    by ericwf
  75. Don't forward declare _FilesystemClock in C++03 (detail)
    by ericwf
  76. Fix copy paste error in file_clock tests (detail)
    by ericwf
  77. Implement LWG 3096: path::lexically_relative is confused by trailing slashes

    path("/dir/").lexically_relative("/dir"); now returns "." instead of "" (detail)
    by ericwf
  78. Implement LWG 3065: Make path operators friends.

    This prevents things like:

    using namespace std::filesystem;
    auto x = L"a/b" == std::string("a/b"); (detail)
    by ericwf
  79. Implement LWG 3145: file_clock breaks ABI for C++17 implementations.

    This patch adds std::chrono::file_clock, but without breaking the
    existing ABI for std::filesystem. (detail)
    by ericwf
  80. AMDGPU/GlobalISel: RegBankSelect for amdgcn.wqm.vote (detail)
    by arsenm
  81. Implement LWG 2936: Path comparison is defined in terms of the generic format

    This patch implements path::compare according to the current spec. The
    only observable change is the ordering of "/foo" and "foo", which orders
    the two paths based on having or not having a root directory (instead
    of lexically comparing "/" to "foo"). (detail)
    by ericwf
  82. AMDGPU/GlobalISel: RegBankSelect for some fp ops (detail)
    by arsenm
  83. GlobalISel: Correct example PartialMapping table

    When I try to use this, it seems like the second half needs
    to start where the previous part left off. (detail)
    by arsenm
  84. AMDGPU/GlobalISel: Redo legality for build_vector

    It seems better to avoid using the callback if possible since
    there are coverage assertions which are disabled if this is used.

    Also fix missing tests. Only test the legal cases since it seems
    legalization for build_vector is quite lacking. (detail)
    by arsenm
  85. Mark two filesystem LWG issues as complete - nothing to do (detail)
    by ericwf
  86. [analyzer] Perform escaping in RetainCountChecker on type mismatch even for inlined functions

    The fix done in D55465 did not previously apply when the function was inlined.

    rdar://46889541

    Differential Revision: https://reviews.llvm.org/D55976 (detail)
    by George Karpenkov
  87. [analyzer] Fix a bug in RetainCountDiagnostics while printing a note on mismatched summary in inlined functions

    Previously, we were not printing a note at all if at least one of the parameters was not annotated.

    rdar://46888422

    Differential Revision: https://reviews.llvm.org/D55972 (detail)
    by George Karpenkov
  88. [memcpyopt] Add debug logs when forwarding memcpy src to dst (detail)
    by rnk
  89. [mingw] Don't mangle thiscall like fastcall etc

    GCC does not mangle it when it is not explicit in the source.  The
    mangler as currently written cannot differentiate between explicit and
    implicit calling conventions, so we can't match GCC. Explicit thiscall
    conventions are rare, so mangle as if the convention was implicit to be
    as ABI compatible as possible.

    Also fixes some tests using %itanium_abi_triple in some configurations
    as a side effect.

    Fixes PR40107. (detail)
    by rnk
  90. [LoopUnroll] Don't verify domtree by default with +Asserts.

    This verification is linear in the size of the function, so it can cause
    a quadratic compile-time explosion in a function with many loops to
    unroll.

    Differential Revision: https://reviews.llvm.org/D54732 (detail)
    by efriedma
  91. [X86] Autogenerate complete checks. NFC (detail)
    by ctopper
  92. [X86] Refactor hasNoCarryFlagUses and hasNoSignFlagUses in X86ISelDAGToDAG.cpp to tranlate opcode to condition code using the helpers in X86InstrInfo.cpp.

    This shortens the switches in X86ISelDAGToDAG.cpp to only need to check condition code instead of a list of opcodes.

    This also fixes a bug where the memory forms of SETcc were missing from hasNoCarryFlagUses. (detail)
    by ctopper
  93. [X86] Add memory forms of some SETCC instructions to hasNoCarryFlagUses.

    Found while working on another patch (detail)
    by ctopper
  94. [driver] [analyzer] Fix --analyze -Xanalyzer after r349863.

    If an -analyzer-config is passed through -Xanalyzer, it is not found while
    looking for -Xclang.

    Additionally, don't emit -analyzer-config-compatibility-mode for *every*
    -analyzer-config flag we encounter; one is enough.

    https://reviews.llvm.org/D55823

    rdar://problem/46504165 (detail)
    by dergachev
  95. Revert "Revert "[driver] [analyzer] Fix a backward compatibility issue after r348038.""

    This reverts commit 144927939587b790c0536f4ff08245043fc8d733.

    Fixes the bug in the original commit. (detail)
    by George Karpenkov
  96. [analyzer] RetainCount: Suppress retain detection heuristic on some CM methods.

    If it ends with "Retain" like CFRetain and returns a CFTypeRef like CFRetain,
    then it is not necessarily a CFRetain. But it is indeed true that these two
    return something retained.

    Differential Revision: https://reviews.llvm.org/D55907

    rdar://problem/39390714 (detail)
    by dergachev
  97. [ARM] Complete the Thumb1 shift+and->shift+shift transforms.

    This saves materializing the immediate.  The additional forms are less
    common (they don't usually show up for bitfield insert/extract), but
    they're still relevant.

    I had to add a new target hook to prevent DAGCombine from reversing the
    transform. That isn't the only possible way to solve the conflict, but
    it seems straightforward enough.

    Differential Revision: https://reviews.llvm.org/D55630 (detail)
    by efriedma
  98. [zorg] Print all IPs on Android bot (detail)
    by Vitaly Buka
  99. [CodeGen] Fix a test from r349848 by replacing `objc_` with `llvm.objc.` (detail)
    by vsapsai
  100. Revert "[asan] Disable test on powerpc64be"

    Now the test is passing on that bot. Some incremental build issues?

    This reverts commit e00b5a5229ae02088d9f32a4e328eaa08abaf354. (detail)
    by Vitaly Buka
  101. [CodeGen] Fix assertion on emitting cleanup for object with inlined inherited constructor and non-trivial destructor.

    Fixes assertion
    > Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/Support/Casting.h, line 255.

    It was triggered by trying to cast `FunctionDecl` to `CXXMethodDecl` as
    `CGF.CurCodeDecl` in `CallBaseDtor::Emit`. It was happening because
    cleanups were emitted in `ScalarExprEmitter::VisitExprWithCleanups`
    after destroying `InlinedInheritingConstructorScope`, so
    `CodeGenFunction.CurCodeDecl` didn't correspond to expected cleanup decl.

    Fix the assertion by emitting cleanups before leaving
    `InlinedInheritingConstructorScope` and changing `CurCodeDecl`.

    Test cases based on a patch by Shoaib Meenai.

    Fixes PR36748.

    rdar://problem/45805151

    Reviewers: rsmith, rjmccall

    Reviewed By: rjmccall

    Subscribers: jkorous, dexonsmith, cfe-commits, smeenai, compnerd

    Differential Revision: https://reviews.llvm.org/D55543 (detail)
    by vsapsai
  102. [InstCombine] [NFC] testcases for canonicalize MUL with NEG operand (detail)
    by shchenz
  103. Fix Windows build failures caused by r349839 (detail)
    by tstellar
  104. Add support for namespaces on #pragma clang attribute

    Namespaces are introduced by adding an "identifier." before a
    push/pop directive. Pop directives with namespaces can only pop a
    attribute group that was pushed with the same namespace. Push and pop
    directives that don't opt into namespaces have the same semantics.

    This is necessary to prevent a pitfall of using multiple #pragma
    clang attribute directives spread out in a large file, particularly
    when macros are involved. It isn't easy to see which pop corripsonds
    to which push, so its easy to inadvertently pop the wrong group.

    Differential revision: https://reviews.llvm.org/D55628 (detail)
    by epilk
  105. [asan] Disable test on powerpc64be (detail)
    by Vitaly Buka
  106. Revert "[driver] [analyzer] Fix a backward compatibility issue after r348038."

    This reverts commits r349824, r349828, r349835.

    More buildbot failures were noticed.

    Differential Revision: https://reviews.llvm.org/D55823

    rdar://problem/46504165 (detail)
    by dergachev
  107. [zorg] Print local IP of Android build bot (detail)
    by Vitaly Buka
  108. [ObjC] Messages to 'self' in class methods that return 'instancetype' should
    use the pointer to the class as the result type of the message

    Prior to this commit, messages to self in class methods were treated as instance
    methods to a Class value. When these methods returned instancetype the compiler
    only saw id through the instancetype, and not the Interface *. This caused
    problems when that return value was a receiver in a message send, as the
    compiler couldn't select the right method declaration and had to rely on a
    selection from the global method pool.

    This commit modifies the semantics of such message sends and uses class messages
    that are dispatched to the interface that corresponds to the class that contains
    the class method. This ensures that instancetypes are correctly interpreted by
    the compiler. This change is safe under ARC (as self can't be reassigned),
    however, it also applies to MRR code as we are assuming that the user isn't
    doing anything unreasonable.

    rdar://20940997

    Differential Revision: https://reviews.llvm.org/D36790 (detail)
    by arphaman
  109. cmake: Remove uses of add_llvm_loadable_module macro

    This was removed from llvm in r349839. (detail)
    by tstellar
  110. cmake: Remove add_llvm_loadable_module()

    Summary:
    This function is very similar to add_llvm_library(),  so this patch merges it
    into add_llvm_library() and replaces all calls to add_llvm_loadable_module(lib ...)
    with add_llvm_library(lib MODULE ...)

    Reviewers: philip.pfaffe, beanz, chandlerc

    Reviewed By: philip.pfaffe

    Subscribers: chapuni, mgorny, llvm-commits

    Differential Revision: https://reviews.llvm.org/D51748 (detail)
    by tstellar
  111. [zorg] Report results of adb push on Android bot (detail)
    by Vitaly Buka
  112. [zorg] Simplify stage1 build on sanitizer bots (detail)
    by Vitaly Buka
  113. [gn check] Unbreak check-lld if llvm_install_binutils_symlinks is false

    The check-lld target was missing the dependency on llvm-nm and llvm-objdump in that case.

    Differential Revision: https://reviews.llvm.org/D55941 (detail)
    by nico
  114. [driver] [analyzer] Fix redundant test output.

    The -c flag causes a .o file to appear every time we run a test.
    Remove it.

    Differential Revision: https://reviews.llvm.org/D55823

    rdar://problem/46504165 (detail)
    by dergachev
  115. [gn build] Add build file for clang/lib/CodeGen and llvm/lib/ProfileData/Coverage

    Differential Revision: https://reviews.llvm.org/D55931 (detail)
    by nico
  116. [gn build] Add build files for clang/lib/{Frontend,Frontend/Rewrite,Serialization}

    Differential Revision: https://reviews.llvm.org/D55930 (detail)
    by nico
  117. [gn build] Add build file for clang/lib/Driver

    Mostly boring, except for the spurious dependency on StaticAnalyzer/Checkers --
    see comments in the code.

    Differential Revision: https://reviews.llvm.org/D55927 (detail)
    by nico
  118. [gn build] Add build file for clang/lib/Parse

    Nothing really interesting. One thing to consider is where the clang_tablegen()
    invocations that generate files that are private to a library should be. The
    CMake build puts them in clang/include/clang/Parse (in this case), but maybe
    putting them right in clang/lib/Parse/BUILD.gn makes mor sense. (For
    clang_tablegen() calls that generate .inc files used by the public headers,
    putting the call in the public BUILD file makes sense.)

    For now, I've put the build file in the public header folder, since that
    matches CMake and what I did in the last 2 clang patches, but I'm not sure I
    like this.

    Differential Revision: https://reviews.llvm.org/D55925 (detail)
    by nico
  119. [gn build] Add build files for clang-format and lib/{Format,Rewrite,Tooling/Core,Tooling/Inclusions}

    Differential Revision: https://reviews.llvm.org/D55924 (detail)
    by nico
  120. [zorg] Skip svn update with "BUILDBOT_REVISION=-" (detail)
    by Vitaly Buka
  121. [driver] [analyzer] Fix buildbots after r349824.

    Buildbots can't find the linker, which we don't really need in our tests.

    Differential Revision: https://reviews.llvm.org/D55823

    rdar://problem/46504165 (detail)
    by dergachev
  122. [zorg] Report exception of svn update failed (detail)
    by Vitaly Buka
  123. [llvm-objcopy] [COFF] Avoid memcpy() with null parameters in more places. NFC.

    This fixes all cases of errors in asan+ubsan builds.

    Also use std::copy instead of if+memcpy in the previously updated spot,
    for consistency. (detail)
    by mstorsjo
  124. Declares __cpu_model as dso local

    __builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local.

    Differential Revision: https://reviews.llvm.org/D53850 (detail)
    by hhb
  125. [driver] [analyzer] Fix a backward compatibility issue after r348038.

    Since r348038 we emit an error every time an -analyzer-config option is not
    found. The driver, however, suppresses this error with another flag,
    -analyzer-config-compatibility-mode, so backwards compatibility is maintained,
    while analyzer developers still enjoy the new typo-free experience.

    The backwards compatibility turns out to be still broken when the -analyze
    action is not specified; it is still possible to specify -analyzer-config
    in that case. This should be fixed now.

    Patch by Kristóf Umann!

    Differential Revision: https://reviews.llvm.org/D55823

    rdar://problem/46504165 (detail)
    by dergachev
  126. [CodeGen] Generate llvm.loop.parallel_accesses instead of llvm.mem.parallel_loop_access metadata.

    Instead of generating llvm.mem.parallel_loop_access metadata, generate
    llvm.access.group on instructions and llvm.loop.parallel_accesses on
    loops. There is one access group per generated loop.

    This is clang part of D52116/r349725.

    Differential Revision: https://reviews.llvm.org/D52117 (detail)
    by meinersbur
  127. [GlobalISel][AArch64] Add G_FCEIL to isPreISelGenericFloatingPointOpcode

    If you don't do this, then if you hit a G_LOAD in getInstrMapping, you'll end
    up with GPRs on the G_FCEIL instead of FPRs. This causes a fallback.

    Add it to the switch, and add a test verifying that this happens. (detail)
    by paquette
  128. Make the "too many braces in scalar initialization" extension cause
    SFINAE failures. (detail)
    by rsmith
  129. DebugInfo: Fix for missing comp_dir handling with r349207

    When deciding lazily whether a CU would be split or non-split I
    accidentally dropped some handling for the line tables comp_dir (by
    doing it lazily it was too late to be handled properly by the MC line
    table code).

    Move that bit of the code back to the non-lazy place. (detail)
    by dblaikie
  130. [sanitizer] Support running without fd 0,1,2.

    Summary:
    Support running with no open file descriptors (as may happen to
    "init" process on linux).
    * Remove a check that writing to stderr succeeds.
    * When opening a file (ex. for log_path option), dup the new fd out of
    [0, 2] range to avoid confusing the program.

    (2nd attempt, this time without the sanitizer_rtems change)

    Reviewers: pcc, vitalybuka

    Subscribers: kubamracek, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55801 (detail)
    by eugenis
  131. Fix the example checker plugin after r349812. (detail)
    by aaronballman
  132. Fix build failures from r349812 due to a missing argument. (detail)
    by aaronballman
  133. Allow direct navigation to static analysis checker documentation through SARIF exports.

    This adds anchors to all of the documented checks so that you can directly link to a check by a stable name. This is useful because the SARIF file format has a field for specifying a URI to documentation for a rule and some viewers, like CodeSonar, make use of this information. These links are then exposed through the SARIF exporter. (detail)
    by aaronballman
  134. [Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess

    When checking that the array access is not out-of-bounds in CheckArrayAccess
    it is possible that the type of the base expression after IgnoreParenCasts is
    incomplete, even though the type of the base expression before IgnoreParenCasts
    is complete. In this case we have no information about whether the array access
    is out-of-bounds and we should just bail-out instead. This fixes PR39746 which
    was caused by trying to obtain the size of an incomplete type.

    Differential Revision: https://reviews.llvm.org/D55862

    Reviewed By: efriedma (detail)
    by brunoricci
  135. [zorg] Uprev clang on sanitizer bots (detail)
    by Vitaly Buka
  136. [zorg] Fix STEP_FAILURE report on Android bot (detail)
    by Vitaly Buka
  137. [llvm-objcopy] [COFF] Don't call memcpy() with a null argument. NFC.

    It is invalid to call memcpy with a null pointer, even if the size
    is zero.

    This should fix the sanitizer buildbot. (detail)
    by mstorsjo
  138. [ConstantFolding] Consolidate and extend bitcount intrinsic tests; NFC

    Move constant folding tests into ConstantFolding/bitcount.ll and drop
    various tests in other places. Add coverage for undefs. (detail)
    by nikic
  139. [ConstantFolding] Add undef tests for overflow intrinsics; NFC (detail)
    by nikic
  140. [ConstantFolding] Regenerate test checks; NFC

    Bring overflow-ops.ll into current format. Remove redundant entry
    blocks. (detail)
    by nikic
  141. [ConstantFolding] Add tests for funnel shifts with undef operands; NFC (detail)
    by nikic
  142. [ConstantFolding] Add tests for sat add/sub with undefs; NFC (detail)
    by nikic
  143. [ConstantFolding] Split up saturating add/sub tests; NFC

    Split each test into a separate function. (detail)
    by nikic
  144. [MC] [AArch64] Correctly resolve ":abs_g1:3" etc.

    We have to treat constructs like this as if they were "symbolic", to use
    the correct codepath to resolve them.  This mostly only affects movz
    etc. because the other uses of classifySymbolRef conservatively treat
    everything that isn't a constant as if it were a symbol.

    Differential Revision: https://reviews.llvm.org/D55906 (detail)
    by efriedma
  145. [MC] [AArch64] Support resolving fixups for abs_g0 etc.

    This requires a bit more code than other fixups, to distingush between
    abs_g0/abs_g1/etc.  Actually, I think some of the other fixups are
    missing some checks, but I won't try to address that here.

    I haven't seen any real-world code that uses a construct like this, but
    it clearly should work, and we're considering using it in the
    implementation of localescape/localrecover on Windows (see
    https://reviews.llvm.org/D53540). I've verified that binutils produces
    the same code as llvm-mc for the testcase.

    This currently doesn't include support for the *_s variants (that
    requires a bit more work to set the opcode).

    Differential Revision: https://reviews.llvm.org/D55896 (detail)
    by efriedma
  146. Revert "[analyzer] pr38668: Do not attempt to cast loaded values..."

    This reverts commit r349701.

    The patch was incorrect. The whole point of CastRetrievedVal()
    is to handle the case in which the type from which the cast is made
    (i.e., the "type" of value `V`) has nothing to do with the type of
    the region it was loaded from (i.e., `R->getValueType()`).

    Differential Revision: https://reviews.llvm.org/D55875

    rdar://problem/45062567 (detail)
    by dergachev
  147. [zorg] Fix STEP_FAILURE report on Android bot (detail)
    by Vitaly Buka
  148. [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (clang)

    This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 VPROL/VPROR rotation intrinsics.

    LLVM counterpart: https://reviews.llvm.org/D55938

    Differential Revision: https://reviews.llvm.org/D55937 (detail)
    by rksimon
  149. [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (llvm)

    This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 VPROL/VPROR rotation intrinsics.

    Clang counterpart: https://reviews.llvm.org/D55937

    Differential Revision: https://reviews.llvm.org/D55938 (detail)
    by rksimon
  150. [LAA] Avoid generating RT checks for known deps preventing vectorization.

    If we found unsafe dependences other than 'unknown', we already know at
    compile time that they are unsafe and the runtime checks should always
    fail. So we can avoid generating them in those cases.

    This should have no negative impact on performance as the runtime checks
    that would be created previously should always fail. As a sanity check,
    I measured the test-suite, spec2k and spec2k6 and there were no regressions.

    Reviewers: Ayal, anemet, hsaito

    Reviewed By: Ayal

    Differential Revision: https://reviews.llvm.org/D55798 (detail)
    by fhahn
  151. Add missing -oso-prepend-path to dsymutil test.

    Thanks to Galina Kistanova for pointing this out! (detail)
    by Adrian Prantl
  152. [CMake] Add libunwind when 'all' is being passed as LLVM_ENABLE_PROJECTS

    Reviewers: zturner

    Subscribers: mgorny, jkorous, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55942 (detail)
    by Louis Dionne
  153. Use @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.

    Calls to this function are deleted in the ARC optimizer.  However when the ARC
    optimizer was updated to use intrinsics instead of functions (r349534), the corresponding
    clang change (r349535) to use intrinsics missed this one so it wasn't being deleted. (detail)
    by Pete Cooper
  154. [libcxx] Fix order checking in unordered_multimap tests.

    Some tests assume that iteration through an unordered multimap elements
    will return them in the same order as at the container creation. This
    assumption is not true since the container is unordered, so that no
    specific order of elements is ever guaranteed for such container. This
    patch introduces checks verifying that any iteration will return elements
    exactly from a set of valid values and without repetition, but in no
    particular order.

    Reviewed as https://reviews.llvm.org/D54838.
    Thanks to Andrey Maksimov for the patch. (detail)
    by Louis Dionne
  155. Add PLATFORM constants for iOS, tvOS, and watchOS simulators

    Summary:
    Add PLATFORM constants for iOS, tvOS, and watchOS simulators, as well
    as human readable names for these constants, to the Mach-O file format
    header files.

    rdar://46854119

    Reviewers: ab, davide

    Reviewed By: ab, davide

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55905 (detail)
    by mtrent
  156. [BPF] Disable relocation for .BTF.ext section

    Build llvm with assertion on, and then build bcc against this llvm.
    Run any bcc tool with debug=8 (turning on -g for clang compilation),
    you will get the following assertion errors,
      /home/yhs/work/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:888:
      void llvm::RuntimeDyldELF::resolveBPFRelocation(const llvm::SectionEntry&, uint64_t,
        uint64_t, uint32_t, int64_t): Assertion `Value <= (4294967295U)' failed.

    The .BTF.ext ELF section uses Fixup's to get the instruction
    offsets. The data width of the Fixup is 4 bytes since we only need
    the insn offset within the section.

    This caused the above error though since R_BPF_64_32 expects
    4-byte value and the Runtime Dyld tried to resolve the actual
    insn address which is 8 bytes.

    Actually the offset within the section is all what we need.
    Therefore, there is no need to perform any kind of relocation
    for .BTF.ext section and such relocation will actually cause
    incorrect result.

    This patch changed BPFELFObjectWriter::getRelocType() such that
    for Fixup Kind FK_Data_4, if the relocation Target is a temporary
    symbol, let us skip the relocation (ELF::R_BPF_NONE).

    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Yonghong Song <yhs@fb.com> (detail)
    by yhs
  157. [CodeView] Emit global variables within lexical scopes to limit visibility

    Emit static locals within the correct lexical scope so variables with the same
    name will not confuse the debugger into getting the wrong value.

    Differential Revision: https://reviews.llvm.org/D55336 (detail)
    by bwyma
  158. Correct the diagnose_if attribute documentation. Fixes PR35845. (detail)
    by aaronballman
  159. [InstCombine] Preserve access-group metadata.

    Preserve llvm.access.group metadata when combining store instructions.
    This was forgotten in r349725.

    Fixes llvm.org/PR40117 (detail)
    by meinersbur
  160. [x86] add test to show missed movddup load fold; NFC (detail)
    by spatel
  161. Test commit

    Fix a simple typo. (detail)
    by amilendra
  162. [Hexagon] Add patterns for funnel shifts (detail)
    by kparzysz
  163. [clangd] Try to workaround test failure by increasing the timeouts

    Ideally we'd figure out a way to run this test without any sleeps, this
    workaround is only there to avoid annoying people with test failures
    around the holiday period when everyone is on vacation. (detail)
    by ibiryukov
  164. [clangd] Expose FileStatus to LSP.

    Summary:
    Add an LSP extension "textDocument/clangd.fileStatus" to emit file-status information.

    Reviewers: ilya-biryukov

    Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55363 (detail)
    by hokein
  165. [SelectionDAGBuilder] Enable funnel shift building to custom rotates

    This patch enables funnel shift -> rotate building for all ROTL/ROTR custom/legal operations.

    AFAICT X86 was the last target that was missing modulo support (PR38243), but I've tried to CC stakeholders for every target that has ROTL/ROTR custom handling for their final OK.

    Differential Revision: https://reviews.llvm.org/D55747 (detail)
    by rksimon
  166. [RISCV] Properly evaluate fixup_riscv_pcrel_lo12

    This is a update to D43157 to correctly handle fixup_riscv_pcrel_lo12.

    Notable changes:

    Rebased onto trunk
    Handle and test S-type
    Test case pcrel-hilo.s is merged into relocations.s

    D43157 description:
    VK_RISCV_PCREL_LO has to be handled specially. The MCExpr inside is
    actually the location of an auipc instruction with a VK_RISCV_PCREL_HI fixup
    pointing to the real target.

    Differential Revision: https://reviews.llvm.org/D54029
    Patch by Chih-Mao Chen and Michael Spencer. (detail)
    by asb
  167. [X86][AVX512] Don't custom lower v16i8 rotations.

    As discussed on D55747, the expansion to (wider) shifts is better on all AVX512 cases, not just BWI. (detail)
    by rksimon
  168. [Sanitizer] Enable vis api on FreeBSD

    Reviewers: krytarowski

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55923 (detail)
    by David CARLIER
  169. [SystemZ] "Generic" vector assembler instructions shoud clobber CC

    There are several vector instructions which may or may not set the
    condition code register, depending on the value of an argument.

    For codegen, we use two versions of the instruction, one that sets
    CC and one that doesn't, which hard-code appropriate values of that
    argument.  But we also have a "generic" version of the instruction
    that is used for the assembler/disassembler.  These generic versions
    should always be considered to clobber CC just to be safe. (detail)
    by uweigand
  170. Fix gcc7 -Wdangling-else warning. NFCI. (detail)
    by rksimon
  171. [InstCombine] Make x86 PADDS/PSUBS constant folding tests generic

    As discussed on D55894, this replaces the existing PADDS/PSUBUS intrinsics with the the sadd/ssub.sat generic intrinsics and moves the tests out of the x86 subfolder.

    PR40110 has been raised to fix the regression with constant folding vectors containing undef elements. (detail)
    by rksimon
  172. [clang-tidy] Use translationUnitDecl() instead of a custom matcher. (detail)
    by alexfh
  173. [gn build] Add build files for clang/lib/{Analysis,Edit,Sema}

    Differential Revision: https://reviews.llvm.org/D55913 (detail)
    by nico
  174. [gn build] Add build files for clang/lib/Lex and clang/lib/AST

    Differential Revision: https://reviews.llvm.org/D55912 (detail)
    by nico
  175. [Sema][NFC] Add test for static_assert diagnistics with constexpr template functions. (detail)
    by courbet
  176. [Driver] Fix accidentally reversed condition in r349752 (detail)
    by mgorny
  177. [SystemZ] Improve testing of vecintrin.h intrinsics

    This adds assembly-level tests to verify that the high-level
    intrinsics generate the instructions they're supposed to.
    These tests would have caught the codegen bugs I just fixed. (detail)
    by uweigand
  178. Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

    Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
    OpenBSD and DragonFly with matching isOS*BSD() methods.  This should
    improve the consistency of coding style without changing the behavior.
    Direct getOS() comparisons were left whenever used in switch or switch-
    like context.

    Differential Revision: https://reviews.llvm.org/D55916 (detail)
    by mgorny
  179. [SystemZ] Fix wrong codegen caused by typos in vecintrin.h

    The following two bugs in SystemZ high-level vector intrinsics are
    fixes by this patch:

    - The float case of vec_insert_and_zero should generate a VLLEZF
      pattern, but currently erroneously generates VLLEZLF.

    - The float and double versions of vec_orc erroneously generate
      and-with-complement instead of or-with-complement.

    The patch also fixes a couple of typos in the associated test. (detail)
    by uweigand
  180. [clangd] Don't miss the expected type in merge.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55918 (detail)
    by hokein
  181. [SystemZ] Make better use of VLLEZ

    This patch fixes two deficiencies in current code that recognizes
    the VLLEZ idiom:

    - For the floating-point versions, we have ISel patterns that match
      on a bitconvert as the top node.  In more complex cases, that
      bitconvert may already have been merged into something else.
      Fix the patterns to match the inner nodes instead.

    - For the 64-bit integer versions, depending on the surrounding code,
      we may get either a DAG tree based on JOIN_DWORDS or one based on
      INSERT_VECTOR_ELT.  Use a PatFrags to simply match both variants. (detail)
    by uweigand
  182. [SystemZ] Make better use of VGEF/VGEG

    Current code in SystemZDAGToDAGISel::tryGather refuses to perform
    any transformation if the Load SDNode has more than one use.  This
    (erronously) counts uses of the chain result, which prevents the
    optimization in many cases unnecessarily.  Fixed by this patch. (detail)
    by uweigand
  183. Re-land r349731 "[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads.

    Update PPC ir following GEP->bitcat to bitcat->GEP->bitcat change. (detail)
    by courbet
  184. [SystemZ] Make better use of VLDEB

    We already have special code (DAG combine support for FP_ROUND)
    to recognize cases where we an use a vector version of VLEDB to
    perform two floating-point truncates in parallel, but equivalent
    support for VLEDB (vector floating-point extends) has been
    missing so far.  This patch adds corresponding DAG combine
    support for FP_EXTEND. (detail)
    by uweigand
  185. Revert "[sanitizer] Support running without fd 0,1,2."

    This reverts commit r349699.
    Reason: the commit breaks compilation of sanitizer_rtems.cc when
    building for RTEMS. (detail)
    by ibiryukov
  186. [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsics (llvm)

    Pulled out of D55894 to match the clang changes in D55890.

    Differential Revision: https://reviews.llvm.org/D55890 (detail)
    by rksimon
  187. [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsics (clang)

    This emits SADD_SAT/SSUB_SAT generic intrinsics for the SSE signed saturated math intrinsics.

    LLVM counterpart: https://reviews.llvm.org/D55894

    Differential Revision: https://reviews.llvm.org/D55890 (detail)
    by rksimon
  188. [X86] Update PADDSW/PSUBSW intrinsic usage with generic saturated intrinsics.

    As discussed on D55894, this makes no difference to the actual test. (detail)
    by rksimon
  189. [llvm-objcopy] Use ELFOSABI_NONE instead of 0. NFC.

    This was requested during the review of D55886.
    (sorry, forgot to address this) (detail)
    by grimar
  190. [asan] Revert still Androind incompatible tests enabled in r349736 (detail)
    by Vitaly Buka
  191. [X86] Change 'simple nonmem' intrinsic test to not use PADDSW

    Those intrinsics will be autoupgraded soon to @llvm.sadd.sat generics (D55894), so to keep a x86-specific case I'm replacing it with @llvm.x86.sse2.pmulhu.w (detail)
    by rksimon
  192. [llvm-objcopy] - Do not drop the OS/ABI and ABIVersion fields of ELF header

    This is https://bugs.llvm.org/show_bug.cgi?id=40005,

    Patch teaches llvm-objcopy to preserve OS/ABI and ABIVersion fields of ELF header.
    (Currently, it drops them to zero).

    Differential revision: https://reviews.llvm.org/D55886 (detail)
    by grimar
  193. [yaml2obj/obj2yaml] - Support dumping/parsing ABI version.

    These tools were assuming ABI version is 0,
    that is not always true.

    Patch teaches them to work with that field.

    Differential revision: https://reviews.llvm.org/D55884 (detail)
    by grimar
  194. [asan] Fix and re-enable few test on Android (detail)
    by Vitaly Buka
  195. [InstCombine][AMDGPU] Handle more buffer intrinsics

    Summary:
    Include the following intrinsics in the InsctCombine
    simplification:

    * amdgcn_raw_buffer_load
    * amdgcn_raw_buffer_load_format
    * amdgcn_struct_buffer_load
    * amdgcn_struct_buffer_load_format

    Change-Id: I14deceff74bcb21179baf6aa6e94bf39e7d63d5d

    Reviewers: arsenm

    Reviewed By: arsenm

    Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55882 (detail)
    by Piotr Sobczak
  196. [MSan] Don't emit __msan_instrument_asm_load() calls

    LLVM treats void* pointers passed to assembly routines as pointers to
    sized types.
    We used to emit calls to __msan_instrument_asm_load() for every such
    void*, which sometimes led to false positives.
    A less error-prone (and truly "conservative") approach is to unpoison
    only assembly output arguments. (detail)
    by glider
  197. Revert r349731 "[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads."

    Forgot to update PowerPC tests for the GEP->bitcast change. (detail)
    by courbet
  198. [NFC] Fix trailing comma after function.

    lib/Analysis/VectorUtils.cpp:482:2: warning: extra ‘;’ [-Wpedantic] (detail)
    by courbet
  199. [CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads.

    Summary:
    This allows expanding {7,11,13,14,15,21,22,23,25,26,27,28,29,30,31}-byte memcmp
    in just two loads on X86. These were previously calling memcmp.

    Reviewers: spatel, gchatelet

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55263 (detail)
    by courbet
  200. [HWASAN] Add support for memory intrinsics

    This is patch complements D55117 implementing __hwasan_mem*
    functions in runtime

    Differential revision: https://reviews.llvm.org/D55554 (detail)
    by evgeny777
  201. [Sema] Better static assert diagnostics for expressions involving temporaries/casts/....

    Summary:
    Handles expressions such as:
    - `std::is_const<T>()`
    - `std::is_const<T>()()`;
    - `std::is_same(decltype(U()), V>::value`;

    Reviewers: aaron.ballman, Quuxplusone

    Subscribers: cfe-commits, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55552 (detail)
    by courbet
  202. [HWASAN] Add support for memory intrinsics

    Differential revision: https://reviews.llvm.org/D55117 (detail)
    by evgeny777
  203. [PowerPC] Implement the isSelectSupported() target hook

    Summary:
    PowerPC has scalar selects (isel) and vector mask selects (xxsel). But PowerPC
    does not have vector CR selects, PowerPC does not support scalar condition
    selects on vectors.
    In addition to implementing this hook, isSelectSupported() should return false
    when the SelectSupportKind is ScalarCondVectorVal, so that predictable selects
    are converted into branch sequences.

    Reviewed By: steven.zhang,  hfinkel

    Differential Revision: https://reviews.llvm.org/D55754 (detail)
    by zhangkang
  204. [DAGCombiner] Fix a place that was creating a SIGN_EXTEND with an extra operand. (detail)
    by ctopper
  205. Introduce llvm.loop.parallel_accesses and llvm.access.group metadata.

    The current llvm.mem.parallel_loop_access metadata has a problem in that
    it uses LoopIDs. LoopID unfortunately is not loop identifier. It is
    neither unique (there's even a regression test assigning the some LoopID
    to multiple loops; can otherwise happen if passes such as LoopVersioning
    make copies of entire loops) nor persistent (every time a property is
    removed/added from a LoopID's MDNode, it will also receive a new LoopID;
    this happens e.g. when calling Loop::setLoopAlreadyUnrolled()).
    Since most loop transformation passes change the loop attributes (even
    if it just to mark that a loop should not be processed again as
    llvm.loop.isvectorized does, for the versioned and unversioned loop),
    the parallel access information is lost for any subsequent pass.

    This patch unlinks LoopIDs and parallel accesses.
    llvm.mem.parallel_loop_access metadata on instruction is replaced by
    llvm.access.group metadata. llvm.access.group points to a distinct
    MDNode with no operands (avoiding the problem to ever need to add/remove
    operands), called "access group". Alternatively, it can point to a list
    of access groups. The LoopID then has an attribute
    llvm.loop.parallel_accesses with all the access groups that are parallel
    (no dependencies carries by this loop).

    This intentionally avoid any kind of "ID". Loops that are clones/have
    their attributes modifies retain the llvm.loop.parallel_accesses
    attribute. Access instructions that a cloned point to the same access
    group. It is not necessary for each access to have it's own "ID" MDNode,
    but those memory access instructions with the same behavior can be
    grouped together.

    The behavior of llvm.mem.parallel_loop_access is not changed by this
    patch, but should be considered deprecated.

    Differential Revision: https://reviews.llvm.org/D52116 (detail)
    by meinersbur
  206. [WebAssembly] Emit a splat for v128 IMPLICIT_DEF

    Summary:
    This is a code size savings and is also important to get runnable code
    while engines do not support v128.const.

    Reviewers: aheejin, dschuff

    Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55910 (detail)
    by tlively
  207. Fix build errors introduced by r349712 on aarch64 bots. (detail)
    by aemerson
  208. [WebAssembly] Gate unimplemented SIMD ops on flag

    Summary:
    Gates v128.const, f32x4.sqrt, f32x4.div, i8x16.extract_lane_u, and
    i16x8.extract_lane_u on the --wasm-enable-unimplemented-simd flag,
    since these ops are not implemented yet in V8.

    Reviewers: aheejin, dschuff

    Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55904 (detail)
    by tlively
  209. Remove pointless casts. (detail)
    by eugenis
  210. AMDGPU: Make i1/i64/v2i32 and/or/xor legal

    The 64-bit types do depend on the register bank,
    but that's another issue to deal with later. (detail)
    by arsenm
  211. AMDGPU/GlobalISel: Fix ValueMapping tables for i1

    This was incorrectly selecting SGPR for any i1 values,
    e.g. G_TRUNC to i1 from a VGPR was still an SGPR. (detail)
    by arsenm
  212. [X86] Disable custom widening of signed/unsigned add/sub saturation intrinsics under -x86-experimental-vector-widening-legalization.

    Generic legalization should take care of this. (detail)
    by ctopper
  213. [AArch64][GlobalISel] Implement selection og G_MERGE of two s32s into s64.

    This code pattern is an unfortunate side effect of the way some types get split
    at call lowering. Ideally we'd either not generate it at all or combine it away
    in the legalizer artifact combiner.

    Until then, add selection support anyway which is a significant proportion of
    our current fallbacks on CTMark.

    rdar://46491420 (detail)
    by aemerson
  214. [binutils] NFC: fix clang-tidy warning: use empty() instead of size() == 0 (detail)
    by rupprecht
  215. AMDGPU/GlobalISel: RegBankSelect for fp conversions (detail)
    by arsenm
  216. AMDGPU/GlobalISel: Legality/regbankselect for atomicrmw/atomic_cmpxchg (detail)
    by arsenm
  217. [asan] Undo special treatment of linkonce_odr and weak_odr

    Summary:
    On non-Windows these are already removed by ShouldInstrumentGlobal.
    On Window we will wait until we get actual issues with that.

    Reviewers: pcc

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55899 (detail)
    by Vitaly Buka
  218. [asan] Prevent folding of globals with redzones

    Summary:
    ICF prevented by removing unnamed_addr and local_unnamed_addr for all sanitized
    globals.
    Also in general unnamed_addr is not valid here as address now is important for
    ODR violation detector and redzone poisoning.

    Before the patch ICF on globals caused:
    1. false ODR reports when we register global on the same address more than once
    2. globals buffer overflow if we fold variables of smaller type inside of large
    type. Then the smaller one will poison redzone which overlaps with the larger one.

    Reviewers: eugenis, pcc

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55857 (detail)
    by Vitaly Buka
  219. [asan] Disable test incompatible with new Android (detail)
    by Vitaly Buka
  220. [gn build] Make `ninja check-lld` also run LLD's unit tests

    And add build files for gtest.

    With this, the build files for //lld are complete.

    Differential Revision: https://reviews.llvm.org/D55838 (detail)
    by nico
  221. [DwarfExpression] Fix a typo in a doxygen comment. NFC. (detail)
    by mattd
  222. [gn build] Add check-lld target and make it work

    Also add a build file for llvm-lit, which in turn needs llvm/tools/llvm-config.

    With this, check-lld runs and passes all of lld's lit tests. It doesn't run any
    of its unit tests yet.

    Running just ninja -C out/gn will build all prerequisites needed to run tests,
    but it won't run the tests (so that the build becomes clean after one build).
    Running ninja -C out/gn check-lld will build prerequisites if needed and run
    the tests. The check-lld target never becomes clean and runs tests every time.

    llvm-config's build file is a bit gnarly: Everything not needed to run tests is
    basically stubbed out. Also, to generate LibraryDependencies.inc we shell out
    to llvm-build at build-time. It would be much nicer to get the library
    dependencies by using the dependency data the GN build contains
    (http://llvm-cs.pcc.me.uk/gen/tools/llvm-config/LibraryDependencies.inc#1).

    Differential Revision: https://reviews.llvm.org/D55836 (detail)
    by nico
  223. [analyzer] pr38668: Do not attempt to cast loaded values of non-scalar types.

    It is expected to have the same object (memory region) treated as if it has
    different types in different program points. The correct behavior for
    RegionStore when an object is stored as an object of type T1 but loaded as
    an object of type T2 is to store the object as if it has type T1 but cast it
    to T2 during load.

    Note that the cast here is some sort of a "reinterpret_cast" (even in C). For
    instance, if you store a float and load an integer, you won't have your float
    rounded to an integer; instead, you will have garbage.

    Admit that we cannot perform the cast as long as types we're dealing with are
    non-trivial (neither integers, nor pointers).

    Of course, if the cast is not necessary (eg, T1 == T2), we can still load the
    value just fine.

    Differential Revision: https://reviews.llvm.org/D55875

    rdar://problem/45062567 (detail)
    by dergachev
  224. [sanitizer] Support running without fd 0,1,2.

    Summary:
    Support running with no open file descriptors (as may happen to
    "init" process on linux).
    * Remove a check that writing to stderr succeeds.
    * When opening a file (ex. for log_path option), dup the new fd out of
    [0, 2] range to avoid confusing the program.

    Reviewers: pcc, vitalybuka

    Subscribers: kubamracek, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55801 (detail)
    by eugenis
  225. [analyzer] GenericTaint: Fix formatting to prepare for incoming improvements.

    Patch by Gábor Borsik!

    Differential Revision: https://reviews.llvm.org/D54918 (detail)
    by dergachev
  226. [analyzer] Improve modeling for returning an object from the top frame with RVO.

    Static Analyzer processes the program function-by-function, sometimes diving
    into other functions ("inlining" them). When an object is returned from an
    inlined function, Return Value Optimization is modeled, and the returned object
    is constructed at its return location directly.

    When an object is returned from the function from which the analysis has started
    (the top stack frame of the analysis), the return location is unknown. Model it
    with a SymbolicRegion based on a conjured symbol that is specifically tagged for
    that purpose, because this is generally the correct way to symbolicate
    unknown locations in Static Analyzer.

    Fixes leak false positives when an object is returned from top frame in C++17:
    objects that are put into a SymbolicRegion-based memory region automatically
    "escape" and no longer get reported as leaks. This only applies to C++17 return
    values with destructors, because it produces a redundant CXXBindTemporaryExpr
    in the call site, which confuses our liveness analysis. The actual fix
    for liveness analysis is still pending, but it is no longer causing problems.

    Additionally, re-enable temporary destructor tests in C++17.

    Differential Revision: https://reviews.llvm.org/D55804

    rdar://problem/46217550 (detail)
    by dergachev
  227. [X86] Remove TLI variable from ReplaceNodeResults. NFC

    We're already in X86TargetLowering which is a derived class of TargetLowering. We can just call methods directly. (detail)
    by ctopper
  228. AMDGPU: Add patterns for v4i16/v4f16 -> v4i16/v4f16 bitcasts

    Reviewers: arsenm, tstellar

    Reviewed By: arsenm

    Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55058 (detail)
    by pendingchaos
  229. [CodeGenPrepare] Fix bad IR created by large offset GEP splitting.

    Creating the IR builder, then modifying the CFG, leads to an IRBuilder
    where the BB and insertion point are inconsistent, so new instructions
    have the wrong parent.

    Modified an existing test because the test wasn't covering anything
    useful (the "invoke" was not actually an invoke by the time we hit the
    code in question).

    Differential Revision: https://reviews.llvm.org/D55729 (detail)
    by efriedma
  230. Disable -faddsig by default for PS4 target. (detail)
    by dyung
  231. Fix test commit

    Seems that was actually a eight space tab... (detail)
    by pendingchaos
  232. Test commit

    Replace tab with 4 spaces. (detail)
    by pendingchaos
  233. [llvm-mca] Rename directory for the Cortex tests (NFC) (detail)
    by evandro
  234. [llvm-mca] Update Exynos test cases (NFC) (detail)
    by evandro
  235. [AArch64] Improve Exynos predicates

    Expand the predicate `ExynosResetPred` to include all forms of immediate
    moves. (detail)
    by evandro
  236. [AArch64] Use canonical copy idiom

    Use only the canonical form of the alias for register transfers in the
    `IsCopyIdiomPred` predicate. (detail)
    by evandro
  237. Revert "[BDCE][DemandedBits] Detect dead uses of undead instructions"

    This reverts commit r349674. It causes a failure in
    test-suite enc-3des.execution_time. (detail)
    by nikic
  238. [analyzer] CStringChecker: Add the forgotten test file.

    Differential Revision: https://reviews.llvm.org/D55873

    rdar://problem/45366551 (detail)
    by dergachev
  239. [analyzer] CStringChecker: Fix a crash on C++ overloads of standard functions.

    It turns out that it's not all that uncommon to have a C++ override of, say,
    memcpy that receives a structure (or two) by reference (or by value, if it's
    being copied from) and copies memory from it (or into it, if it's passed
    by reference). In this case the argument will be of structure type (recall that
    expressions of reference type do not exist: instead, C++ classifies expressions
    into prvalues and lvalues and xvalues).

    In this scenario we crash because we are trying to assume that, say,
    a memory region is equal to an empty CompoundValue (the non-lazy one; this is
    what makeZeroVal() return for compound types and it represents prvalue of
    an object that is initialized with an empty initializer list).

    Add defensive checks.

    Differential Revision: https://reviews.llvm.org/D55873

    rdar://problem/45366551 (detail)
    by dergachev
  240. [llvm-ar] Simplify string table get-or-insert pattern with .insert, NFC (detail)
    by rnk
  241. [x86] add test to show ddup hole; NFC (PR37502) (detail)
    by spatel
  242. [gn build] Add build file for clang/lib/Basic and dependencies, 2nd try

    Adds a build file for clang-tblgen and an action for running it, and uses that
    to process all the .td files in include/clang/Basic.

    Also adds an action to write include/clang/Config/config.h and
    include/clang/Basic/Version.inc.

    Differential Revision: https://reviews.llvm.org/D55847

    (The previous commit of this contained unrelated changes, so I reverted the
    whole previous commit and I'm now landing only what I intended to land.) (detail)
    by nico
  243. Revert 349677, it contained a whole bunch of stuff I did not mean to commit (detail)
    by nico
  244. [gn build] Add build file for clang/lib/Basic and dependencies

    Adds a build file for clang-tblgen and an action for running it, and uses that
    to process all the .td files in include/clang/Basic.

    Also adds an action to write include/clang/Config/config.h and
    include/clang/Basic/Version.inc.

    Differential Revision: https://reviews.llvm.org/D55847 (detail)
    by nico
  245. [libcxx] Use custom allocator's `construct` in C++03 when available.

    Makes libc++ behavior consistent between C++03 and C++11.

    Can use `decltype` in C++03 because `include/__config` defines a macro when
    `decltype` is not available.

    Reviewers: mclow.lists, EricWF, erik.pilkington, ldionne

    Reviewed By: ldionne

    Subscribers: dexonsmith, cfe-commits, howard.hinnant, ldionne, christof, jkorous, Quuxplusone

    Differential Revision: https://reviews.llvm.org/D48753 (detail)
    by vsapsai
  246. [BDCE][DemandedBits] Detect dead uses of undead instructions

    This (mostly) fixes https://bugs.llvm.org/show_bug.cgi?id=39771.

    BDCE currently detects instructions that don't have any demanded bits
    and replaces their uses with zero. However, if an instruction has
    multiple uses, then some of the uses may be dead (have no demanded bits)
    even though the instruction itself is still live. This patch extends
    DemandedBits/BDCE to detect such uses and replace them with zero.
    While this will not immediately render any instructions dead, it may
    lead to simplifications (in the motivating case, by converting a rotate
    into a simple shift), break dependencies, etc.

    The implementation tries to strike a balance between analysis power and
    complexity/memory usage. Originally I wanted to track demanded bits on
    a per-use level, but ultimately we're only really interested in whether
    a use is entirely dead or not. I'm using an extra set to track which uses
    are dead. However, as initially all uses are dead, I'm not storing uses
    those user is also dead. This case is checked separately instead.

    The test case has a couple of cases that are not simplified yet. In
    particular, we're only looking at uses of instructions right now. I think
    it would make sense to also extend this to arguments. Furthermore
    DemandedBits doesn't yet know some of the tricks that InstCombine does
    for the demanded bits or bitwise or/and/xor in combination with known
    bits information.

    Differential Revision: https://reviews.llvm.org/D55563 (detail)
    by nikic
  247. Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
    (was reverted by mistake) (detail)
    by aganea
  248. [X86] Remove a bunch of 'else' after returns in reduceVMULWidth. NFC

    This reduces indentation and makes it obvious this function always returns something. (detail)
    by ctopper
  249. llvm-dwarfdump: Improve/fix pretty printing of array dimensions

    This is to address post-commit feedback from Paul Robinson on r348954.

    The original commit misinterprets count and upper bound as the same thing (I thought I saw GCC producing an upper bound the same as Clang's count, but GCC correctly produces an upper bound that's one less than the count (in C, that is, where arrays are zero indexed)).

    I want to preserve the C-like output for the common case, so in the absence of a lower bound the count (or one greater than the upper bound) is rendered between []. In the trickier cases, where a lower bound is specified, a half-open range is used (eg: lower bound 1, count 2 would be "[1, 3)" and an unknown parts use a '?' (eg: "[1, ?)" or "[?, 7)" or "[?, ? + 3)").

    Reviewers: aprantl, probinson, JDevlieghere

    Differential Revision: https://reviews.llvm.org/D55721 (detail)
    by dblaikie
  250. PR40096: Forwards-compatible with C++20 rule regarding aggregates not having user-declared ctors

    Looks like these were in place to make these types move-only. That's
    generally not a feature that the type should prescribe (unless it's an
    inherent limitation) - instead leaving it up to the users of a type. (detail)
    by dblaikie
  251. [ThinLTO] Remove dllimport attribute from locally defined symbols

    Summary:
    The LTO/ThinLTO driver currently creates invalid bitcode by setting
    symbols marked dllimport as dso_local. The compiler often has access
    to the definition (often dllexport) and the declaration (often
    dllimport) of an object at link-time, leading to a conflicting
    declaration. This patch resolves the inconsistency by removing the
    dllimport attribute.

    Reviewers: tejohnson, pcc, rnk, echristo

    Reviewed By: rnk

    Subscribers: dmikulin, wristow, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, dang, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55627 (detail)
    by ormris
  252. [sanitizer] Remove spurious semi-colon

    Summary:
    An extra ';' at the end of a namespace triggers a pedantic warning:
    ```
    .../sanitizer_common/sanitizer_type_traits.h:42:2: warning: extra ‘;’ [-Wpedantic]
    };  // namespace __sanitizer
    ```

    Reviewers: eugenis, delcypher

    Reviewed By: eugenis

    Subscribers: kubamracek, #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55849 (detail)
    by cryptoad
  253. [GlobalISel][AArch64] Add support for @llvm.ceil

    This adds a G_FCEIL generic instruction and uses it in AArch64. This adds
    selection for floating point ceil where it has a supported, dedicated
    instruction. Other cases aren't handled here.

    It updates the relevant gisel tests and adds a select-ceil test. It also adds a
    check to arm64-vcvt.ll which ensures that we don't fall back when we run into
    one of the relevant cases. (detail)
    by paquette
  254. Work around GCC 9.0 regression (detail)
    by ericwf
  255. [llvm-mca] Rename an error variable. (detail)
    by mattd
  256. [X86] Don't match TESTrr from (cmp (and X, Y), 0) during isel. Defer to post processing

    The (cmp (and X, Y) 0) pattern is greedy and ends up forming a TESTrr and consuming the and when it might be better to use one of the BMI/TBM like BLSR or BLSI.

    This patch moves removes the pattern from isel and adds a post processing check to combine TESTrr+ANDrr into just a TESTrr. With this patch we are able to select the BMI/TBM instructions, but we'll also emit a TESTrr when the result is compared to 0. In many cases the peephole pass will be able to use optimizeCompareInstr to remove the TEST, but its probably not perfect.

    Differential Revision: https://reviews.llvm.org/D55870 (detail)
    by ctopper
  257. [X86] Fix assert fails in pass X86AvoidSFBPass

    Fixes https://bugs.llvm.org/show_bug.cgi?id=38743

    The function removeRedundantBlockingStores is supposed to remove any blocking stores contained in each other in lockingStoresDispSizeMap.
    But it currently looks only at the previous one, which will miss some cases that result in assert.

    This patch refine the function to check all previous layouts until find the uncontained one. So all redundant stores will be removed.

    Patch by Pengfei Wang

    Differential Revision: https://reviews.llvm.org/D55642 (detail)
    by ctopper
  258. [llvm-mca] Add an error handler for error from parseCodeRegions

    Summary:
    It's a bit tricky to add a test for the failing path right now, binary support will have an easier path to exercise the path here.

    * Ran clang-format.



    Reviewers: andreadb

    Reviewed By: andreadb

    Subscribers: tschuett, gbedwell, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55803 (detail)
    by mattd
  259. [OPENMP]Mark the loop as started when initialized.

    Need to mark the loop as started when the initialization statement is
    found. It is required to prevent possible incorrect loop iteraton
    variable detection during template instantiation and fix the compiler
    crash during the codegen. (detail)
    by abataev
  260. Revert r349517 "[CMake] Default options for faster executables on MSVC" (detail)
    by aganea
  261. [CodeComplete] Properly determine qualifiers of 'this' in a lambda

    Summary:
    The clang used to pick up the qualifiers of the lamba's call operator
    (which is always const) and fail to show non-const methods of 'this' in
    completion results.

    Reviewers: kadircet

    Reviewed By: kadircet

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55885 (detail)
    by ibiryukov
  262. Revert r349517 "[CMake] Default options for faster executables on MSVC" (detail)
    by aganea
  263. [AArch64] Improve the Exynos M3 pipeline model (detail)
    by evandro
  264. [llvm-mca] Split test (NFC)

    Split the Exynos test of the register offset addressing mode into separate
    loads and stores tests. (detail)
    by evandro
  265. [Driver] [NetBSD] Add -D_REENTRANT when using sanitizers

    NetBSD intends to support only reentrant interfaces in interceptors.
    When -lpthread is used without _REENTRANT defined, things are
    not guaranteed to work.

    This is especially important for <stdio.h> and sanitization of
    interfaces around FILE.  Some APIs have alternative modes depending
    on the _REENTRANT definition, and NetBSD intends to support sanitization
    of the _REENTRANT ones.

    Differential Revision: https://reviews.llvm.org/D55654 (detail)
    by mgorny
  266. [Driver] Add .hasAnySanitizer() to SanitizerArgs

    Add a simple method to query whether any sanitizer was enabled,
    via SanitizerArgs.  This will be used in the NetBSD driver to pass
    additional definitions that are required by all sanitizers.

    Differential Revision: https://reviews.llvm.org/D55832 (detail)
    by mgorny
  267. [Basic] Correct description of SanitizerSet.empty()

    Differential Revision: https://reviews.llvm.org/D55830 (detail)
    by mgorny
  268. [Driver] Disable -faddrsig by default on NetBSD

    Avoid passing -faddrsig by default on NetBSD.  This platform is still
    using old GNU binutils that crashes on executables containing those
    sections.

    Differential Revision: https://reviews.llvm.org/D55828 (detail)
    by mgorny
  269. Regenerate test (detail)
    by rksimon
  270. [sanitizer_common] Fix sha2 interceptors not to use vars in array len

    Fix the sha2 interceptor macros to use a constant for array parameter
    length rather than referencing the extern variable.  Since the digest
    length is provided in hash name, reuse the macro parameter for it.
    Verify that the calculated value matches the one provided by system
    headers.

    Differential Revision: https://reviews.llvm.org/D55811 (detail)
    by mgorny
  271. Test commit

    Fix typos. (detail)
    by anton-afanasyev
  272. [X86] Remove already upgraded llvm.x86.avx512.mask.padds/psubs tests

    Duplicate tests have already been moved to avx512bw-intrinsics-upgrade.ll (detail)
    by rksimon
  273. [ValueTracking] remove unused parameters from helper functions; NFC (detail)
    by spatel
  274. [BPF] Generate BTF DebugInfo under BPF target

    This patch implements BTF (BPF Type Format).
    The BTF is the debug info format for BPF, introduced
    in the below linux patch:
      https://github.com/torvalds/linux/commit/69b693f0aefa0ed521e8bd02260523b5ae446ad7#diff-06fb1c8825f653d7e539058b72c83332
    and further extended several times, e.g.,
      https://www.spinics.net/lists/netdev/msg534640.html
      https://www.spinics.net/lists/netdev/msg538464.html
      https://www.spinics.net/lists/netdev/msg540246.html

    The main advantage of implementing in LLVM is:
       . better integration/deployment as no extra tools are needed.
       . bpf JIT based compilation (like bcc, bpftrace, etc.) can get
         BTF without much extra effort.
       . BTF line_info needs selective source codes, which can be
         easily retrieved when inside the compiler.

    This patch implemented BTF generation by registering a BPF
    specific DebugHandler in BPFAsmPrinter.

    Signed-off-by: Yonghong Song <yhs@fb.com>

    Differential Revision: https://reviews.llvm.org/D55752 (detail)
    by yhs
  275. Add missing include to test. NFC (detail)
    by marshall
  276. [gn build] Merge r349605 (detail)
    by nico
  277. [Object] Deduplicate long archive member names

    Summary:
    Import libraries as created by llvm-dlltool always use the same archive
    member name for every object file (namely, the DLL library name). Ensure
    that long names are not repeatedly stored in the string table.

    Reviewed By: ruiu

    Differential Revision: https://reviews.llvm.org/D55860 (detail)
    by lekensteyn
  278. [clang-tidy] Diagnose abseil-duration-comparison on macro arguments

    Summary:
    This change relaxes the requirements on the utility
    `rewriteExprFromNumberToDuration` function, and introduces new checking
    inside of the `abseil-duration-comparison` check to allow macro argument
    expression transformation.

    Differential Revision: https://reviews.llvm.org/D55784 (detail)
    by hwright
  279. [OpenMP] Fix data sharing analysis in nested clause

    Without this patch, clang doesn't complain that X needs explicit data
    sharing attributes in the following:

    ```
    #pragma omp target teams default(none)
    {
       #pragma omp parallel num_threads(X)
         ;
    }
    ```

    However, clang does produce that complaint after the braces are
    removed.  With this patch, clang complains in both cases.

    Reviewed By: ABataev

    Differential Revision: https://reviews.llvm.org/D55861 (detail)
    by jdenny
  280. [compiler-rt][builtins][PowerPC] Enable builtins tests on PowerPC 64 bit LE

    This patch aims to enable the tests for the compiler-rt builtin functions (that
    currently already exist within compiler-rt) for PowerPC 64bit LE (ppc64le).
    Previously when unit tests are run, these tests would be reported as
    UNSUPPORTED. This patch updates the REQUIRES line for each test (to enable for
    ppc64le), and each test is linked against compiler-rt when running.

    Differential Revision: https://reviews.llvm.org/D54449 (detail)
    by amyk
  281. Test commit (detail)
    by amyk
  282. [clangd] Fix a syntax error on the test. (detail)
    by hokein
  283. [X86][SSE] Auto upgrade PADDUS/PSUBUS intrinsics to UADD_SAT/USUB_SAT generic intrinsics (clang)

    Sibling patch to D55855, this emits UADD_SAT/USUB_SAT generic intrinsics for the SSE saturated math intrinsics instead of expanding to a IR code sequence that could be difficult to reassemble.

    Differential Revision: https://reviews.llvm.org/D55879 (detail)
    by rksimon
  284. [X86][SSE] Auto upgrade PADDUS/PSUBUS intrinsics to UADD_SAT/USUB_SAT generic intrinsics (llvm)

    Now that we use the generic ISD opcodes, we can use the generic intrinsics directly as well. This fixes the poor fast-isel codegen by not expanding to an easily broken IR code sequence.

    I'm intending to deal with the signed saturation equivalents as well.

    Clang counterpart: https://reviews.llvm.org/D55879

    Differential Revision: https://reviews.llvm.org/D55855 (detail)
    by rksimon
  285. [SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate (part 2 of 2)

    Now that SimplifyDemandedBits/SimplifyDemandedVectorElts is simplifying vector elements, we're seeing more constant BUILD_VECTOR containing undefs.

    This patch provides opt-in support for UNDEF elements in matchBinaryPredicate, passing NULL instead of the result ConstantSDNode* argument.

    I've updated the (or (and X, c1), c2) -> (and (or X, c2), c1|c2) fold to demonstrate its use, which I believe is safe for undef cases.

    Differential Revision: https://reviews.llvm.org/D55822 (detail)
    by rksimon
  286. [SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate (part 1 of 2)

    Now that SimplifyDemandedBits/SimplifyDemandedVectorElts is simplifying vector elements, we're seeing more constant BUILD_VECTOR containing undefs.

    This patch provides opt-in support for UNDEF elements in matchBinaryPredicate, passing NULL instead of the result ConstantSDNode* argument.

    Differential Revision: https://reviews.llvm.org/D55822 (detail)
    by rksimon
  287. Portable Python script across Python version

    urllib2 as been renamed into urllib and the library layout has changed.
    Workaround that in a consistent manner.

    Differential Revision: https://reviews.llvm.org/D55199 (detail)
    by serge_sans_paille
  288. [Index] Index paremeters in lambda expressions.

    Summary: This fixes clangd couldn't find references for lambda parameters.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55437 (detail)
    by hokein
  289. [TargetLowering] Fix propagation of undefs in zero extension ops (PR40091)

    As described on PR40091, we have several places where zext (and zext_vector_inreg) fold an undef input into an undef output. For zero extensions this is incorrect as the output should guarantee to least have the new upper bits set to zero.

    SimplifyDemandedVectorElts is the worst offender (and its the most likely to cause new undefs to appear) but DAGCombiner's tryToFoldExtendOfConstant has a similar issue.

    Thanks to @dmgreen for catching this.

    Differential Revision: https://reviews.llvm.org/D55883 (detail)
    by rksimon
  290. Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2

    This relands r330742:
    """
    Let TableGen write output only if it changed, instead of doing so in cmake.

    Removes one subprocess and one temp file from the build for each tablegen
    invocation.

    No intended behavior change.
    """

    In particular, if you see rebuilds after this change that you didn't see
    before this change, that's unintended and it's fine to revert this change
    again (but let me know).

    r330742 got reverted because some people reported that llvm-tblgen ran on every
    build after it.  This could happen if the depfile output got deleted without
    deleting the main .inc output. To fix, make TableGen always write the depfile,
    but keep writing the main .inc output only if it has changed. This matches what
    we did in cmake before.

    Differential Revision: https://reviews.llvm.org/D55842 (detail)
    by nico
  291. [clang-tidy] use "const SourceManager&" parameter, NFC. (detail)
    by hokein
  292. Fix test MC/AMDGPU/reloc.s

    Missed this change in r349620

    Change-Id: I5123e31ed4bb99ad6903b9ede4de4dbe2cc6d453 (detail)
    by nha
  293. [X86][SSE] Remove use of SSE ADDS/SUBS saturation intrinsics from schedule/stack tests

    These are due to be upgraded soon, but good to replace them with generic llvm sadd_sat/ssub_sat intrinsics now.

    The avx512 masked cases need doing as well but require a bit of tidyup first. (detail)
    by rksimon
  294. AMDGPU: Use an ABS32_LO relocation for SCRATCH_RSRC_DWORD1

    Summary:
    Using HI here makes no logical sense, since the dword is only
    32 bits to begin with.

    Current Mesa master does not look at the relocation type at all,
    so this change is fine. Future Mesa will rely on this, however.

    Change-Id: I91085707834c4ac0370926602b93c94b90e44cb1

    Reviewers: arsenm, rampitec, mareko

    Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55369 (detail)
    by nha
  295. Reimplement Thread Static Data ASan routines with TLS

    Summary:
    Thread Static Data cannot be used in early init on NetBSD
    and FreeBSD. Reuse the ASan TSD API for compatibility with
    existing code with an alternative implementation using Thread
    Local Storage.

    New version uses Thread Local Storage to store a pointer
    with thread specific data. The destructor from TSD has been
    replaced with a TLS destrucutor that is called upon thread
    exit.

    Reviewers: joerg, vitalybuka, jfb

    Reviewed By: vitalybuka

    Subscribers: dim, emaste, ro, jfb, devnexen, kubamracek, mgorny, llvm-commits, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55596 (detail)
    by kamil
  296. [clangd] Unify path canonicalizations in the codebase

    Summary:
    There were a few different places where we canonicalized paths, each
    one had its own flavor. This patch tries to unify them all under one place.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55818 (detail)
    by kadircet
  297. [llvm-objdump] - Fix one more BB.

    Should fix the http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25876/steps/build/logs/stdio:

    /home/grosser/buildslave/polly-amd64-linux/llvm.src/tools/llvm-objdump/llvm-objdump.cpp:539:25: error: conditional expression is ambiguous; 'std::string' (aka 'basic_string<char>') can be converted to 'typename std::remove_reference<StringRef>::type' (aka 'llvm::StringRef') and vice versa
          Target = Demangle ? demangle(*SymName) : *SymName; (detail)
    by grimar
  298. [SelectionDAG] Optional handling of UNDEF elements in matchUnaryPredicate

    Now that SimplifyDemandedBits/SimplifyDemandedVectorElts are simplifying vector elements, we're seeing more constant BUILD_VECTOR containing UNDEFs.

    This patch provides opt-in handling of UNDEF elements in matchUnaryPredicate, passing NULL instead of the ConstantSDNode* argument.

    I've updated SelectionDAG::simplifyShift to demonstrate its use.

    Differential Revision: https://reviews.llvm.org/D55819 (detail)
    by rksimon
  299. [X86][SSE] Remove SSE ADDUS/SUBUS saturation intrinsics from schedule/stack tests

    These are already being autoupgraded, currently to an IR sequence, but best to replace them with generic llvm uadd_sat/usub_sat intrinsics (which D55855 will be doing shortly anyhow).

    The avx512 masked cases need doing as well but require a bit of tidyup first. (detail)
    by rksimon
  300. [llvm-objdump] - Fix BB.

    Move the helper method before the first incocation in the file. (detail)
    by grimar
  301. [llvm-objdump] - Demangle the symbols when printing symbol table and relocations.

    This is https://bugs.llvm.org/show_bug.cgi?id=40009,

    llvm-objdump does not demangle the symbols when prints symbol
    table and/or relocations.

    Patch teaches it to do that.

    Differential revision: https://reviews.llvm.org/D55821 (detail)
    by grimar
  302. AMDGPU/InsertWaitcnts: Update VGPR/SGPR bounds when brackets are merged

    Summary:
    Fix an issue where VGPR/SGPR bounds are not properly extended when brackets are merged.
    This manifests as missing waitcnt insertions when multiple brackets are forwarded to a successor block and the first forward has lower VGPR/SGPR bounds.

    Irreducible loop test has been extended based on a CTS failure detected for GFX9.

    Reviewers: nhaehnle

    Reviewed By: nhaehnle

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55602 (detail)
    by critson
  303. [ARM GlobalISel] Support G_CONSTANT for Thumb2

    All we have to do is mark it as legal.

    This allows us to select a lot of new patterns handled by TableGen. This
    patch adds tests for them and splits up the existing test file for
    binary operators into 2 files, one for arithmetic ops and one for
    logical ones. (detail)
    by rovka
  304. tsan: align default value of detect_deadlocks flag with actual behavior

    I tricked myself into thinking that deadlock detection is off by default in TSan by looking at the default value of the detect_deadlocks flag and outdated docs. (Created a pull request to update docs.)
    I even managed to confuse others: https://groups.google.com/forum/#!topic/thread-sanitizer/xYvnAYwtoDk

    However, the default value is overwritten in code (TSan_flags.cc:InitializeFlags). The TSan/deadlock tests also rely on this

    This changes aligns the default value of the flag with the actual default behavior.

    Author: yln (Julian Lettner)
    Reviewed in: https://reviews.llvm.org/D55846 (detail)
    by dvyukov
  305. AMDGPU/GlobalISel: Regbankselect for fsub (detail)
    by arsenm
  306. [llvm-objcopy] [COFF] Fix the Object forward declaration

    This fixes build warnings with clang, and linker errors with MSVC. (detail)
    by mstorsjo
  307. [llvm-objcopy] Initial COFF support

    This is an initial implementation of no-op passthrough copying of COFF
    with objcopy.

    Differential Revision: https://reviews.llvm.org/D54939 (detail)
    by mstorsjo
  308. Use "EvaluateAsRValue" instead of as a known int, because if it's not a known
    integer we want to emit a diagnostic instead of asserting. (detail)
    by void
  309. Revert accidentally included code. (detail)
    by void
  310. [DebugInfo] Make AsmPrinter struct HandlerInfo and Handlers protected

    In AsmPrinter, make struct HandlerInfo and SmallVector
    Handlers protected, so target extended AsmPrinter will
    be able to add their own handlers.

    Signed-off-by: Yonghong Song <yhs@fb.com>

    Differential Revision: https://reviews.llvm.org/D55756 (detail)
    by yhs
  311. [bugpoint][PR29027] Reduce function attributes

    Summary:
    In addition to reducing the functions in an LLVM module, bugpoint now
    reduces the function attributes associated with each of the remaining
    functions.

    To test this, add a -bugpoint-crashfuncattr test pass, which crashes if
    a function in the module has a "bugpoint-crash" attribute. A test case
    demonstrates that the IR is reduced to just that one attribute.

    Reviewers: MatzeB, silvas, davide, reames

    Reviewed By: reames

    Subscribers: reames, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55216 (detail)
    by modocache
  312. Fix use-after-free with profile remapping.

    We need to keep the underlying profile reader alive as long as the
    profile data, because the profile data may contain StringRefs referring
    to strings in the reader's name table. (detail)
    by rsmith
  313. [PowerPC]Exploit P9 vabsdu for unsigned vselect patterns

    For type v4i32/v8ii16/v16i8, do following transforms:
      (vselect (setcc a, b, setugt), (sub a, b), (sub b, a)) -> (vabsd a, b)
      (vselect (setcc a, b, setuge), (sub a, b), (sub b, a)) -> (vabsd a, b)
      (vselect (setcc a, b, setult), (sub b, a), (sub a, b)) -> (vabsd a, b)
      (vselect (setcc a, b, setule), (sub b, a), (sub a, b)) -> (vabsd a, b)

    Differential Revision: https://reviews.llvm.org/D55812 (detail)
    by jedilyn
  314. [gn build] Add build file for llvm-objcopy

    Needed by check-lld.

    This should've been part of r349486 but I messed up.

    Differential Revision: https://reviews.llvm.org/D55831 (detail)
    by nico
  315. Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"

    Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
    This workaround simply chains tablegen projects.

    Differential Revision: https://reviews.llvm.org/D54153 (detail)
    by aganea
  316. Add llvm-objdump man page

    Differential Revision: https://reviews.llvm.org/D54864 (detail)
    by emaste
  317. [asan] Disable ODR test on Android (detail)
    by Vitaly Buka
  318. [Driver] Also obey -nostdlib++ when rewriting -lstdc++.

    Reviewers: pirama

    Reviewed By: pirama

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55856 (detail)
    by danalbert
  319. [AArch64] Simplify the Exynos M3 pipeline model (detail)
    by evandro
  320. [AArch64] Fix instructions order (NFC) (detail)
    by evandro
  321. [llvm-mca] Improve test (NFC)

    Add more instruction variations for Exynos. (detail)
    by evandro
  322. Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch. (detail)
    by marshall
  323. [DebugInfo] Move several private headers to include directory

    This patch moved the following files in lib/CodeGen/AsmPrinter/
      AsmPrinterHandler.h
      DbgEntityHistoryCalculator.h
      DebugHandlerBase.h
    to include/llvm/CodeGen directory.

    Such a change will enable Target to extend DebugHandlerBase
    and emit Target specific debug info sections.

    Signed-off-by: Yonghong Song <yhs@fb.com>

    Differential Revision: https://reviews.llvm.org/D55755 (detail)
    by yhs
  324. Emit ASM input in a constant context

    Summary:
    Some ASM input constraints (e.g., "i" and "n") require immediate values. At O0,
    very few code transformations are performed. So if we cannot resolve to an
    immediate when emitting the ASM input we shouldn't delay its processing.

    Reviewers: rsmith, efriedma

    Reviewed By: efriedma

    Subscribers: rehana, efriedma, craig.topper, jyknight, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55616 (detail)
    by void
  325. [InstCombine] add tests for extract of vector load; NFC

    There's a mismatch internally about how we are handling these patterns.
    We count loads as cheapToScalarize(), but then we don't actually
    scalarize them, so that can leave extra instructions compared to where
    we started when scalarizing other ops. If it's cheapToScalarize, then
    we should be scalarizing. (detail)
    by spatel
  326. Preserve the linkage for objc* intrinsics as clang will set them to weak_external in some cases

    Clang uses weak linkage for objc runtime functions when they are not available on the platform.

    The intrinsic has this linkage so we just need to pass that on to the runtime call. (detail)
    by Pete Cooper
  327. Add nonlazybind to objc_retain/objc_release when converting from intrinsics.

    For performance reasons, clang set nonlazybind on these functions.  Now that we
    are using intrinsics instead of runtime calls, we should set this attribute when
    creating the runtime functions. (detail)
    by Pete Cooper
  328. [LAA] Introduce enum for vectorization safety status (NFC).

    This patch adds a VectorizationSafetyStatus enum, which will be extended
    in a follow up patch to distinguish between 'safe with runtime checks'
    and 'known unsafe' dependences.

    Reviewers: anemet, anna, Ayal, hsaito

    Reviewed By: Ayal

    Differential Revision: https://reviews.llvm.org/D54892 (detail)
    by fhahn
  329. [asan] Restore ODR-violation detection on vtables

    Summary:
    unnamed_addr is still useful for detecting of ODR violations on vtables

    Still unnamed_addr with lld and --icf=safe or --icf=all can trigger false
    reports which can be avoided with --icf=none or by using private aliases
    with -fsanitize-address-use-odr-indicator

    Reviewers: eugenis

    Reviewed By: eugenis

    Subscribers: kubamracek, hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55799 (detail)
    by Vitaly Buka
  330. [LoopVectorize] auto-generate complete checks; NFC

    The first test claims to show that the vectorizer will
    generate a vector load/loop, but then this file runs
    other passes which might scalarize that op. I'm removing
    instcombine from the RUN line here to break that dependency.
    Also, I'm generating full checks to make it clear exactly
    what the vectorizer has done. (detail)
    by spatel
  331. Rewrite objc intrinsics to runtime methods in PreISelIntrinsicLowering instead of SDAG.

    SelectionDAG currently changes these intrinsics to function calls, but that won't work
    for other ISel's.  Also we want to eventually support nonlazybind and weak linkage coming
    from the front-end which we can't do in SelectionDAG. (detail)
    by Pete Cooper
  332. [OPENMP] parsing and sema support for 'close' map-type-modifier

    A map clause with the close map-type-modifier is a hint to
    prefer that the variables are mapped using a copy into faster
    memory.

    Patch by Ahsan Saghir (saghir)

    Differential Revision: https://reviews.llvm.org/D55719 (detail)
    by kli
  333. [AArch64] Avoid crashing on .seh directives in assembly

    Differential Revision: https://reviews.llvm.org/D55670 (detail)
    by mstorsjo
  334. [InstCombine] auto-generate complete checks; NFC (detail)
    by spatel
  335. Fix errors with the Clang natvis file.

    This updates the FunctionProtoType visualizer to use the proper bits for determining parameter information and the DeclarationName visualizer to use the detail namespace. It also adds support for viewing newer special declaration names (like deduction guides).

    Patch with help of Bruno Ricci. (detail)
    by aaronballman
  336. Revert r349541 (Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen) (detail)
    by aganea
  337. [asan] In llvm.asan.globals, allow entries to be non-GlobalVariable and skip over them

    Looks like there are valid reasons why we need to allow bitcasts in llvm.asan.globals, see discussion at https://github.com/apple/swift-llvm/pull/133. Let's look through bitcasts when iterating over entries in the llvm.asan.globals list.

    Differential Revision: https://reviews.llvm.org/D55794 (detail)
    by kuba.brecka
  338. [AARCH64] Added test case for PR40091 (detail)
    by rksimon
  339. [CodeGen] Handle mixed-width ops in mixed-sign mul-with-overflow lowering

    The special lowering for __builtin_mul_overflow introduced in r320902
    fixed an ICE seen when passing mixed-sign operands to the builtin.

    This patch extends the special lowering to cover mixed-width, mixed-sign
    operands. In a few common scenarios, calls to muloti4 will no longer be
    emitted.

    This should address the latest comments in PR34920 and work around the
    link failure seen in:

      https://bugzilla.redhat.com/show_bug.cgi?id=1657544

    Testing:
    - check-clang
    - A/B output comparison with: https://gist.github.com/vedantk/3eb9c88f82e5c32f2e590555b4af5081

    Differential Revision: https://reviews.llvm.org/D55843 (detail)
    by Vedant Kumar
  340. Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen

    Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
    This workaround simply chains tablegen projects.

    Differential Revision: https://reviews.llvm.org/D54153 (detail)
    by aganea
  341. [OPENMP][NVPTX]Emit shared memory buffer for reduction as 128 bytes
    buffer.

    Seems to me, nvlink has a bug with the proper support of the weakly
    linked symbols. It does not allow to define several shared memory buffer
    with the different sizes even with the weak linkage. Instead we always
    use 128 bytes buffer to prevent nvlink from the error message emission. (detail)
    by abataev
  342. [llvm-mca] Update the Exynos test cases (NFC)

    Add more entropy to the test cases. (detail)
    by evandro
  343. [llvm-mca] Dump mask in hex

    Dump the resources masks as hexadecimal. (detail)
    by evandro
  344. Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics

    Differential Revision: https://reviews.llvm.org/D55802

    Reviewers: rjmccall (detail)
    by Pete Cooper
  345. Change the objc ARC optimizer to use the new objc.* intrinsics

    We're moving ARC optimisation and ARC emission in clang away from runtime methods
    and towards intrinsics.  This is the part which actually uses the intrinsics in the ARC
    optimizer when both analyzing the existing calls and emitting new ones.

    Differential Revision: https://reviews.llvm.org/D55348

    Reviewers: ahatanak (detail)
    by Pete Cooper
  346. [X86] Add BSR to isUseDefConvertible.

    We already had BSF here as part of __builtin_ffs improvements and I was just wondering yesterday whether we should have BSR there.

    This addresses one issue from PR40090. (detail)
    by ctopper
  347. [InstCombine] Simplify cttz/ctlz + icmp eq/ne into mask check

    Checking whether a number has a certain number of trailing / leading
    zeros means checking whether it is of the form XXXX1000 / 0001XXXX,
    which can be done with an and+icmp.

    Related to https://bugs.llvm.org/show_bug.cgi?id=28668. As a next
    step, this can be extended to non-equality predicates.

    Differential Revision: https://reviews.llvm.org/D55745 (detail)
    by nikic
  348. [AMDGPU] Removed the unnecessary operand size-check-assert from processBaseWithConstOffset().

    Summary: 32bit operand sizes are guaranteed by the opcode check AMDGPU::V_ADD_I32_e64 and
             AMDGPU::V_ADDC_U32_e64. Therefore, we don't any additional operand size-check-assert.

    Author: FarhanaAleen (detail)
    by faaleen
  349. DebugInfo: Fix missing local imported entities after r349207

    Post commit review/bug reported by Pavel Labath - thanks! (detail)
    by dblaikie
  350. [SCCP] Get rid of redundant call for getPredicateInfoFor (NFC).

    We can use the result fetched a few lines above. (detail)
    by fhahn
  351. [X86] Don't use SplitOpsAndApply to create ISD::UADDSAT/ISD::USUBSAT nodes. Let type legalization and op legalization deal with it.

    Now that we've switched to target independent nodes we can rely on generic infrastructure to do the legalization for us. (detail)
    by ctopper
  352. [OPENMP][NVPTX]Added extra sync point to the inter-warp copy function.

    The parallel reduction operation requires an extra synchronization point
    in the inter-warp copy function to avoid divergence. (detail)
    by abataev
  353. [InstCombine] refactor isCheapToScalarize(); NFC

    As the FIXME indicates, this has the potential to go
    overboard. So I'm not sure if it's even worth keeping
    this vs. iteratively doing simple matches, but we might
    as well clean it up. (detail)
    by spatel
  354. Rework the C strings tests to use ASSERT_SAME_TYPE. NFC there. Also change cwchar.pass.cpp to avoid constructing a couple things from zero - since apparently they can be enums in some weird C library. NFC there, either, since the values were never used. (detail)
    by marshall
  355. [X86] Use SADDSAT/SSUBSAT instead of ADDS/SUBS

    Migrate the X86 backend from X86ISD opcodes ADDS and SUBS to generic
    ISD opcodes SADDSAT and SSUBSAT. This also improves scodegen for
    @llvm.sadd.sat() and @llvm.ssub.sat() intrinsics.

    This is a followup to D55787 and part of PR40056.

    Differential Revision: https://reviews.llvm.org/D55833 (detail)
    by nikic
  356. [X86] Create PSUBUS from (add (umax X, C), -C)

    InstCombine seems to canonicalize or PSUB patter into a max with the cosntant and an add with an inverse of the constant.

    This patch recognizes this pattern and turns it into PSUBUS. Future work could improve undef element handling.

    Fixes some of PR40053

    Differential Revision: https://reviews.llvm.org/D55780 (detail)
    by ctopper
  357. Buildfix for r345516 (Clang compilation failing). (detail)
    by aganea
  358. [CMake] Default options for faster executables on MSVC

    - Disable incremental linking by default. /INCREMENTAL adds extra thunks in the EXE, which makes execution slower.
    - Set /MT (static CRT lib) by default instead of CMake's default /MD (dll CRT lib). The previous default /MD makes all DLL functions to be thunked, thus making execution slower (memcmp, memset, etc.)
    - Adds LLVM_ENABLE_INCREMENTAL_LINK which is set to OFF by default.

    Differential revision: https://reviews.llvm.org/D55056 (detail)
    by aganea
  359. [llvm-symbolizer] Omit stderr output when symbolizing a crash

    Differential revision: https://reviews.llvm.org/D55723 (detail)
    by aganea
  360. [InstCombine] add tests for scalarization; NFC

    We miss pattern matching a splat constant if it has undef elements. (detail)
    by spatel
  361. Add FMF management to common fp intrinsics in GlobalIsel

    Summary: This the initial code change to facilitate managing FMF flags from Instructions to MI wrt Intrinsics in Global Isel.  Eventually the GlobalObserver interface will be added as well, where FMF additions can be tracked for the builder and CSE.

    Reviewers: aditya_nandakumar, bogner

    Reviewed By: bogner

    Subscribers: rovka, kristof.beyls, javed.absar

    Differential Revision: https://reviews.llvm.org/D55668 (detail)
    by mcberg2017
  362. [LoopVectorize] Rename pass options. NFC.

    Rename:
    NoUnrolling to InterleaveOnlyWhenForced
    and
    AlwaysVectorize to !VectorizeOnlyWhenForced

    Contrary to what the name 'AlwaysVectorize' suggests, it does not
    unconditionally vectorize all loops, but applies a cost model to
    determine whether vectorization is profitable to all loops. Hence,
    passing false will disable the cost model, except when a loop is marked
    with llvm.loop.vectorize.enable. The 'OnlyWhenForced' suffix (suggested
    by @hfinkel in D55716) better matches this behavior.

    Similarly, 'NoUnrolling' disables the profitability cost model for
    interleaving (a term to distinguish it from unrolling by the
    LoopUnrollPass); rename it for consistency.

    Differential Revision: https://reviews.llvm.org/D55785 (detail)
    by meinersbur
  363. [X86][SSE] Don't use 'sign bit select' vXi8 ROTL lowering for constant rotation amounts

    Noticed by @spatel on D55747 - we get much better codegen if we use the regular shift expansion. (detail)
    by rksimon
  364. [LoopUnroll] Honor '#pragma unroll' even with -fno-unroll-loops.

    When using clang with `-fno-unroll-loops` (implicitly added with `-O1`),
    the LoopUnrollPass is not not added to the (legacy) pass pipeline. This
    also means that it will not process any loop metadata such as
    llvm.loop.unroll.enable (which is generated by #pragma unroll or
    WarnMissedTransformationsPass emits a warning that a forced
    transformation has not been applied (see
    https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181210/610833.html).
    Such explicit transformations should take precedence over disabling
    heuristics.

    This patch unconditionally adds LoopUnrollPass to the optimizing
    pipeline (that is, it is still not added with `-O0`), but passes a flag
    indicating whether automatic unrolling is dis-/enabled. This is the same
    approach as LoopVectorize uses.

    The new pass manager's pipeline builder has no option to disable
    unrolling, hence the problem does not apply.

    Differential Revision: https://reviews.llvm.org/D55716 (detail)
    by meinersbur
  365. [Driver][PS4] Do not implicitly link against asan or ubsan if -nostdlib or -nodefaultlibs on PS4.

    NFC for targets other than PS4.

    Respect -nostdlib and -nodefaultlibs when enabling asan or ubsan.

    Differential Revision: https://reviews.llvm.org/D55712 (detail)
    by pgousseau
  366. [NFC] Fix usage of Builder.insert(new Bitcast...)in CodeGenFunction

    This is exactly a "CreateBitCast", so refactor this to get rid of a
    'new'.

    Note that this slightly changes the test, as the Builder is now
    seemingly smart enough to fold one of the bitcasts into the annotation
    call.

    Change-Id: I1733fb1fdf91f5c9d88651067130b9a4e7b5ab67 (detail)
    by erichkeane
  367. Portable Python script across Python version

    Make scripts more future-proof by importing most __future__ stuff.

    Differential Revision: https://reviews.llvm.org/D55208 (detail)
    by serge_sans_paille
  368. Portable Python script across Python version

    commands.getoutput has been move to subprocess module in Python3

    Differential Revision: https://reviews.llvm.org/D55205 (detail)
    by serge_sans_paille
  369. [clangd] Try to fix buildbot failure after r349496

    Increase timeout from 10ms to 100ms.
    See http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/27959 (detail)
    by ioeric
  370. Portable Python script across Python version

    In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead.

    The portability patch consists in forcing an extra `list` call if the result is actually used as a list.
    `map` are replaced by list comprehension and `filter` by filtered list comprehension.

    Differential Revision: https://reviews.llvm.org/D55197 (detail)
    by serge_sans_paille
  371. [X86][SSE] Don't use 'sign bit select' vXi8 ROTL lowering for splat rotation amounts

    Noticed by @spatel on D55747 - we get much better codegen if we use the regular shift expansion. (detail)
    by rksimon
  372. [MIPS GlobalISel] Select G_SDIV, G_UDIV, G_SREM and G_UREM

    Add support for s64 libcalls for G_SDIV, G_UDIV, G_SREM and G_UREM
    and use integer type of correct size when creating arguments for
    CLI.lowerCall.
    Select G_SDIV, G_UDIV, G_SREM and G_UREM for types s8, s16, s32 and s64
    on MIPS32.

    Differential Revision: https://reviews.llvm.org/D55651 (detail)
    by petar.avramovic
  373. Emit -Wformat properly for bit-field promotions.

    Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C.

    Patch by Bevin Hansson. (detail)
    by aaronballman
  374. [clangd] BackgroundIndex rebuilds symbol index periodically.

    Summary:
    Currently, background index rebuilds symbol index on every indexed file,
    which can be inefficient. This patch makes it only rebuild symbol index periodically.
    As the rebuild no longer happens too often, we could also build more efficient
    dex index.

    Reviewers: ilya-biryukov, kadircet

    Reviewed By: kadircet

    Subscribers: dblaikie, MaskRay, jkorous, arphaman, jfb, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55770 (detail)
    by ioeric
  375. [AST] Unify the code paths of traversing lambda expressions.

    Summary:
    This supposes to be a non-functional change. We have two code paths when
    traversing lambda expressions:

    1) traverse the function proto typeloc when parameters and return type
    are explicit;
    2) otherwise fallback to traverse parameter decls and return type loc
    individually;

    This patch unifies the code path to always traverse parameters and
    return type, rather than relying on traversing the full type-loc.

    Reviewers: ilya-biryukov

    Subscribers: arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55820 (detail)
    by hokein
  376. Fix a gcc -Wpedantix warning (detail)
    by nico
  377. [gn build] Add build file for llvm-pdbutil

    Needed for check-lld.

    Differential Revision: https://reviews.llvm.org/D55826 (detail)
    by nico
  378. [PowerPC] Make no-PIC default to match GCC - CLANG

    Make -fno-PIC default on PowerPC for Little Endian Linux.

    Differential Revision: https://reviews.llvm.org/D53384 (detail)
    by stefanp
  379. [gn build] Add build file for llvm-bcanalyzer

    Needed for check-lld.

    Differential Revision: https://reviews.llvm.org/D55824 (detail)
    by nico
  380. [gn build] Add build files for llvm-ar, llvm-nm, llvm-objdump, llvm-readelf

    Also add build files for deps DebugInfo/Symbolize, ToolDrivers/dll-tool.
    Also add gn/build/libs/xar (needed by llvm-objdump).

    Also delete an incorrect part of the symlink description in //BUILD.gn (it used
    to be true before I made the symlink step write a stamp file; now it's no
    longer true).

    These are all binaries needed by check-lld that need symlinks.

    Differential Revision: https://reviews.llvm.org/D55743 (detail)
    by nico
  381. [libcxx] Remove XFAILs for older macOS versions

    That test doesn't fail anymore since r349378, since the assertions that
    r349378 removed must have been bugs in the dylib at some point. (detail)
    by Louis Dionne
  382. [X86][SSE] Add shift combine 'out of range' tests with UNDEFs

    Shows failure to simplify out of range shift amounts to UNDEF if any element is UNDEF. (detail)
    by rksimon
  383. [X86] Use UADDSAT/USUBSAT instead of ADDUS/SUBUS

    Replace the X86ISD opcodes ADDUS and SUBUS with generic ISD opcodes
    UADDSAT and USUBSAT. As a side-effect, this also makes codegen for
    the @llvm.uadd.sat and @llvm.usub.sat intrinsics reasonable.

    This only replaces use in the X86 backend, and does not move any of
    the ADDUS/SUBUS X86 specific combines into generic codegen.

    Differential Revision: https://reviews.llvm.org/D55787 (detail)
    by nikic
  384. [SelectionDAG][X86] Fix [US](ADD|SUB)SAT vector legalization, add tests

    Integer result promotion needs to use the scalar size, and we need
    support for result widening.

    This is in preparation for D55787. (detail)
    by nikic
  385. [docs] Improve HowToCrossCompilerBuiltinsOnArm

    Some recent experience on llvm-dev pointed out some errors in the document:
    - Assumption of ninja
    - Use of --march rather than -march
    - Problems with host include files when a multiarch setup was used
    - Insufficient target information passed to assembler
    - Instructions on using the cmake cache file BaremetalARM.cmake were
      incomplete

    There was also insufficient guidance on what to do when various stages
    failed due to misconfiguration or missing steps.

    Summary of changes:
    - Fixed problems above
    - Added a troubleshooting section with common errors.
    - Cleared up one "at time of writing" that is no longer a problem.

    Differential Revision: https://reviews.llvm.org/D55709 (detail)
    by psmith
  386. [llvm-dwarfdump] - Do not error out on R_X86_64_DTPOFF64/R_X86_64_DTPOFF32 relocations.

    This is https://bugs.llvm.org/show_bug.cgi?id=39992,

    If we have the following code (test.cpp):

    thread_local int tdata = 24;
    and build an .o file with debug information:

    clang --target=x86_64-pc-linux -c bar.cpp -g

    Then object produced may have R_X86_64_DTPOFF64/R_X86_64_DTPOFF32 relocations.
    (clang emits R_X86_64_DTPOFF64 and gcc emits R_X86_64_DTPOFF32 for the code above for me)

    Currently, llvm-dwarfdump fails to compute this TLS relocation when dumping
    object and reports an
    error:
    failed to compute relocation: R_X86_64_DTPOFF64, Invalid data was encountered while parsing the file

    This relocation represents the offset in the TLS block and resolved by the linker,
    but this info is unavailable at the
    point when the object file is dumped by this tool.

    The patch adds the simple evaluation for such relocations to avoid emitting errors.
    Resulting behavior seems to be equal to GNU dwarfdump.

    Differential revision: https://reviews.llvm.org/D55762 (detail)
    by grimar
  387. [MIPS GlobalISel] ClampScalar G_AND G_OR and G_XOR

    Add narrowScalar for G_AND and G_XOR.
    Legalize G_AND G_OR and G_XOR for types other then s32
    with clampScalar on MIPS32.

    Differential Revision: https://reviews.llvm.org/D55362 (detail)
    by petar.avramovic
  388. [AArch64] - Return address signing dwarf support

    - Reapply changes intially introduced in r343089
    - The archtecture info is no longer loaded whenever a DWARFContext is created
    - The runtimes libraries (santiziers) make use of the dwarf context classes but
      do not intialise the target info
    - The architecture of the object can be obtained without loading the target info
    - Adding a method to the dwarf context to get this information and multiplex the
      string printing later on

    Differential Revision: https://reviews.llvm.org/D55774 (detail)
    by lukecheeseman
  389. [X86][AVX] Add 256/512-bit vector funnel shift tests

    Extra coverage for D55747 (detail)
    by rksimon
  390. [X86][SSE] Add 128-bit vector funnel shift tests

    Extra coverage for D55747 (detail)
    by rksimon
  391. [IPO][AVR] Create new Functions in the default address space specified in the data layout

    This modifies the IPO pass so that it respects any explicit function
    address space specified in the data layout.

    In targets with nonzero program address spaces, all functions should, by
    default, be placed into the default program address space.

    This is required for Harvard architectures like AVR. Without this, the
    functions will be marked as residing in data space, and thus not be
    callable.

    This has no effect to any in-tree official backends, as none use an
    explicit program address space in their data layouts.

    Patch by Tim Neumann. (detail)
    by dylanmckay
  392. AMDGPU: Legalize/regbankselect frame_index (detail)
    by arsenm
  393. AMDGPU: Legalize/regbankselect fma (detail)
    by arsenm
  394. [TargetLowering] Fallback from SimplifyDemandedVectorElts to SimplifyDemandedBits

    For opcodes not covered by SimplifyDemandedVectorElts, SimplifyDemandedBits might be able to help now that it supports demanded elts as well. (detail)
    by rksimon
  395. SROA: preserve alignment tags on loads and stores.

    When splitting up an alloca's uses we were dropping any explicit
    alignment tags, which means they default to the ABI-required default
    alignment and this can cause miscompiles if the real value was smaller.

    Also refactor the TBAA metadata into a parent class since it's shared by
    both children anyway. (detail)
    by Tim Northover
  396. GlobalISel: Improve crash on invalid mapping

    If NumBreakDowns is 0, BreakDown is null.
    This trades a null dereference with an assert somewhere
    else. (detail)
    by arsenm
  397. AMDGPU/GlobalISel: Legalize/regbankselect fneg/fabs/fsub (detail)
    by arsenm
  398. [X86][SSE] Move VSRAI sign extend in reg fold into SimplifyDemandedBits

    (VSRAI (VSHLI X, C1), C1) --> X iff NumSignBits(X) > C1

    This works better as part of SimplifyDemandedBits than part of the general combine. (detail)
    by rksimon
  399. [X86][SSE] Replace (VSRLI (VSRAI X, Y), 31) -> (VSRLI X, 31) fold.

    This fold was incredibly specific - replace with a SimplifyDemandedBits fold to remove a VSRAI if only the original sign bit is demanded (its guaranteed to stay the same).

    Test change is merely a rescheduling. (detail)
    by rksimon
  400. Introduce control flow speculation tracking pass for AArch64

    The pass implements tracking of control flow miss-speculation into a "taint"
    register. That taint register can then be used to mask off registers with
    sensitive data when executing under miss-speculation, a.k.a. "transient
    execution".
    This pass is aimed at mitigating against SpectreV1-style vulnarabilities.

    At the moment, it implements the tracking of miss-speculation of control
    flow into a taint register, but doesn't implement a mechanism yet to then
    use that taint register to mask off vulnerable data in registers (something
    for a follow-on improvement). Possible strategies to mask out vulnerable
    data that can be implemented on top of this are:
    - speculative load hardening to automatically mask of data loaded
      in registers.
    - using intrinsics to mask of data in registers as indicated by the
      programmer (see https://lwn.net/Articles/759423/).

    For AArch64, the following implementation choices are made.
    Some of these are different than the implementation choices made in
    the similar pass implemented in X86SpeculativeLoadHardening.cpp, as
    the instruction set characteristics result in different trade-offs.
    - The speculation hardening is done after register allocation. With a
      relative abundance of registers, one register is reserved (X16) to be
      the taint register. X16 is expected to not clash with other register
      reservation mechanisms with very high probability because:
      . The AArch64 ABI doesn't guarantee X16 to be retained across any call.
      . The only way to request X16 to be used as a programmer is through
        inline assembly. In the rare case a function explicitly demands to
        use X16/W16, this pass falls back to hardening against speculation
        by inserting a DSB SYS/ISB barrier pair which will prevent control
        flow speculation.
    - It is easy to insert mask operations at this late stage as we have
      mask operations available that don't set flags.
    - The taint variable contains all-ones when no miss-speculation is detected,
      and contains all-zeros when miss-speculation is detected. Therefore, when
      masking, an AND instruction (which only changes the register to be masked,
      no other side effects) can easily be inserted anywhere that's needed.
    - The tracking of miss-speculation is done by using a data-flow conditional
      select instruction (CSEL) to evaluate the flags that were also used to
      make conditional branch direction decisions. Speculation of the CSEL
      instruction can be limited with a CSDB instruction - so the combination of
      CSEL + a later CSDB gives the guarantee that the flags as used in the CSEL
      aren't speculated. When conditional branch direction gets miss-speculated,
      the semantics of the inserted CSEL instruction is such that the taint
      register will contain all zero bits.
      One key requirement for this to work is that the conditional branch is
      followed by an execution of the CSEL instruction, where the CSEL
      instruction needs to use the same flags status as the conditional branch.
      This means that the conditional branches must not be implemented as one
      of the AArch64 conditional branches that do not use the flags as input
      (CB(N)Z and TB(N)Z). This is implemented by ensuring in the instruction
      selectors to not produce these instructions when speculation hardening
      is enabled. This pass will assert if it does encounter such an instruction.
    - On function call boundaries, the miss-speculation state is transferred from
      the taint register X16 to be encoded in the SP register as value 0.

    Future extensions/improvements could be:
    - Implement this functionality using full speculation barriers, akin to the
      x86-slh-lfence option. This may be more useful for the intrinsics-based
      approach than for the SLH approach to masking.
      Note that this pass already inserts the full speculation barriers if the
      function for some niche reason makes use of X16/W16.
    - no indirect branch misprediction gets protected/instrumented; but this
      could be done for some indirect branches, such as switch jump tables.

    Differential Revision: https://reviews.llvm.org/D54896 (detail)
    by kbeyls
  401. Portable Python script across Python version

    In Python2, division between integer yields an integer, while it yields a float in Python3.
    Use a combination of from __future__ import division and // operator to get a portable behavior.

    Differential Revision: https://reviews.llvm.org/D55204 (detail)
    by serge_sans_paille
  402. Portable Python script across Python version

    Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.

    Differential Revision: https://reviews.llvm.org/D55213 (detail)
    by serge_sans_paille
  403. [unittests] Remove superfluous semicolon, fixing warnings with GCC. NFC. (detail)
    by mstorsjo
  404. [Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled

    For targets where SEH exceptions are used by default (on MinGW,
    only x86_64 so far), -munwind-tables are added automatically. If
    -fseh-exeptions is enabled on a target where SEH exeptions are
    availble but not enabled by default yet (aarch64), we need to
    pass -munwind-tables if -fseh-exceptions was specified.

    Differential Revision: https://reviews.llvm.org/D55749 (detail)
    by mstorsjo
  405. [AArch64] [MinGW] Allow enabling SEH exceptions

    The default still is dwarf, but SEH exceptions can now be enabled
    optionally for the MinGW target.

    Differential Revision: https://reviews.llvm.org/D55748 (detail)
    by mstorsjo
  406. [X86] Add test cases to show isel failing to match BMI blsmsk/blsi/blsr when the flag result is used.

    A similar things happen to TBM instructions which we already have tests for. (detail)
    by ctopper
  407. Portable Python script across Python version

    ConfigParser module has been renamed as configparser in Python3

    Differential Revision: https://reviews.llvm.org/D55200 (detail)
    by serge_sans_paille
  408. Portable Python script across Python version

    Replace `xrange(...)` by either `range(...)` or `list(range(...))` depending on the context.

    Differential Revision: https://reviews.llvm.org/D55193 (detail)
    by serge_sans_paille
  409. Portable Python script across Python version

    dict no longer have the `has_key` method in Python3. Instead, one can
    use the `in` keyword which already works in Python2. (detail)
    by serge_sans_paille
  410. [PowerPC][NFC]Update vabsd cases with vselect test cases

    Power9 VABSDU* instructions can be exploited for some special vselect sequences.
    Check in the orignal test case here, later the exploitation patch will update this
    and reviewers can check the differences easily. (detail)
    by jedilyn
  411. [PowerPC] Exploit power9 new instruction setb

    Check the expected pattens feeding to SELECT_CC like:
       (select_cc lhs, rhs,  1, (sext (setcc [lr]hs, [lr]hs, cc2)), cc1)
       (select_cc lhs, rhs, -1, (zext (setcc [lr]hs, [lr]hs, cc2)), cc1)
       (select_cc lhs, rhs,  0, (select_cc [lr]hs, [lr]hs,  1, -1, cc2), seteq)
       (select_cc lhs, rhs,  0, (select_cc [lr]hs, [lr]hs, -1,  1, cc2), seteq)
    Further transform the sequence to comparison + setb if hits.

    Differential Revision: https://reviews.llvm.org/D53275 (detail)
    by jedilyn
  412. [ExprConstant] Handle compound assignment when LHS has integral type and RHS has floating point type

    Fixes PR39858

    Differential Revision: https://reviews.llvm.org/D55413 (detail)
    by cpplearner
  413. [NFC] Add new test to cover the lhs scheduling issue for P9. (detail)
    by qshanz
  414. Automatic variable initialization

    Summary:
    Add an option to initialize automatic variables with either a pattern or with
    zeroes. The default is still that automatic variables are uninitialized. Also
    add attributes to request uninitialized on a per-variable basis, mainly to disable
    initialization of large stack arrays when deemed too expensive.

    This isn't meant to change the semantics of C and C++. Rather, it's meant to be
    a last-resort when programmers inadvertently have some undefined behavior in
    their code. This patch aims to make undefined behavior hurt less, which
    security-minded people will be very happy about. Notably, this means that
    there's no inadvertent information leak when:

      - The compiler re-uses stack slots, and a value is used uninitialized.
      - The compiler re-uses a register, and a value is used uninitialized.
      - Stack structs / arrays / unions with padding are copied.

    This patch only addresses stack and register information leaks. There's many
    more infoleaks that we could address, and much more undefined behavior that
    could be tamed. Let's keep this patch focused, and I'm happy to address related
    issues elsewhere.

    To keep the patch simple, only some `undef` is removed for now, see
    `replaceUndef`. The padding-related infoleaks are therefore not all gone yet.
    This will be addressed in a follow-up, mainly because addressing padding-related
    leaks should be a stand-alone option which is implied by variable
    initialization.

    There are three options when it comes to automatic variable initialization:

      0. Uninitialized

        This is C and C++'s default. It's not changing. Depending on code
        generation, a programmer who runs into undefined behavior by using an
        uninialized automatic variable may observe any previous value (including
        program secrets), or any value which the compiler saw fit to materialize on
        the stack or in a register (this could be to synthesize an immediate, to
        refer to code or data locations, to generate cookies, etc).

      1. Pattern initialization

        This is the recommended initialization approach. Pattern initialization's
        goal is to initialize automatic variables with values which will likely
        transform logic bugs into crashes down the line, are easily recognizable in
        a crash dump, without being values which programmers can rely on for useful
        program semantics. At the same time, pattern initialization tries to
        generate code which will optimize well. You'll find the following details in
        `patternFor`:

        - Integers are initialized with repeated 0xAA bytes (infinite scream).
        - Vectors of integers are also initialized with infinite scream.
        - Pointers are initialized with infinite scream on 64-bit platforms because
          it's an unmappable pointer value on architectures I'm aware of. Pointers
          are initialize to 0x000000AA (small scream) on 32-bit platforms because
          32-bit platforms don't consistently offer unmappable pages. When they do
          it's usually the zero page. As people try this out, I expect that we'll
          want to allow different platforms to customize this, let's do so later.
        - Vectors of pointers are initialized the same way pointers are.
        - Floating point values and vectors are initialized with a negative quiet
          NaN with repeated 0xFF payload (e.g. 0xffffffff and 0xffffffffffffffff).
          NaNs are nice (here, anways) because they propagate on arithmetic, making
          it more likely that entire computations become NaN when a single
          uninitialized value sneaks in.
        - Arrays are initialized to their homogeneous elements' initialization
          value, repeated. Stack-based Variable-Length Arrays (VLAs) are
          runtime-initialized to the allocated size (no effort is made for negative
          size, but zero-sized VLAs are untouched even if technically undefined).
        - Structs are initialized to their heterogeneous element's initialization
          values. Zero-size structs are initialized as 0xAA since they're allocated
          a single byte.
        - Unions are initialized using the initialization for the largest member of
          the union.

        Expect the values used for pattern initialization to change over time, as we
        refine heuristics (both for performance and security). The goal is truly to
        avoid injecting semantics into undefined behavior, and we should be
        comfortable changing these values when there's a worthwhile point in doing
        so.

        Why so much infinite scream? Repeated byte patterns tend to be easy to
        synthesize on most architectures, and otherwise memset is usually very
        efficient. For values which aren't entirely repeated byte patterns, LLVM
        will often generate code which does memset + a few stores.

      2. Zero initialization

        Zero initialize all values. This has the unfortunate side-effect of
        providing semantics to otherwise undefined behavior, programs therefore
        might start to rely on this behavior, and that's sad. However, some
        programmers believe that pattern initialization is too expensive for them,
        and data might show that they're right. The only way to make these
        programmers wrong is to offer zero-initialization as an option, figure out
        where they are right, and optimize the compiler into submission. Until the
        compiler provides acceptable performance for all security-minded code, zero
        initialization is a useful (if blunt) tool.

    I've been asked for a fourth initialization option: user-provided byte value.
    This might be useful, and can easily be added later.

    Why is an out-of band initialization mecanism desired? We could instead use
    -Wuninitialized! Indeed we could, but then we're forcing the programmer to
    provide semantics for something which doesn't actually have any (it's
    uninitialized!). It's then unclear whether `int derp = 0;` lends meaning to `0`,
    or whether it's just there to shut that warning up. It's also way easier to use
    a compiler flag than it is to manually and intelligently initialize all values
    in a program.

    Why not just rely on static analysis? Because it cannot reason about all dynamic
    code paths effectively, and it has false positives. It's a great tool, could get
    even better, but it's simply incapable of catching all uses of uninitialized
    values.

    Why not just rely on memory sanitizer? Because it's not universally available,
    has a 3x performance cost, and shouldn't be deployed in production. Again, it's
    a great tool, it'll find the dynamic uses of uninitialized variables that your
    test coverage hits, but it won't find the ones that you encounter in production.

    What's the performance like? Not too bad! Previous publications [0] have cited
    2.7 to 4.5% averages. We've commmitted a few patches over the last few months to
    address specific regressions, both in code size and performance. In all cases,
    the optimizations are generally useful, but variable initialization benefits
    from them a lot more than regular code does. We've got a handful of other
    optimizations in mind, but the code is in good enough shape and has found enough
    latent issues that it's a good time to get the change reviewed, checked in, and
    have others kick the tires. We'll continue reducing overheads as we try this out
    on diverse codebases.

    Is it a good idea? Security-minded folks think so, and apparently so does the
    Microsoft Visual Studio team [1] who say "Between 2017 and mid 2018, this
    feature would have killed 49 MSRC cases that involved uninitialized struct data
    leaking across a trust boundary. It would have also mitigated a number of bugs
    involving uninitialized struct data being used directly.". They seem to use pure
    zero initialization, and claim to have taken the overheads down to within noise.
    Don't just trust Microsoft though, here's another relevant person asking for
    this [2]. It's been proposed for GCC [3] and LLVM [4] before.

    What are the caveats? A few!

      - Variables declared in unreachable code, and used later, aren't initialized.
        This goto, Duff's device, other objectionable uses of switch. This should
        instead be a hard-error in any serious codebase.
      - Volatile stack variables are still weird. That's pre-existing, it's really
        the language's fault and this patch keeps it weird. We should deprecate
        volatile [5].
      - As noted above, padding isn't fully handled yet.

    I don't think these caveats make the patch untenable because they can be
    addressed separately.

    Should this be on by default? Maybe, in some circumstances. It's a conversation
    we can have when we've tried it out sufficiently, and we're confident that we've
    eliminated enough of the overheads that most codebases would want to opt-in.
    Let's keep our precious undefined behavior until that point in time.

    How do I use it:

      1. On the command-line:

        -ftrivial-auto-var-init=uninitialized (the default)
        -ftrivial-auto-var-init=pattern
        -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang

      2. Using an attribute:

        int dont_initialize_me __attribute((uninitialized));

      [0]: https://users.elis.ugent.be/~jsartor/researchDocs/OOPSLA2011Zero-submit.pdf
      [1]: https://twitter.com/JosephBialek/status/1062774315098112001
      [2]: https://outflux.net/slides/2018/lss/danger.pdf
      [3]: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg00615.html
      [4]: https://github.com/AndroidHardeningArchive/platform_external_clang/commit/776a0955ef6686d23a82d2e6a3cbd4a6a882c31c
      [5]: http://wg21.link/p1152

    I've also posted an RFC to cfe-dev: http://lists.llvm.org/pipermail/cfe-dev/2018-November/060172.html

    <rdar://problem/39131435>

    Reviewers: pcc, kcc, rsmith

    Subscribers: JDevlieghere, jkorous, dexonsmith, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54604 (detail)
    by jfb
  415. [X86] Add test case for PR40060. NFC (detail)
    by ctopper
  416. [X86] Const correct some helper functions X86InstrInfo.cpp. NFC (detail)
    by ctopper
  417. [NFC] fix test case issue that with wrong label check. (detail)
    by qshanz
  418. [CaptureTracking] Pass MaxUsesToExplore from wrappers to the actual implementation
       
    This is a follow up for rL347910. In the original patch I somehow forgot to pass
    the limit from wrappers to the function which actually does the job. (detail)
    by apilipenko
  419. [PowerPC] Improve vec_abs on P9

    Improve the current vec_abs support on P9, generate ISD::ABS node for vector types,
    combine ABS node to VABSD node for some special cases to make use of P9 VABSD* insns,
    do custom lowering to vsub(vneg later)+vmax if it has no combination opportunity.

    Differential Revision: https://reviews.llvm.org/D54783 (detail)
    by jedilyn
  420. [Support] Fix GNU/kFreeBSD build

    Patch by James Clarke.

    Differential Revision: https://reviews.llvm.org/D55296 (detail)
    by efriedma
  421. [codeview] Update comment on aligning symbol records (detail)
    by rnk
  422. [FileCheck] Try to fix test on windows due to r349418 (detail)
    by jdenny
  423. [codeview] Align symbol records to save 441MB during linking clang.pdb

    In PDBs, symbol records must be aligned to four bytes. However, in the
    object file, symbol records may not be aligned. MSVC does not pad out
    symbol records to make sure they are aligned. That means the linker has
    to do extra work to insert the padding. Currently, LLD calculates the
    required space with alignment, and copies each record one at a time
    while padding them out to the correct size. It has a fast path that
    avoids this copy when the records are already aligned.

    This change fixes a bug in that codepath so that the copy is actually
    saved, and tweaks LLVM's symbol record emission to align symbol records.
    Here's how things compare when doing a plain clang Release+PDB build:
    - objs are 0.65% bigger (negligible)
    - link is 3.3% faster (negligible)
    - saves allocating 441MB
    - new LLD high water mark is ~1.05GB (detail)
    by rnk
  424. Recommit r348806: DebugInfo: Use symbol difference for CU length to simplify assembly reading/editing

    Mucking about simplifying a test case ( https://reviews.llvm.org/D55261 ) I stumbled across something I've hit before - that LLVM's (GCC's does too, FWIW) assembly output includes a hardcode length for a DWARF unit in its header. Instead we could emit a label difference - making the assembly easier to read/edit (though potentially at a slight (I haven't tried to observe it) performance cost of delaying/sinking the length computation into the MC layer).

    Fix: Predicated all the changes (including creating the labels, even if they aren't used/needed) behind the NVPTX useSectionsAsReferences, avoiding emitting labels in NVPTX where ptxas can't parse them.

    Reviewers: JDevlieghere, probinson, ABataev

    Differential Revision: https://reviews.llvm.org/D55281 (detail)
    by dblaikie
  425. hwasan: Allow range of frame descriptors to be empty.

    As of r349413 it's now possible for a binary to contain an empty
    hwasan frame section. Handle that case simply by doing nothing.

    Differential Revision: https://reviews.llvm.org/D55796 (detail)
    by pcc
  426. [libcxx] Handle AppleClang 9 and 10 in XFAILs for aligned allocation tests

    I forgot that those don't behave like Clang trunk, again. (detail)
    by Louis Dionne
  427. [libcxx] Properly mark aligned allocation macro test as XFAIL on OS X

    This test was initially marked as XFAIL using `XFAIL: macosx10.YY`, and
    was then moved to `UNSUPPORTED: macosx10.YY`. The intent is to mark the
    test as XFAILing when a deployment target older than macosx10.14 is used,
    and the right way to do this is `XFAIL: availability=macosx10.YY`. (detail)
    by Louis Dionne
  428. [FileCheck] Annotate input dump (final tweaks)

    Apply final suggestions from probinson for this patch series plus a
    few more tweaks:

    * Improve various docs, for MatchType in particular.

    * Rename some members of MatchType.  The main problem was that the
      term "final match" became a misnomer when CHECK-COUNT-<N> was
      created.

    * Split InputStartLine, etc. declarations into multiple lines.

    Differential Revision: https://reviews.llvm.org/D55738

    Reviewed By: probinson (detail)
    by jdenny
  429. [FileCheck] Annotate input dump (7/7)

    This patch implements annotations for diagnostics reporting CHECK-NOT
    failed matches.  These diagnostics are enabled by -vv.  As for
    diagnostics reporting failed matches for other directives, these
    annotations mark the search ranges using `X~~`.  The difference here
    is that failed matches for CHECK-NOT are successes not errors, so they
    are green not red when colors are enabled.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the only match result for a pattern of type T from line L of
               the check file
      - T:L'N  labels the Nth match result for a pattern of type T from line L of
               the check file
      - ^~~    marks good match (reported if -v)
      - !~~    marks bad match, such as:
               - CHECK-NEXT on same line as previous match (error)
               - CHECK-NOT found (error)
               - CHECK-DAG overlapping match (discarded, reported if -vv)
      - X~~    marks search range when no match is found, such as:
               - CHECK-NEXT not found (error)
               - CHECK-NOT not found (success, reported if -vv)
               - CHECK-DAG not found after discarded matches (error)
      - ?      marks fuzzy match when no match is found
      - colors success, error, fuzzy match, discarded match, unmatched input

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -vv -dump-input=always check5 < input5 |& sed -n '/^<<<</,$p'
    <<<<<<
             1: abcdef
    check:1     ^~~
    not:2          X~~
             2: ghijkl
    not:2       ~~~
    check:3        ^~~
             3: mnopqr
    not:4       X~~~~~
             4: stuvwx
    not:4       ~~~~~~
             5:
    eof:4       ^
    >>>>>>

    $ cat check5
    CHECK: abc
    CHECK-NOT: foobar
    CHECK: jkl
    CHECK-NOT: foobar

    $ cat input5
    abcdef
    ghijkl
    mnopqr
    stuvwx
    ```

    Reviewed By: george.karpenkov, probinson

    Differential Revision: https://reviews.llvm.org/D53899 (detail)
    by jdenny
  430. [FileCheck] Annotate input dump (6/7)

    This patch implements input annotations for diagnostics reporting
    CHECK-DAG discarded matches.  These diagnostics are enabled by -vv.
    These annotations mark discarded match ranges using `!~~` because they
    are bad matches even though they are not errors.

    CHECK-DAG discarded matches create another case where there can be
    multiple match results for the same directive.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the only match result for a pattern of type T from line L of
               the check file
      - T:L'N  labels the Nth match result for a pattern of type T from line L of
               the check file
      - ^~~    marks good match (reported if -v)
      - !~~    marks bad match, such as:
               - CHECK-NEXT on same line as previous match (error)
               - CHECK-NOT found (error)
               - CHECK-DAG overlapping match (discarded, reported if -vv)
      - X~~    marks search range when no match is found, such as:
               - CHECK-NEXT not found (error)
               - CHECK-DAG not found after discarded matches (error)
      - ?      marks fuzzy match when no match is found
      - colors success, error, fuzzy match, discarded match, unmatched input

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -vv -dump-input=always check4 < input4 |& sed -n '/^<<<</,$p'
    <<<<<<
             1: abcdef
    dag:1       ^~~~
    dag:2'0       !~~~ discard: overlaps earlier match
             2: cdefgh
    dag:2'1     ^~~~
    check:3         X~ error: no match found
    >>>>>>

    $ cat check4
    CHECK-DAG: abcd
    CHECK-DAG: cdef
    CHECK: efgh

    $ cat input4
    abcdef
    cdefgh
    ```

    This shows that the line 3 CHECK fails to match even though its
    pattern appears in the input because its search range starts after the
    line 2 CHECK-DAG's match range.  The trouble might be that the line 2
    CHECK-DAG's match range is later than expected because its first match
    range overlaps with the line 1 CHECK-DAG match range and thus is
    discarded.

    Because `!~~` for CHECK-DAG does not indicate an error, it is not
    colored red.  Instead, when colors are enabled, it is colored cyan,
    which suggests a match that went cold.

    Reviewed By: george.karpenkov, probinson

    Differential Revision: https://reviews.llvm.org/D53898 (detail)
    by jdenny
  431. [FileCheck] Annotate input dump (5/7)

    This patch implements input annotations for diagnostics enabled by -v,
    which report good matches for directives.  These annotations mark
    match ranges using `^~~`.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the only match result for a pattern of type T from line L of
               the check file
      - T:L'N  labels the Nth match result for a pattern of type T from line L of
               the check file
      - ^~~    marks good match (reported if -v)
      - !~~    marks bad match, such as:
               - CHECK-NEXT on same line as previous match (error)
               - CHECK-NOT found (error)
      - X~~    marks search range when no match is found, such as:
               - CHECK-NEXT not found (error)
      - ?      marks fuzzy match when no match is found
      - colors success, error, fuzzy match, unmatched input

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
    <<<<<<
             1: abc foobar def
    check:1     ^~~
    not:2           !~~~~~     error: no match expected
    check:3                ^~~
    >>>>>>

    $ cat check3
    CHECK:     abc
    CHECK-NOT: foobar
    CHECK:     def

    $ cat input3
    abc foobar def
    ```

    -vv enables these annotations for FileCheck's implicit EOF patterns as
    well.  For an example where EOF patterns become relevant, see patch 7
    in this series.

    If colors are enabled, `^~~` is green to suggest success.

    -v plus color enables highlighting of input text that has no final
    match for any expected pattern.  The highlight uses a cyan background
    to suggest a cold section.  This highlighting can make it easier to
    spot text that was intended to be matched but that failed to be
    matched in a long series of good matches.

    CHECK-COUNT-<num> good matches are another case where there can be
    multiple match results for the same directive.

    Reviewed By: george.karpenkov, probinson

    Differential Revision: https://reviews.llvm.org/D53897 (detail)
    by jdenny
  432. [FileCheck] Annotate input dump (4/7)

    This patch implements input annotations for diagnostics that report
    unexpected matches for CHECK-NOT.  Like wrong-line matches for
    CHECK-NEXT, CHECK-SAME, and CHECK-EMPTY, these annotations mark match
    ranges using red `!~~` to indicate bad matches that are errors.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the only match result for a pattern of type T from line L of
               the check file
      - T:L'N  labels the Nth match result for a pattern of type T from line L of
               the check file
      - !~~    marks bad match, such as:
               - CHECK-NEXT on same line as previous match (error)
               - CHECK-NOT found (error)
      - X~~    marks search range when no match is found, such as:
               - CHECK-NEXT not found (error)
      - ?      marks fuzzy match when no match is found
      - colors error, fuzzy match

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
    <<<<<<
           1: abc foobar def
    not:2         !~~~~~     error: no match expected
    >>>>>>

    $ cat check3
    CHECK:     abc
    CHECK-NOT: foobar
    CHECK:     def

    $ cat input3
    abc foobar def
    ```

    Reviewed By: george.karpenkov, probinson

    Differential Revision: https://reviews.llvm.org/D53896 (detail)
    by jdenny
  433. [FileCheck] Annotate input dump (3/7)

    This patch implements input annotations for diagnostics that report
    wrong-line matches for the directives CHECK-NEXT, CHECK-SAME, and
    CHECK-EMPTY.  Instead of the usual `^~~`, which is used by later
    patches for good matches, these annotations use `!~~` to mark the bad
    match ranges so that this category of errors is visually distinct.
    Because such matches are errors, these annotates are red when colors
    are enabled.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the only match result for a pattern of type T from line L of
               the check file
      - T:L'N  labels the Nth match result for a pattern of type T from line L of
               the check file
      - !~~    marks bad match, such as:
               - CHECK-NEXT on same line as previous match (error)
      - X~~    marks search range when no match is found, such as:
               - CHECK-NEXT not found (error)
      - ?      marks fuzzy match when no match is found
      - colors error, fuzzy match

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -v -dump-input=always check2 < input2 |& sed -n '/^<<<</,$p'
    <<<<<<
            1: foo bar
    next:2         !~~ error: match on wrong line
    >>>>>>

    $ cat check2
    CHECK: foo
    CHECK-NEXT: bar

    $ cat input2
    foo bar
    ```

    Reviewed By: george.karpenkov, probinson

    Differential Revision: https://reviews.llvm.org/D53894 (detail)
    by jdenny
  434. [FileCheck] Annotate input dump (2/7)

    This patch implements input annotations for diagnostics that suggest
    fuzzy matches for directives for which no matches were found.  Instead
    of using the usual `^~~`, which is used by later patches for good
    matches, these annotations use `?` so that fuzzy matches are visually
    distinct.  No tildes are included as these diagnostics (independently
    of this patch) currently identify only the start of the match.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the only match result for a pattern of type T from line L of
               the check file
      - T:L'N  labels the Nth match result for a pattern of type T from line L of
               the check file
      - X~~    marks search range when no match is found
      - ?      marks fuzzy match when no match is found
      - colors error, fuzzy match

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -v -dump-input=always check1 < input1 |& sed -n '/^<<<</,$p'
    <<<<<<
              1: ; abc def
              2: ; ghI jkl
    next:3'0     X~~~~~~~~ error: no match found
    next:3'1       ?       possible intended match
    >>>>>>

    $ cat check1
    CHECK: abc
    CHECK-SAME: def
    CHECK-NEXT: ghi
    CHECK-SAME: jkl

    $ cat input1
    ; abc def
    ; ghI jkl
    ```

    This patch introduces the concept of multiple "match results" per
    directive.  In the above example, the first match result for the
    CHECK-NEXT directive is the failed match, for which the annotation
    shows the search range.  The second match result is the fuzzy match.
    Later patches will introduce other cases of multiple match results per
    directive.

    When colors are enabled, `?` is colored magenta.  That is, it doesn't
    indicate the actual error, which a red `X~~` marker indicates, but its
    color suggests it's closely related.

    Reviewed By: george.karpenkov, probinson

    Differential Revision: https://reviews.llvm.org/D53893 (detail)
    by jdenny
  435. [FileCheck] Annotate input dump (1/7)

    Extend FileCheck to dump its input annotated with FileCheck's
    diagnostics: errors, good matches if -v, and additional information if
    -vv.  The goal is to make it easier to visualize FileCheck's matching
    behavior when debugging.

    Each patch in this series implements input annotations for a
    particular category of FileCheck diagnostics.  While the first few
    patches alone are somewhat useful, the annotations become much more
    useful as later patches implement annotations for -v and -vv
    diagnostics, which show the matching behavior leading up to the error.

    This first patch implements boilerplate plus input annotations for
    error diagnostics reporting that no matches were found for a
    directive.  These annotations mark the search ranges of the failed
    directives.  Instead of using the usual `^~~`, which is used by later
    patches for good matches, these annotations use `X~~` so that this
    category of errors is visually distinct.

    For example:

    ```
    $ FileCheck -dump-input=help
    The following description was requested by -dump-input=help to
    explain the input annotations printed by -dump-input=always and
    -dump-input=fail:

      - L:     labels line number L of the input file
      - T:L    labels the match result for a pattern of type T from line L of
               the check file
      - X~~    marks search range when no match is found
      - colors error

    If you are not seeing color above or in input dumps, try: -color

    $ FileCheck -v -dump-input=always check1 < input1 |& sed -n '/^Input file/,$p'
    Input file: <stdin>
    Check file: check1

    -dump-input=help describes the format of the following dump.

    Full input was:
    <<<<<<
            1: ; abc def
            2: ; ghI jkl
    next:3     X~~~~~~~~ error: no match found
    >>>>>>

    $ cat check1
    CHECK: abc
    CHECK-SAME: def
    CHECK-NEXT: ghi
    CHECK-SAME: jkl

    $ cat input1
    ; abc def
    ; ghI jkl
    ```

    Some additional details related to the boilerplate:

    * Enabling: The annotated input dump is enabled by `-dump-input`,
      which can also be set via the `FILECHECK_OPTS` environment variable.
      Accepted values are `help`, `always`, `fail`, or `never`.  As shown
      above, `help` describes the format of the dump.  `always` is helpful
      when you want to investigate a successful FileCheck run, perhaps for
      an unexpected pass. `-dump-input-on-failure` and
      `FILECHECK_DUMP_INPUT_ON_FAILURE` remain as a deprecated alias for
      `-dump-input=fail`.

    * Diagnostics: The usual diagnostics are not suppressed in this mode
      and are printed first.  For brevity in the example above, I've
      omitted them using a sed command.  Sometimes they're perfectly
      sufficient, and then they make debugging quicker than if you were
      forced to hunt through a dump of long input looking for the error.
      If you think they'll get in the way sometimes, keep in mind that
      it's pretty easy to grep for the start of the input dump, which is
      `<<<`.

    * Colored Annotations: The annotated input is colored if colors are
      enabled (enabling colors can be forced using -color).  For example,
      errors are red.  However, as in the above example, colors are not
      vital to reading the annotations.

    I don't know how to test color in the output, so any hints here would
    be appreciated.

    Reviewed By: george.karpenkov, zturner, probinson

    Differential Revision: https://reviews.llvm.org/D52999 (detail)
    by jdenny
  436. [X86] Add baseline tests for D55780

    This adds tests for (add (umax X, C), -C) as part of fixing PR40053 (detail)
    by ctopper
  437. Fix ms-layout_version declspec test and add missing new test

    Now that MSVC compatibility versions are stored as a four digit number
    (1912) instead of a two digit number (19), we need to adjust how we
    handle this attribute.

    Also add a new test that was intended to be part of r349414. (detail)
    by rnk
  438. Update Microsoft name mangling scheme for exception specifiers in the type system

    Summary:
    The msvc exception specifier for noexcept function types has changed
    from the prior default of "Z" to "_E" if the function cannot throw when
    compiling with /std:C++17.

    Patch by Zachary Henkel!

    Reviewers: zturner, rnk

    Reviewed By: rnk

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55685 (detail)
    by rnk
  439. hwasan: Move ctor into a comdat.

    Differential Revision: https://reviews.llvm.org/D55733 (detail)
    by pcc
  440. [VFS] Add isLocal to ProxyFileSystem and add unit tests.

    Differential Revision: https://reviews.llvm.org/D55789 (detail)
    by mspencer
  441. [libcxx][NFC] Properly indent nested #ifdefs and #defines

    I just realized I had always been reading this wrong because of the lack
    of indentation, so I'm re-indenting this properly. (detail)
    by Louis Dionne
  442. [X86][SSE] Improve immediate vector shift known bits handling.

    Convert VSRAI to VSRLI is the sign bit is known zero and improve KnownBits output for all shift instruction.

    Fixes the poor codegen comments in D55768. (detail)
    by rksimon
  443. [WebAssembly] Fix assembler parsing of br_table.

    Summary:
    We use `variable_ops` in the tablegen defs to denote the list of
    branch targets in `br_table`, but unlike other uses of `variable_ops`
    (e.g. call) the these branch targets need to actually be encoded in the
    instruction. The existing tables for `variable_ops` cause not operands
    to be accepted by the assembly matcher.

    Following the example of ARM:
    https://github.com/llvm-mirror/llvm/blob/2cc0a7da876c1d8c32775b0119e1e15aaa759b9e/lib/Target/ARM/ARMInstrInfo.td#L550-L555
    we introduce a new operand type to capture this list, and we use the
    same {} syntax as ARM as well to differentiate them from regular
    integer operands.

    Also removed definition and use of TSFlags in tablegen defs, since
    `br_table` now has a non-variable_ops immediate operand, so the
    previous logic of only the variable_ops arguments being labels didn't
    make sense anymore.

    Reviewers: dschuff, aheejin, sunfish

    Subscribers: javed.absar, sbc100, jgravelle-google, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55401 (detail)
    by aardappel
  444. [X86] Add T1MSKC and TZMSK to isDefConvertible used by optimizeCompareInstr.

    These seem to have been missed when the other TBM instructions were added. (detail)
    by ctopper
  445. [codeview] Flush labels before S_DEFRANGE* fragments

    This was a pre-existing bug that could be triggered with assembly like
    this:
      .p2align 2
      .LtmpN:
      .cv_def_range "..."

    I noticed this when attempting to change clang to emit aligned symbol
    records. (detail)
    by rnk
  446. Don't trigger sanitizer initialization from `sysctlbyname`  and `sysctl` interceptor.

    Summary:
    This fixes the `ThreadSanitizer-x86_64-iossim` testsuite which broke
    when r348770 (https://reviews.llvm.org/D55473) landed.

    The root cause of the problem is that early-on during the iOS simulator
    init process a call to `sysctlbyname` is issued. If the TSan initializer
    is triggered at this point it will eventually trigger a call to
    `__cxa_at_exit(...)`. This call then aborts because the library
    implementing this function is not yet had its initialization function
    called.

    rdar://problem/46696934

    Reviewers: kubamracek, george.karpenkov, devnexen, vitalybuka, krytarowski

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55711 (detail)
    by delcypher
  447. [X86][SSE] Split SimplifyDemandedBitsForTargetNode X86ISD::VSRLI/VSRAI handling.

    First step towards adding more capable combines to fix comments in D55768. (detail)
    by rksimon
  448. [AggressiveInstCombine] convert rotate with guard branch into funnel shift (PR34924)

    Now, that we have funnel shift intrinsics, it should be safe to convert this form of rotate to it.
    In the worst case (a target that doesn't have rotate instructions), we will expand this into a
    branch-less sequence of ALU ops (neg/and/and/lshr/shl/or) in the backend, so it's still very
    likely to be a perf improvement over the original code.

    The motivating source code pattern for this is shown in:
    https://bugs.llvm.org/show_bug.cgi?id=34924

    Background:
    I looked at several different options before deciding where to try this - instcombine, simplifycfg,
    CGP - because it doesn't fit cleanly anywhere AFAIK.

    The backend (CGP, SDAG, GlobalIsel?) is too late for what we're trying to accomplish. We want to
    have the IR converted before we reach things like vectorization because the reduced code can make a
    loop much simpler to transform.

    Technically, this could be included in instcombine, but it's a large pattern match that includes
    control-flow, so it just felt wrong to stuff into there (although I have a draft of that patch).
    Similarly, this could be part of simplifycfg, but all of this pattern matching is a stretch.

    So we're left with our relatively new dumping ground for homeless transforms: aggressive-instcombine.
    This only runs at -O3, but that seems like a reasonable limitation given that source code has many
    options to avoid this pattern (including the recently added clang intrinsics for rotates).

    I'm including a PhaseOrdering test because we require the teamwork of 3 passes (aggressive-instcombine,
    instcombine, simplifycfg) to get this into the minimal IR form that we want. That test shows a bug
    with the new pass manager that's independent of this change (but it will be masked if we canonicalize
    harder to funnel shift intrinsics in instcombine).

    Differential Revision: https://reviews.llvm.org/D55604 (detail)
    by spatel
  449. DebugInfo: Update gold plugin tests due to CU attribute reordering in r349207 (detail)
    by dblaikie
  450. [analyzer] MoveChecker: Squash the bit field because it causes a GCC warning.

    The warning seems spurious (GCC bug 51242), but the bit field is
    simply not worth the hassle.

    rdar://problem/41349073 (detail)
    by dergachev
  451. Make test/Driver/darwin-sdk-version.c pass on hosts < macOS10.14

    The test test/Driver/darwin-sdk-version.c from r349380 checks if the macOS
    deployment target can be correctly inferred from the SDK version. When the
    SDK version is > host version, the driver will pick the host version, so
    the old test failed on macOS < 10.14. This commit makes this test more
    resilient by using an older SDK version. (detail)
    by arphaman
  452. [Sanitizer] capsicum variadic api subset

    Reviewers: markj, vitalybuka

    Reviewed By: markj

    Differential Revision: https://reviews.llvm.org/D55714 (detail)
    by David CARLIER
  453. [SDAG] Clarify the origin of chain in REG_SEQUENCE in comment, NFC (detail)
    by kparzysz
  454. [SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode

    The assertion type is always supposed to be a scalar type. So if the result VT of the assertion is a vector, we need to get the scalar VT before we can compare them.

    Similarly for the assert above it.

    I don't have a test case because I don't know of any place we violate this today. A coworker found this while trying to use r347287 on the 6.0 branch without also having r336868 (detail)
    by ctopper
  455. [InstCombine] don't widen an arbitrary sequence of vector ops (PR40032)

    The problem is shown specifically for a case with vector multiply here:
    https://bugs.llvm.org/show_bug.cgi?id=40032
    ...and this might mask the original backend bug for ARM shown in:
    https://bugs.llvm.org/show_bug.cgi?id=39967

    As the test diffs here show, we were (and probably still aren't) doing
    these kinds of transforms in a principled way. We are producing more or
    equal wide instructions than we started with in some cases, so we still
    need to restrict/correct other transforms from overstepping.

    If there are perf regressions from this change, we can either carve out
    exceptions to the general IR rules, or improve the backend to do these
    transforms when we know the transform is profitable. That's probably
    similar to a change like D55448.

    Differential Revision: https://reviews.llvm.org/D55744 (detail)
    by spatel
  456. Fix build after r349380 (detail)
    by arphaman
  457. Fix FP comparisons when SSE isn't available (detail)
    by ericwf
  458. Convert (CMP (srl/shl X, C), 0) to (CMP (and X, C'), 0) when only the zero flag is used.

    This allows a TEST to be used and can be combined with any AND that may already exist as an input to the shift.

    This was already done in EmitTest, but was easily tricked by multiple uses because the setcc might be used by multiple instructions. Once the SETCC and users are legalized then we can look for the shift to be used by a single CMP, but the CMP itself can have multiple users.

    This appears to fix the case in PR39968. (detail)
    by ctopper
  459. [NFC] Test commit: tweak whitespace in comment (detail)
    by cpplearner
  460. [darwin][arm64] use the "cyclone" CPU for Darwin even when `-arch`
    is not specified

    The -target option allows the user to specify the build target using LLVM
    triple. The triple includes the arch, and so the -arch option is redundant.
    This should work just as well without the -arch. However, the driver has a bug
    in which it doesn't target the "Cyclone" CPU for darwin if -target is used
    without -arch. This commit fixes this issue.

    rdar://46743182

    Differential Revision: https://reviews.llvm.org/D55731 (detail)
    by arphaman
  461. [Driver] Don't override '-march' when using '-arch x86_64h'

    On Darwin, using '-arch x86_64h' would always override the option passed
    through '-march'.

    This patch allows users to use '-march' with x86_64h, while keeping the
    default to 'core-avx2'

    Differential Revision: https://reviews.llvm.org/D55775 (detail)
    by thegameg
  462. [darwin] parse the SDK settings from SDKSettings.json if it exists and
    pass in the -target-sdk-version to the compiler and backend

    This commit adds support for reading the SDKSettings.json file in the Darwin
    driver. This file is used by the driver to determine the SDK's version, and it
    uses that information to pass it down to the compiler using the new
    -target-sdk-version= option. This option is then used to set the appropriate
    SDK Version module metadata introduced in r349119.

    Note: I had to adjust the two ast tests as the SDKROOT environment variable
    on macOS caused SDK version to be picked up for the compilation of source file
    but not the AST.

    rdar://45774000

    Differential Revision: https://reviews.llvm.org/D55673 (detail)
    by arphaman
  463. [test] Add target_info for NetBSD, and XFAIL some of locale tests

    Add a target_info definition for NetBSD.  The definition is based
    on the one used by FreeBSD, with libcxxrt replaced by libc++abi,
    and using llvm-libunwind since we need to use its unwinder
    implementation to build anyway.

    Additionally, XFAIL the 30 tests that fail because of non-implemented
    locale features.  According to the manual, NetBSD implements only
    LC_CTYPE part of locale handling.  However, there is a locale database
    in the system and locale specifications are validated against it,
    so it makes sense to list the common locales as supported.

    If I'm counting correctly, this change enables additional 43 passing
    tests.

    Differential Revision: https://reviews.llvm.org/D55767 (detail)
    by mgorny
  464. [test] [re.traits] Remove asserts failing due to invalid UTF-8

    Remove the two test cases for \xDA and \xFA with UTF-8 locale, as both
    characters alone are invalid in UTF-8 (short sequences).  Upon removing
    them, the test passes on Linux again (and also on NetBSD, after adding
    appropriate locale configuration).

    Differential Revision: https://reviews.llvm.org/D55746 (detail)
    by mgorny
  465. NFC: remove unused variable

    D55768 removed its use. (detail)
    by jfb
  466. AsmParser: test .double NaN and .double inf

    Summary: It looks like this support was added to match GNU AS, but only tests
    .float and not .double. I asked RedHat folks to confirm that 0x7fffffffffffffff
    was indeed the right value for NaN.

    Same for infinity, but it only has positive / negative encodings.

    Reviewers: scanon, rjmccall

    Subscribers: jkorous, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55531 (detail)
    by jfb
  467. [AMDGPU][MC][DOC] A fix for build failure in r349370 (detail)
    by dpreobra
  468. [TargetLowering] Add DemandedElts mask to SimplifyDemandedBits (PR40000)

    This is an initial patch to add the necessary support for a DemandedElts argument to SimplifyDemandedBits, more closely matching computeKnownBits and to help improve vector codegen.

    I've added only a small amount of the changes necessary to get at least one test to update - a lot more can be done but I'd like to add these methodically with proper test coverage, at the same time the hope is to slowly move some/all of SimplifyDemandedVectorElts into SimplifyDemandedBits as well.

    Differential Revision: https://reviews.llvm.org/D55768 (detail)
    by rksimon
  469. Unbreak green dragon bots w/o __builtin_launder (detail)
    by ericwf
  470. [AMDGPU][MC][DOC] A fix for build failure in r349368 (detail)
    by dpreobra
  471. [InstSimplify] Simplify saturating add/sub + icmp

    If a saturating add/sub has one constant operand, then we can
    determine the possible range of outputs it can produce, and simplify
    an icmp comparison based on that.

    The implementation is based on a similar existing mechanism for
    simplifying binary operator + icmps.

    Differential Revision: https://reviews.llvm.org/D55735 (detail)
    by nikic
  472. [AMDGPU][MC][DOC] Updated AMD GPU assembler description

    Stage 2: added detailed description of operands

    See bug 36572: https://bugs.llvm.org/show_bug.cgi?id=36572 (detail)
    by dpreobra
  473. FastIsel: take care to update iterators when removing instructions.

    We keep a few iterators into the basic block we're selecting while
    performing FastISel. Usually this is fine, but occasionally code wants
    to remove already-emitted instructions. When this happens we have to be
    careful to update those iterators so they're not pointint at dangling
    memory. (detail)
    by Tim Northover
  474. Expect Clang diagnostics in std::launder test (detail)
    by ericwf
  475. Add missing include file. (detail)
    by zturner
  476. [CodeComplete] Fix test failure on different host and target configs

    This should fix PR40033. (detail)
    by ibiryukov
  477. [PDB] Add some helper functions for working with scopes. (detail)
    by zturner
  478. [MS Demangler] Add a helper function to print a Node as a string. (detail)
    by zturner
  479. [libcxx] Speeding up partition_point/lower_bound/upper_bound

    This is a re-application of r345525, which had been reverted by fear of
    a regression.

    Reviewed as https://reviews.llvm.org/D53994.
    Thanks to Denis Yaroshevskiy for the patch. (detail)
    by Louis Dionne
  480. Build ASTImporterTest.cpp with /bigobj on MSVC builds to keep llvm-clang-x86_64-expensive-checks-win buildbot happy (detail)
    by rksimon
  481. [MIPS GlobalISel] Remove switch statement (fix r349346 for MSVC)

    Temporarily remove switch statement without any case labels
    in function legalizeCustom in order to fix r349346 for MSVC. (detail)
    by petar.avramovic
  482. ARM: use acquire/release instruction variants when available.

    These features (fairly) recently got split out into their own feature, so we
    should make CodeGen use them when available. The main change here is that the
    check used to be based on the triple, but now it's based on CPU features. (detail)
    by Tim Northover
  483. [MCA] Add support for BeginGroup/EndGroup. (detail)
    by adibiagio
  484. Revert "DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)"

    This reverts commit r349333. It caused internal test to fail. I have
    sent more information to the author. (detail)
    by ioeric
  485. [MCA] Don't assume that createMCInstrAnalysis() always returns a valid pointer.

    Class InstrBuilder wrongly assumed that llvm targets were always able to return
    a non-null pointer when createMCInstrAnalysis() was called on them.
    This was causing crashes when simulating executions for targets that don't
    provide an MCInstrAnalysis object.
    This patch fixes the issue by making MCInstrAnalysis optional. (detail)
    by adibiagio
  486. [ASTImporter] Add importer specific lookup

    Summary:
    There are certain cases when normal C/C++ lookup (localUncachedLookup)
    does not find AST nodes. E.g.:

    Example 1:

      template <class T>
      struct X {
        friend void foo(); // this is never found in the DC of the TU.
      };

    Example 2:

      // The fwd decl to Foo is not found in the lookupPtr of the DC of the
      // translation unit decl.
      struct A { struct Foo *p; };

    In these cases we create a new node instead of returning with the old one.
    To fix it we create a new lookup table which holds every node and we are
    not interested in any C++ specific visibility considerations.
    Simply, we must know if there is an existing Decl in a given DC.

    Reviewers: a_sidorin, a.sidorin

    Subscribers: mgorny, rnkovacs, dkrupp, Szelethus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53708 (detail)
    by martong
  487. Regenerate test in prep for SimplifyDemandedBits improvements. (detail)
    by rksimon
  488. [ASTImporter] Fix redecl chain of classes and class templates

    Summary:
    The crux of the issue that is being fixed is that lookup could not find
    previous decls of a friend class. The solution involves making the
    friend declarations visible in their decl context (i.e. adding them to
    the lookup table).
    Also, we simplify `VisitRecordDecl` greatly.

    This fix involves two other repairs (without these the unittests fail):
    (1) We could not handle the addition of injected class types properly
    when a redecl chain was involved, now this is fixed.
    (2) DeclContext::removeDecl failed if the lookup table in Vector form
    did not contain the to be removed element. This caused troubles in
    ASTImporter::ImportDeclContext. This is also fixed.

    Reviewers: a_sidorin, balazske, a.sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53655 (detail)
    by martong
  489. [clangd] Change diskbackedstorage to be atomic

    Summary:
    There was a chance that multiple clangd instances could try to write
    same shard, in which case we would get a malformed file most likely. This patch
    changes the writing mechanism to first write to a temporary file and then rename
    it to fit real destination. Which is guaranteed to be atomic by POSIX.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55417 (detail)
    by kadircet
  490. [AggressiveInstCombine] add test for rotate insertion point; NFC

    As noted in D55604 - we need a test to make sure that the new intrinsic
    is inserted into a valid position. (detail)
    by spatel
  491. [MIPS GlobalISel] Lower G_UADDE and narrowScalar G_ADD

    Lower G_UADDE and legalize G_ADD using narrowScalar on MIPS32.

    Differential Revision: https://reviews.llvm.org/D54580 (detail)
    by petar.avramovic
  492. [clangd] Only reduce priority of a thread for indexing.

    Summary:
    We'll soon have tasks pending for reading shards from disk, we want
    them to have normal priority. Because:
    - They are not CPU intensive, mostly IO bound.
    - Give a good coverage for the project at startup, therefore it is worth
      spending some cycles.
    - We have only one task per whole CDB rather than one task per file.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55315 (detail)
    by kadircet
  493. Revert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some functions'

    Accidentally commited earlier with the same commit title, but really it
    should've been
    "Revert rC349283 '[analyzer][MallocChecker] Improve warning messages on double-delete errors'" (detail)
    by szelethus
  494. Fix "enumeral mismatch in conditional expression" gcc7 warning. NFCI. (detail)
    by rksimon
  495. Fix "enumeral mismatch in conditional expression" gcc7 warnings. NFCI. (detail)
    by rksimon
  496. Revert rCTE349288 'Fix a lit test failure after MallocChecker changes' (detail)
    by szelethus
  497. Revert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some functions' (detail)
    by szelethus
  498. [AArch64] Re-run load/store optimizer after aggressive tail duplication

    The Load/Store Optimizer runs before Machine Block Placement. At O3 the
    Tail Duplication Threshold is set to 4 instructions and this can create
    new opportunities for the Load/Store Optimizer. It seems worthwhile to
    run it once again. (detail)
    by alelab01
  499. Reverting bitfield size to attempt to fix a windows buildbot (detail)
    by szelethus
  500. [Docs] Expand -fstack-protector and -fstack-protector-all

    Improve the description of these command line options
    by providing specific heuristic information, as outlined
    for the ssp function attribute(s) in LLVM's documentation.

    Also rewords -fstack-protector-all for affinity.

    Differential Revision: https://reviews.llvm.org/D55428 (detail)
    by carwil
  501. DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

    GCC emitted these unconditionally on/before 4.4/March 2012
    Clang emitted these unconditionally on/before 3.5/March 2014

    This improves performance when parsing CUs (especially those using split
    DWARF) that contain no code ranges (such as the mini CUs that may be
    created by ThinLTO importing - though generally they should be/are
    avoided, especially for Split DWARF because it produces a lot of very
    small CUs, which don't scale well in a bunch of other ways too
    (including size)). (detail)
    by dblaikie
  502. [llvm-mca] Move llvm-mca library to llvm/lib/MCA.

    Summary: See PR38731.

    Reviewers: andreadb

    Subscribers: mgorny, javed.absar, tschuett, gbedwell, andreadb, RKSimon, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55557 (detail)
    by courbet
  503. [X86] Add test case for PR39968. NFC (detail)
    by ctopper
  504. [X86] Fix bad operand lookup for cmov introduced in r349315

    The CC is operand 2 not operand 3. (detail)
    by ctopper
  505. [Power9][NFC]update vabsd case for better dumping

    Appended options -ppc-vsr-nums-as-vr and -ppc-asm-full-reg-names to get the
    more descriptive output. Also removed useless function attributes. (detail)
    by jedilyn
  506. [analyzer] MoveChecker: Enable by default as cplusplus.Move.

    This checker warns you when you re-use an object after moving it.

    Mostly developed by Peter Szecsi!

    Differential Revision: https://reviews.llvm.org/D38675 (detail)
    by dergachev
  507. [analyzer] MoveChecker: Add an option to suppress warnings on locals.

    Re-using a moved-from local variable is most likely a bug because there's
    rarely a good motivation for not introducing a separate variable instead.
    We plan to keep emitting such warnings by default.

    Introduce a flag that allows disabling warnings on local variables that are
    not of a known move-unsafe type. If it doesn't work out as we expected,
    we'll just flip the flag.

    We still warn on move-unsafe objects and unsafe operations on known move-safe
    objects.

    Differential Revision: https://reviews.llvm.org/D55730 (detail)
    by dergachev
  508. Speculatively re-apply "[analyzer] MoveChecker: Add checks for dereferencing..."

    This re-applies commit r349226 that was reverted in r349233 due to failures
    on clang-x64-windows-msvc.

    Specify enum type as unsigned for use in bit field. Otherwise overflows
    may cause UB.

    Differential Revision: https://reviews.llvm.org/D55388 (detail)
    by dergachev
  509. [Power9][NFC]Make pre-inc-disable case more robust

    With some patch adopted for Power9 vabsd* insns, some CHECKs can't get the expected results.
    But it's false alarm, we should update the case more robust. (detail)
    by jedilyn
  510. [gn build] Add build files for opt and its dependency Transforms/Couroutines

    Needed for check-lld.

    Differential Revision: https://reviews.llvm.org/D55750 (detail)
    by nico
  511. [EarlyCSE] If DI can't be salvaged, mark it as unavailable.

    Fixes PR39874. (detail)
    by davide
  512. [InstCombine] Add cttz/ctlz + select non-bitwidth tests; NFC (detail)
    by nikic
  513. [InstCombine] Regenerate test checks; NFC

    Also drop unnecessary entry blocks and avoid use of anonymous
    variables. (detail)
    by nikic
  514. [analyzer] Fix some expressions staying live too long. Add a debug checker.

    StaticAnalyzer uses the CFG-based RelaxedLiveVariables analysis in order to,
    in particular, figure out values of which expressions are still needed.
    When the expression becomes "dead", it is garbage-collected during
    the dead binding scan.

    Expressions that constitute branches/bodies of control flow statements,
    eg. `E1' in `if (C1) E1;' but not `E2' in `if (C2) { E2; }', were kept alive
    for too long. This caused false positives in MoveChecker because it relies
    on cleaning up loop-local variables when they go out of scope, but some of those
    live-for-too-long expressions were keeping a reference to those variables.

    Fix liveness analysis to correctly mark these expressions as dead.

    Add a debug checker, debug.DumpLiveStmts, in order to test expressions liveness.

    Differential Revision: https://reviews.llvm.org/D55566 (detail)
    by dergachev
  515. [X86] Pull out constant splat rotation detection.

    We had 3 different approaches - consistently use getTargetConstantBitsFromNode and allow undef elts. (detail)
    by rksimon
  516. [InstCombine] Make cttz/ctlz knownbits tests more robust; NFC

    Tests checking for the addition of !range metadata should be
    preserved if cttz/ctlz + icmp is optimized. (detail)
    by nikic
  517. Regenerate test (merges X86+X64 cases). NFCI. (detail)
    by rksimon
  518. [X86] Remove truncation handling from EmitTest. Replace it with a DAG combine.

    I'd like to try to move a lot of the flag matching out of EmitTest and push it to isel or isel preprocessing. This is a step towards that.

    The test-shrink-bug.ll changie is an improvement because we are no longer interfering with test shrink handling in isel.

    The pr34137.ll change is a regression, but the IR came from -O0 and was not reduced by InstCombine. So it contains a lot of redundancies like duplicate loads that made it combine poorly. (detail)
    by ctopper
  519. [X86] Autogenerate complete checks. NFC (detail)
    by ctopper
  520. Revert "[InstCombine] Regenerate test checks; NFC"

    This reverts commit r349311.

    Didn't check this carefully enough... (detail)
    by nikic
  521. [InstCombine] Regenerate test checks; NFC (detail)
    by nikic
  522. [InstCombined] Add more tests for cttz/ctlz + icmp; NFC

    Test cases other than icmp with the bitwidth. (detail)
    by nikic
  523. [InstCombine] Add additional saturating add/sub + icmp tests; NFC

    These test comparisons with saturating add/sub in non-canonical
    form. (detail)
    by nikic
  524. Thread safety analysis: Avoid intermediate copies [NFC]

    The main reason is to reduce the number of constructor arguments though,
    especially since many of them had the same type. (detail)
    by aaronpuchert
  525. [InstCombine] regenerate test checks; NFC (detail)
    by spatel
  526. [InstCombine] add tests for vector widening transforms (PR40032); NFC (detail)
    by spatel
  527. [test] [support] Use socket()+bind() to create unix sockets portably

    Replace the mknod() call with socket() + bind() for creating unix
    sockets.  The mknod() method is not portable and does not work
    on NetBSD while binding the socket should work on all systems supporting
    unix sockets.

    Differential Revision: https://reviews.llvm.org/D55576 (detail)
    by mgorny
  528. [x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)

    This is part of fixing PR39859:
    https://bugs.llvm.org/show_bug.cgi?id=39859

    We have a crippled vector ISA, so we have to invert a typical fold and create min/max here.

    As discussed in the bug report, we can probably do better by using saturating subtract when
    it's available, but we should have this improvement for the min/max patterns regardless.

    Alive proofs:
    https://rise4fun.com/Alive/zsf
    https://rise4fun.com/Alive/Qrl

    Differential Revision: https://reviews.llvm.org/D55515 (detail)
    by spatel
  529. [DAGCombiner] allow hoisting vector bitwise logic ahead of truncates

    The transform performs a bitwise logic op in a wider type followed by
    truncate when both inputs are truncated from the same source type:
    logic_op (truncate x), (truncate y) --> truncate (logic_op x, y)

    There are a bunch of other checks that should prevent doing this when
    it might be harmful.

    We already do this transform for scalars in this spot. The vector
    limitation was shared with a check for the case when the operands are
    extended. I'm not sure if that limit is needed either, but that would
    be a separate patch.

    Differential Revision: https://reviews.llvm.org/D55448 (detail)
    by spatel
  530. Update the list of platforms & archs (detail)
    by sylvestre
  531. Use backquotes to avoid a sphinx unexpected error:
    Unknown target name: "bootstrap". (detail)
    by sylvestre
  532. Thread safety analysis: Allow scoped releasing of capabilities

    Summary:
    The pattern is problematic with C++ exceptions, and not as widespread as
    scoped locks, but it's still used by some, for example Chromium.

    We are a bit stricter here at join points, patterns that are allowed for
    scoped locks aren't allowed here. That could still be changed in the
    future, but I'd argue we should only relax this if people ask for it.

    Fixes PR36162.

    Reviewers: aaron.ballman, delesley, pwnall

    Reviewed By: delesley, pwnall

    Subscribers: pwnall, cfe-commits

    Differential Revision: https://reviews.llvm.org/D52578 (detail)
    by aaronpuchert
  533. Document the usage of BOOTSTRAP_XXX with stage2 builds (detail)
    by sylvestre
  534. [SelectionDAG] Add FSHL/FSHR support to computeKnownBits

    Also exposes an issue in DAGCombiner::visitFunnelShift where we were assuming the shift amount had the result type (after legalization it'll have the targets shift amount type). (detail)
    by rksimon
  535. [X86] Add computeKnownBits tests for funnel shift intrinsics (detail)
    by rksimon
  536. Improve the comment in previous (detail)
    by kamil
  537. Expand TSan sysroot workaround to NetBSD

    https://bugs.llvm.org/show_bug.cgi?id=26651 (detail)
    by kamil
  538. [test] [ctime] Ignore -Wformat-zero-length warnings

    Explicitly disable the -Wformat-zero-length diagnostic when running
    ctime tests, since one of the test cases passes zero-length format
    string to strftime().  When strftime() is appropriately decorated
    with __attribute__(format, ...), this caused the test to fail because
    of this warning (e.g. on NetBSD).

    Differential Revision: https://reviews.llvm.org/D55661 (detail)
    by mgorny
  539. [regex] Use distinct __regex_word on NetBSD

    NetBSD defines character classes up to 0x2000.  Use 0x8000 as a safe
    __regex_word that hopefully will not collide with other values
    in the foreseeable future.

    Differential Revision: https://reviews.llvm.org/D55657 (detail)
    by mgorny
  540. [gn build] Merge r349167 (detail)
    by nico
  541. [gn build] Add build files for obj2yaml, yaml2obj, and lib/ObjectYAML

    The two executables are needed by check-lld.

    Differential Revision: https://reviews.llvm.org/D55687 (detail)
    by nico
  542. [gn build] Add build files for llvm-as, llvm-dis, llvm-dwarfdump, llvm-mc, FileCheck, count, not

    These executables are needed by check-lld.

    Differential Revision: https://reviews.llvm.org/D55688 (detail)
    by nico
  543. Fix a lit test failure after MallocChecker changes (detail)
    by szelethus
  544. [X86] Autogenerate complete checks. NFC (detail)
    by ctopper
  545. [X86] Begin cleaning up combineOr -> SHLD/SHRD. NFCI.

    In preparation for converting to funnel shifts. (detail)
    by rksimon
  546. [X86] Lower to SHLD/SHRD on slow machines for optsize

    Use consistent rules for when to lower to SHLD/SHRD for slow machines - fixes a weird issue where funnel shift gets expanded but then X86ISelLowering's combineOr sees the optsize and combines to SHLD/SHRD, but now with the modulo amount guard...... (detail)
    by rksimon
  547. [X86] Add optsize SHLD/SHRD tests (detail)
    by rksimon
  548. [analyzer][MallocChecker] Improve warning messages on double-delete errors

    Differential Revision: https://reviews.llvm.org/D54834 (detail)
    by szelethus
  549. [analyzer][MallocChecker][NFC] Document and reorganize some functions

    This patch merely reorganizes some things, and features no functional change.

    In detail:

    * Provided documentation, or moved existing documentation in more obvious
    places.
    * Added dividers. (the //===----------===// thing).
    * Moved getAllocationFamily, printAllocDeallocName, printExpectedAllocName and
    printExpectedDeallocName in the global namespace on top of the file where
    AllocationFamily is declared, as they are very strongly related.
    * Moved isReleased and MallocUpdateRefState near RefState's definition for the
    same reason.
    * Realloc modeling was very poor in terms of variable and structure naming, as
    well as documentation, so I renamed some of them and added much needed docs.
    * Moved function IdentifierInfos to a separate struct, and moved isMemFunction,
    isCMemFunction adn isStandardNewDelete inside it. This makes the patch affect
    quite a lot of lines, should I extract it to a separate one?
    * Moved MallocBugVisitor out of MallocChecker.
    * Preferred switches to long else-if branches in some places.
    * Neatly organized some RUN: lines.

    Differential Revision: https://reviews.llvm.org/D54823 (detail)
    by szelethus
  550. [analyzer][NFC] Merge ClangCheckerRegistry to CheckerRegistry

    Now that CheckerRegistry lies in Frontend, we can finally eliminate
    ClangCheckerRegistry. Fortunately, this also provides us with a
    DiagnosticsEngine, so I went ahead and removed some parameters from it's
    methods.

    Differential Revision: https://reviews.llvm.org/D54437 (detail)
    by szelethus
  551. Link examples/clang-interpreter against clangSerialization (detail)
    by szelethus
  552. Fix a compilation error in examples/ (detail)
    by szelethus
  553. Add NetBSD support in needsRuntimeRegistrationOfSectionRange.

    Use linker script magic to get data/cnts/name start/end. (detail)
    by kamil
  554. Register kASan shadow offset for NetBSD/amd64

    The NetBSD x86_64 kernel uses the 0xdfff900000000000 shadow
    offset. (detail)
    by kamil
  555. [analyzer][NFC] Move CheckerRegistry from the Core directory to Frontend

    ClangCheckerRegistry is a very non-obvious, poorly documented, weird concept.
    It derives from CheckerRegistry, and is placed in lib/StaticAnalyzer/Frontend,
    whereas it's base is located in lib/StaticAnalyzer/Core. It was, from what I can
    imagine, used to circumvent the problem that the registry functions of the
    checkers are located in the clangStaticAnalyzerCheckers library, but that
    library depends on clangStaticAnalyzerCore. However, clangStaticAnalyzerFrontend
    depends on both of those libraries.

    One can make the observation however, that CheckerRegistry has no place in Core,
    it isn't used there at all! The only place where it is used is Frontend, which
    is where it ultimately belongs.

    This move implies that since
    include/clang/StaticAnalyzer/Checkers/ClangCheckers.h only contained a single function:

    class CheckerRegistry;

    void registerBuiltinCheckers(CheckerRegistry &registry);

    it had to re purposed, as CheckerRegistry is no longer available to
    clangStaticAnalyzerCheckers. It was renamed to BuiltinCheckerRegistration.h,
    which actually describes it a lot better -- it does not contain the registration
    functions for checkers, but only those generated by the tblgen files.

    Differential Revision: https://reviews.llvm.org/D54436 (detail)
    by szelethus
  556. [analyzer] Prefer returns values to out-params in CheckerRegistry.cpp

    Renaming collectCheckers to getEnabledCheckers
    Changing the functionality to acquire all enabled checkers, rather then collect
    checkers for a specific CheckerOptInfo (for example, collecting all checkers for
    { "core", true }, which meant enabling all checkers from the core package, which
    was an unnecessary complication).
    Removing CheckerOptInfo, instead of storing whether the option was claimed via a
    field, we handle errors immediately, as getEnabledCheckers can now access a
    DiagnosticsEngine. Realize that the remaining information it stored is directly
    accessible through AnalyzerOptions.CheckerControlList.
    Fix a test with -analyzer-disable-checker -verify accidentally left in. (detail)
    by szelethus
  557. [CodeGen] Enhance machine PHIs optimization

    Summary:
    Make machine PHIs optimization to work for single value register taken from
    several different copies. This is the first step to fix PR38917. This change
    allows to get rid of redundant PHIs (see opt_phis2.mir test) to make
    the subsequent optimizations (like CSE) possible and simpler.

    For instance, before this patch the code like this:

    %b = COPY %z
    ...
    %a = PHI %bb1, %a; %bb2, %b
    could be optimized to:

    %a = %b
    but the code like this:

    %c = COPY %z
    ...
    %b = COPY %z
    ...
    %a = PHI %bb1, %a; %bb2, %b; %bb3, %c
    would remain unchanged.
    With this patch the latter case will be optimized:

    %a = %z```.

    Committed on behalf of: Anton Afanasyev anton.a.afanasyev@gmail.com

    Reviewers: RKSimon, MatzeB

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54839 (detail)
    by dinar
  558. Regenerate neon copy tests. NFCI. (detail)
    by rksimon
  559. [analyzer] Assume that we always have a SubEngine available

    The removed codepath was dead.

    Differential Revision: https://reviews.llvm.org/D55697 (detail)
    by xazax
  560. Fix -Wunused-variable warning. NFCI. (detail)
    by rksimon
  561. [TargetLowering] Add ISD::OR + ISD::XOR handling to SimplifyDemandedVectorElts

    Differential Revision: https://reviews.llvm.org/D55600 (detail)
    by rksimon
  562. Enable test/msan/pthread_getname_np.cc for NetBSD (detail)
    by kamil
  563. Enable SANITIZER_INTERCEPT_PTHREAD_GETNAME_NP for NetBSD (detail)
    by kamil
  564. [InstSimplify] Add tests for saturating add/sub + icmp; NFC

    If a saturating add/sub with a constant operand is compared to
    another constant, we should be able to determine that the condition
    is always true/false in some cases (but currently don't). (detail)
    by nikic
  565. [libclang] Add dependency on clangSerialization to unbreak -DBUILD_SHARED_LIBS=1 build after rC349237

    Frontend headers have undefined reference on the symbol `clang::PCHContainerOperations::PCHContainerOperations()` through some shared_ptr usage. Any dependents will get the undefined reference which can only be resolved by explicit dependency on clangSerialization (due to -z defs). (detail)
    by maskray
  566. [mips] Fix test typo in rL348914

    RUN; -> RUN: (detail)
    by maskray
  567. Fix internal_sleep() for NetBSD

    This is a follow up of a similar fix for Linux from D55692. (detail)
    by kamil
  568. [MinGW] Produce a vtable and RTTI for dllexported classes without a key function

    This matches what GCC does in these situations.

    This fixes compiling Qt in debug mode. In release mode, references to
    the vtable of this particular class ends up optimized away, but in debug
    mode, the compiler creates references to the vtable, which is expected
    to be dllexported from a different DLL. Make sure the dllexported
    version actually ends up emitted.

    Differential Revision: https://reviews.llvm.org/D55698 (detail)
    by mstorsjo
  569. Fix typo in test cases as well. (detail)
    by pcc
  570. hwasan: Fix typo: Previosly -> Previously. (detail)
    by pcc
  571. Fix static assert diagnostic checks in i386 (detail)
    by ericwf
  572. [Power9][NFC] add setb exploitation test case

    Add an original test case for setb before the exploitation actually takes effect, later we can check the difference.

    Differential Revision: https://reviews.llvm.org/D55696 (detail)
    by jedilyn
  573. Fix includes and dependencies for libclang

    Remove unneeded includes
    Add needed include
    Remove dependency on Serialization (detail)
    by rtrieu
  574. Try 2: Fix bug in buildbot start script (detail)
    by ericwf
  575. Fix bug in buildbot start script (detail)
    by ericwf
  576. Rework docker setup to make it easier to work around bugs on buildbots (detail)
    by ericwf
  577. Revert "[analyzer] MoveChecker: Add checks for dereferencing a smart pointer..."

    This reverts commit r349226.

    Fails on an MSVC buildbot. (detail)
    by dergachev
  578. Move static analyzer core diagnostics to common. (detail)
    by rtrieu
  579. [analyzer] Fix unknown block calls to have zero parameters.

    Right now they report to have one parameter with null decl,
    because initializing an ArrayRef of pointers with a nullptr
    yields an ArrayRef to an array of one null pointer.

    Fixes a crash in the OSObject section of RetainCountChecker.

    Differential Revision: https://reviews.llvm.org/D55671 (detail)
    by dergachev
  580. [analyzer] ObjCDealloc: Fix a crash when a class attempts to deallocate a class.

    The checker wasn't prepared to see the dealloc message sent to the class itself
    rather than to an instance, as if it was +dealloc.

    Additionally, it wasn't prepared for pure-unknown or undefined self values.
    The new guard covers that as well, but it is annoying to test because
    both kinds of values shouldn't really appear and we generally want to
    get rid of all of them (by modeling unknown values with symbols and
    by warning on use of undefined values before they are used).

    The CHECK: directive for FileCheck at the end of the test looks useless,
    so i removed it.

    Differential Revision: https://reviews.llvm.org/D55680 (detail)
    by dergachev
  581. [analyzer] ObjCContainers: Track index values.

    Use trackExpressionValue() (previously known as trackNullOrUndefValue())
    to track index value in the report, so that the user knew
    what Static Analyzer thinks the index is.

    Additionally, implement printState() to help debugging the checker later.

    Differential Revision: https://reviews.llvm.org/D55458 (detail)
    by dergachev
  582. [analyzer] MoveChecker: Add checks for dereferencing a smart pointer after move.

    Calling operator*() or operator->() on a null STL smart pointer is
    undefined behavior.

    Smart pointers are specified to become null after being moved from.
    So we can't warn on arbitrary method calls, but these two operators
    definitely make no sense.

    The new bug is fatal because it's an immediate UB,
    unlike other use-after-move bugs.

    The work on a more generic null smart pointer dereference checker
    is still pending.

    Differential Revision: https://reviews.llvm.org/D55388 (detail)
    by dergachev
  583. [analyzer] MoveChecker: NFC: De-duplicate a few checks.

    No functional change intended.

    Differential Revision: https://reviews.llvm.org/D55387 (detail)
    by dergachev
  584. [SILoadStoreOptimizer] Use std::abs to avoid truncation.

    Using regular abs() causes the following warning

    error: absolute value function 'abs' given an argument of type 'int64_t' (aka 'long') but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
            (uint32_t)abs(Dist) > MaxDist) {
                      ^
    lib/Target/AMDGPU/SILoadStoreOptimizer.cpp:1369:19: note: use function 'std::abs' instead

    which causes a bot to fail:
    http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/18284/steps/bootstrap%20clang/logs/stdio (detail)
    by fhahn
  585. [X86] Rename hasNoSignedComparisonUses to hasNoSignFlagUses. Add the instruction that only modify the O flag to the waiver list.

    The only caller of this turns CMP with 0 into TEST. CMP with 0 and TEST both set OF to 0 so we should have no issues with instructions that only use OF.

    Though I don't think there's any reason we would read just OF after a compare with 0 anyway. So this probably isn't an observable change. (detail)
    by ctopper
  586. [X86] Make hasNoCarryFlagUses/hasNoSignedComparisonUses take an SDValue that indicates which result is the flag result. NFCI

    hasNoCarryFlagUses hardcoded that the flag result is 1 and used that to filter which uses were of interest. hasNoSignedComparisonUses just assumes the only result is flags and checks whether any user of the node is a CopyToReg instruction.

    After this patch we now do a result number check in both and rely on the caller to provide the result number.

    This shouldn't change behavior it was just an odd difference between the two functions that I noticed. (detail)
    by ctopper
  587. [WebAssembly] Check if the section order is correct

    Summary:
    This patch checks if the section order is correct when reading a wasm
    object file in `WasmObjectFile` and converting YAML to wasm object in
    yaml2wasm. (It is not possible to check when reading YAML because it is
    handled exclusively by the YAML reader.)

    This checks the ordering of all known sections (core sections + known
    custom sections). This also adds section ID DataCount section that will
    be scheduled to be added in near future.

    Reviewers: sbc100

    Subscribers: dschuff, mgorny, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54924 (detail)
    by aheejin
  588. [NewGVN] Update use counts for SSA copies when replacing them by their operands.

    The current code relies on LeaderUseCount to determine if we can remove
    an SSA copy, but in that the LeaderUseCount does not refer to the SSA
    copy. If a SSA copy is a dominating leader, we use the operand as dominating
    leader instead. This means we removed a user of a ssa copy and we should
    decrement its use count, so we can remove the ssa copy once it becomes dead.

    Fixes PR38804.

    Reviewers: efriedma, davide

    Reviewed By: davide

    Differential Revision: https://reviews.llvm.org/D51595 (detail)
    by fhahn
  589. [Util] Refer to [s|z]exts of args when converting dbg.declares (fix PR35400)

    When converting dbg.declares, if the described value is a [s|z]ext,
    refer to the ext directly instead of referring to its operand.

    This fixes a narrowing bug (the debugger got the sign of a variable
    wrong, see llvm.org/PR35400).

    The main reason to refer to the ext's operand was that an optimization
    may remove the ext itself, leading to a dropped variable. Now that
    InstCombine has been taught to use replaceAllDbgUsesWith (r336451), this
    is less of a concern. Other passes can/should adopt this API as needed
    to fix dropped variable bugs.

    Differential Revision: https://reviews.llvm.org/D51813 (detail)
    by Vedant Kumar
  590. [NVPTX] Lower instructions that expand into libcalls.

    The change is an effort to split and refactor abandoned
    D34708 into smaller parts.

    Here the behaviour of unsupported instructions is changed
    to match the behaviour of explicit intrinsics calls.
    Currently LLVM crashes with:
    > Assertion getInstruction() && "Not a call or invoke instruction!" failed.

    With this patch LLVM produces a more sensible error message:
    > Cannot select: ... i32 = ExternalSymbol'__foobar'

    Author: Denys Zariaiev <denys.zariaiev@gmail.com>

    Differential Revision: https://reviews.llvm.org/D55145 (detail)
    by tra
  591. Mangle calling conventions into function pointer types where GCC does

    Summary:
    GCC 5.1 began mangling these Windows calling conventions into function
    types, since they can be used for overloading. They've always been
    mangled in the MS ABI, but they are new to the Itanium mangler. Note
    that the calling convention doesn't appear as part of the main
    declaration, it only appears on function parameter types and other
    types.

    Fixes PR39860

    Reviewers: rjmccall, efriedma

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55672 (detail)
    by rnk
  592. [libFuzzer] make len_control less aggressive (detail)
    by kcc
  593. Add AddressSpace mangling to MS mode

    All of the symbols demangle on llvm-undname and demangler.com. This
    address space qualifier is useful for when we want to use opencl C++ in
    Windows mode. Additionally, C++ address-space using functions will now
    be usable on windows.

    Differential Revision: https://reviews.llvm.org/D55715

    Change-Id: Ife4506613c3cce778a783456d62117fbf7d83c26 (detail)
    by erichkeane
  594. DebugInfo: Avoid using split DWARF when the split unit would be empty.

    In ThinLTO many split CUs may be effectively empty because of the lack
    of support for cross-unit references in split DWARF.

    Using a split unit in those cases is just a waste/overhead - and turned
    out to be one contributor to a significant symbolizer performance issue
    when global variable debug info was being imported (see r348416 for the
    primary fix) due to symbolizers seeing CUs with no ranges, assuming
    there might still be addresses covered and walking into the split CU to
    see if there are any ranges (when that split CU was in a DWP file, that
    meant loading the DWP and its index, the index was extra large because
    of all these fractured/empty CUs... and so was very expensive to load).

    (the 3rd fix which will follow, is to assume that a CU with no ranges is
    empty rather than merely missing its CU level range data - and to not
    walk into its DIEs (split or otherwise) in search of address information
    that is generally not present) (detail)
    by dblaikie
  595. Revert "Add extension to always default-initialize nullptr_t."

    This reverts commit 46efdf2ccc2a80aefebf8433dbf9c7c959f6e629.

    Richard Smith commented just after I submitted this that this is the
    wrong solution.  Reverting so that I can fix differently. (detail)
    by erichkeane
  596. [codeview] Add begin/endSymbolRecord helpers, NFC

    Previously beginning a symbol record was excessively verbose. Now it's a
    bit simpler. This follows the same pattern as begin/endCVSubsection. (detail)
    by rnk
  597. DebugInfo: Move addAddrBase from DwarfUnit to DwarfCompileUnit

    Only CUs need an address table reference. (detail)
    by dblaikie
  598. [Hexagon] Add patterns for shifts of v2i16

    This fixes https://llvm.org/PR39983. (detail)
    by kparzysz
  599. Add extension to always default-initialize nullptr_t.

    Core issue 1013 suggests that having an uninitialied std::nullptr_t be
    UB is a bit foolish, since there is only a single valid value. This DR
    reports that DR616 fixes it, which does so by making lvalue-to-rvalue
    conversions from nullptr_t be equal to nullptr.

    However, just implementing that results in warnings/etc in many places.
    In order to fix all situations where nullptr_t would seem uninitialized,
    this patch instead (as an otherwise transparent extension) default
    initializes uninitialized VarDecls of nullptr_t.

    Differential Revision: https://reviews.llvm.org/D53713

    Change-Id: I84d72a9290054fa55341e8cbdac43c8e7f25b885 (detail)
    by erichkeane
  600. [GlobalISel] LegalizerHelper: Implement fewerElementsVector for G_LOAD/G_STORE

    Reviewers: aemerson, dsanders, bogner, paquette, aditya_nandakumar

    Reviewed By: dsanders

    Subscribers: rovka, kristof.beyls, javed.absar, tschuett, llvm-commits

    Differential Revision: https://reviews.llvm.org/D53728 (detail)
    by volkan
  601. [Hexagon] Use IMPLICIT_DEF to any-extend 32-bit values to 64 bits (detail)
    by kparzysz
  602. Using llvm::find_if() instead of a range-based for loop; NFC.

    This addresses post-commit review feedback from r349188. (detail)
    by aaronballman
  603. [AMDGPU] Promote constant offset to the immediate by finding a new base with 13bit constant offset from the nearby instructions.

    Summary: Promote constant offset to immediate by recomputing the relative 13bit offset from nearby instructions.
    E.g.
      s_movk_i32 s0, 0x1800
      v_add_co_u32_e32 v0, vcc, s0, v2
      v_addc_co_u32_e32 v1, vcc, 0, v6, vcc

      s_movk_i32 s0, 0x1000
      v_add_co_u32_e32 v5, vcc, s0, v2
      v_addc_co_u32_e32 v6, vcc, 0, v6, vcc
      global_load_dwordx2 v[5:6], v[5:6], off
      global_load_dwordx2 v[0:1], v[0:1], off
      =>
      s_movk_i32 s0, 0x1000
      v_add_co_u32_e32 v5, vcc, s0, v2
      v_addc_co_u32_e32 v6, vcc, 0, v6, vcc
      global_load_dwordx2 v[5:6], v[5:6], off
      global_load_dwordx2 v[0:1], v[5:6], off offset:2048

    Author: FarhanaAleen

    Reviewed By: arsenm, rampitec

    Subscribers: llvm-commits, AMDGPU

    Differential Revision: https://reviews.llvm.org/D55539 (detail)
    by faaleen
  604. [Clang] Add __builtin_launder

    Summary:
    This patch adds `__builtin_launder`, which is required to implement `std::launder`. Additionally GCC provides `__builtin_launder`, so thing brings Clang in-line with GCC.

    I'm not exactly sure what magic `__builtin_launder` requires, but  based on previous discussions this patch applies a `@llvm.invariant.group.barrier`. As noted in previous discussions, this may not be enough to correctly handle vtables.

    Reviewers: rnk, majnemer, rsmith

    Reviewed By: rsmith

    Subscribers: kristina, Romain-Geissler-1A, erichkeane, amharc, jroelofs, cfe-commits, Prazek

    Differential Revision: https://reviews.llvm.org/D40218 (detail)
    by ericwf
  605. Add missing includes and forward decls to unbreak build (detail)
    by ericwf
  606. [OPENMP][NVPTX]Improved interwarp copy function.

    Inlined runtime with the current implementation of the interwarp copy
    function leads to the undefined behavior because of the not quite
    correct implementation of the barriers. Start using generic
    __kmpc_barier function instead of the custom made barriers. (detail)
    by abataev
  607. [analyzer] MoveChecker Pt.6: Suppress the warning for the move-safe STL classes.

    Some C++ standard library classes provide additional guarantees about their
    state after move. Suppress warnings on such classes until a more precise
    behavior is implemented. Warnings for locals are not suppressed anyway
    because it's still most likely a bug.

    Differential Revision: https://reviews.llvm.org/D55307 (detail)
    by dergachev
  608. [analyzer] MoveChecker: Improve invalidation policies.

    If a moved-from object is passed into a conservatively evaluated function
    by pointer or by reference, we assume that the function may reset its state.

    Make sure it doesn't apply to const pointers and const references. Add a test
    that demonstrates that it does apply to rvalue references.

    Additionally, make sure that the object is invalidated when its contents change
    for reasons other than invalidation caused by evaluating a call conservatively.
    In particular, when the object's fields are manipulated directly, we should
    assume that some sort of reset may be happening.

    Differential Revision: https://reviews.llvm.org/D55289 (detail)
    by dergachev
  609. Tolerate Clangs new static_assert messages (detail)
    by ericwf
  610. Update our SARIF support from 10-10 to 11-28.

    Functional changes include:

    * The run.files property is now an array instead of a mapping.
    * fileLocation objects now have a fileIndex property specifying the array index into run.files.
    * The resource.rules property is now an array instead of a mapping.
    * The result object was given a ruleIndex property that is an index into the resource.rules array.
    * rule objects now have their "id" field filled out in addition to the name field.
    * Updated the schema and spec version numbers to 11-28. (detail)
    by aaronballman
  611. [libcxx] Mark some tests as still failing on macosx10.14 (detail)
    by Louis Dionne
  612. [SDAG] Ignore chain operand in REG_SEQUENCE when emitting instructions (detail)
    by kparzysz
  613. [AArch64] Simplify the scheduling predicates (NFC)

    The instruction encodings make it unnecessary to distinguish extended W-form
    from X-form instructions. (detail)
    by evandro
  614. [TransformWarning] Do not warn missed transformations in optnone functions.

    Optimization transformations are intentionally disabled by the 'optnone'
    function attribute. Therefore do not warn if transformation metadata is
    still present.

    Using the legacy pass manager structure, the `skipFunction` method takes
    care for the optnone attribute (already called before this patch). For
    the new pass manager, there is no equivalent, so we check for the
    'optnone' attribute manually.

    Differential Revision: https://reviews.llvm.org/D55690 (detail)
    by meinersbur
  615. When resolving a merge conflict, I put something inside an #ifdef. Fixed. (detail)
    by marshall
  616. [x86] add tests for extractelement of FP binops; NFC (detail)
    by spatel
  617. Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532 (detail)
    by marshall
  618. [ARM] make test immune to scalarization improvements; NFC (detail)
    by spatel
  619. [x86] make tests immune to scalarization improvements; NFC (detail)
    by spatel
  620. [globalisel][combiner] Fix r349167 for release mode bots

    This test relies on -debug-only which is unavailable in non-asserts builds. (detail)
    by dsanders
  621. [ADT] Fix bugs in SmallBitVector.

    Fixes:
      * find_last/find_last_unset - off-by-one error
      * Compound assignment ops and operator== when mixing big/small modes

    Patch by Brad Moody
    Differential Revision: https://reviews.llvm.org/D54933 (detail)
    by zturner
  622. Fix Visual Studio PointerIntPair visualizer

    Patch by: Trass3r

    Differential Revision: https://reviews.llvm.org/D55252 (detail)
    by zturner
  623. [libcxx] Make sure use_system_cxx_lib does not override cxx_runtime_root for DYLD_LIBRARY_PATH

    Otherwise, even specifying a runtime root different from the library
    we're linking against won't work -- the library we're linking against
    is always used. This is undesirable if we try testing something like
    linking against a recent libc++.dylib but running the tests against an
    older version (the back-deployment use case). (detail)
    by Louis Dionne
  624. [Transforms] Preserve metadata when converting invoke to call.

    The `changeToCall` function did not preserve the invoke's metadata.
    Currently, there is probably no metadata that depends on being applied
    on a CallInst or InvokeInst. Therefore we can replace the instruction's
    metadata.

    This fixes http://llvm.org/PR39994

    Suggested-by: Moritz Kreutzer <moritz.kreutzer@siemens.com>

    Differential Revision: https://reviews.llvm.org/D55666 (detail)
    by meinersbur
  625. [MS Demangler] Fail gracefully on invalid pointer types.

    Once we detect a 'P', we know we a pointer type is upcoming, so
    we make some assumptions about the output that follows.  If those
    assumptions didn't hold, we would assert.  Instead, we should
    fail gracefully and propagate the error up. (detail)
    by zturner
  626. [MS Demangler] Add a regression test for an invalid mangled name. (detail)
    by zturner
  627. [globalisel][combiner] Make the CombinerChangeObserver a MachineFunction::Delegate

    Summary:
    This allows us to register it with the MachineFunction delegate and be
    notified automatically about erasure and creation of instructions. However,
    we still need explicit notification for modifications such as those caused
    by setReg() or replaceRegWith().

    There is a catch with this though. The notification for creation is
    delivered before any operands can be added. While appropriate for
    scheduling combiner work. This is unfortunate for debug output since an
    opcode by itself doesn't provide sufficient information on what happened.
    As a result, the work list remembers the instructions (when debug output is
    requested) and emits a more complete dump later.

    Another nit is that the MachineFunction::Delegate provides const pointers
    which is inconvenient since we want to use it to schedule future
    modification. To resolve this GISelWorkList now has an optional pointer to
    the MachineFunction which describes the scope of the work it is permitted
    to schedule. If a given MachineInstr* is in this function then it is
    permitted to schedule work to be performed on the MachineInstr's. An
    alternative to this would be to remove the const from the
    MachineFunction::Delegate interface, however delegates are not permitted
    to modify the MachineInstr's they receive.

    In addition to this, the observer has three interface changes.
    * erasedInstr() is now erasingInstr() to indicate it is about to be erased
      but still exists at the moment.
    * changingInstr() and changedInstr() have been added to report changes
      before and after they are made. This allows us to trace the changes
      in the debug output.
    * As a convenience changingAllUsesOfReg() and
      finishedChangingAllUsesOfReg() will report changingInstr() and
      changedInstr() for each use of a given register. This is primarily useful
      for changes caused by MachineRegisterInfo::replaceRegWith()

    With this in place, both combine rules have been updated to report their
    changes to the observer.

    Finally, make some cosmetic changes to the debug output and make Combiner
    and CombinerHelp

    Reviewers: aditya_nandakumar, bogner, volkan, rtereshin, javed.absar

    Reviewed By: aditya_nandakumar

    Subscribers: mgorny, rovka, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D52947 (detail)
    by dsanders
  628. [AArch64] make test immune to scalarization improvements; NFC

    This is explicitly implementing what the comment says rather
    than relying on the implicit zext of a costant operand. (detail)
    by spatel
  629. Fix a crash in llvm-undname with invalid types. (detail)
    by zturner
  630. [SystemZ] make test immune to scalarization improvements; NFC

    The undef operands mean this test is probably still too fragile
    to accomplish what the comments suggest. (detail)
    by spatel
  631. [Hexagon] make test immune to scalarization improvements; NFC (detail)
    by spatel
  632. [x86] auto-generate complete checks; NFC (detail)
    by spatel
  633. [x86] regenerate test checks; NFC (detail)
    by spatel
  634. [x86] make tests immune to scalarization improvements; NFC (detail)
    by spatel
  635. Mark interception_failure_test.cc as passing for NetBSD and asan-dynamic-runtime (detail)
    by kamil
  636. NFC. Adding an empty line to test the updated commit credentials. (detail)
    by amehsan
  637. Set shared_libasan_path in lit tests for NetBSD

    Reuse the Linux code path. (detail)
    by kamil
  638. Implement -frecord-command-line (-frecord-gcc-switches)

    Implement options in clang to enable recording the driver command-line
    in an ELF section.

    Implement a new special named metadata, llvm.commandline, to support
    frontends embedding their command-line options in IR/ASM/ELF.

    This differs from the GCC implementation in some key ways:

    * In GCC there is only one command-line possible per compilation-unit,
      in LLVM it mirrors llvm.ident and multiple are allowed.
    * In GCC individual options are separated by NULL bytes, in LLVM entire
      command-lines are separated by NULL bytes. The advantage of the GCC
      approach is to clearly delineate options in the face of embedded
      spaces. The advantage of the LLVM approach is to support merging
      multiple command-lines unambiguously, while handling embedded spaces
      with escaping.

    Differential Revision: https://reviews.llvm.org/D54487
    Clang Differential Revision: https://reviews.llvm.org/D54489 (detail)
    by scott.linder
  639. [dexp] Change FuzzyFind to also print scope of symbols

    Summary:
    When there are multiple symbols in the result of a fuzzy find with the
    same name, one has to perform an additional query to figure out which of those
    symbols are coming from the "interesting" scope. This patch prints the scope in
    fuzzy find results to get rid of the second symbol.

    Reviewers: hokein

    Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55705 (detail)
    by kadircet
  640. [RegAllocGreedy] IMPLICIT_DEF values shouldn't prefer registers

    It costs nothing to spill an IMPLICIT_DEF value (the only spill code that's
    generated is a KILL of the value), so when creating split constraints if the
    live-out value is IMPLICIT_DEF the exit constraint should be DontCare instead
    of PrefReg.

    Differential Revision: https://reviews.llvm.org/D55652 (detail)
    by john.brawn
  641. clang-include-fixer.el: support remote files

    Summary: Support remote files (e.g., Tramp) in the Emacs integration for clang-include-fixer

    Reviewers: klimek

    Reviewed By: klimek

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D54672 (detail)
    by phst
  642. [clangd] Use buildCompilerInvocation to simplify the HeadersTests, NFC. (detail)
    by hokein
  643. [ARM GlobalISel] Thumb2: casts between int and ptr

    Mark as legal and add tests. Nothing special to do. (detail)
    by rovka
  644. [ARM GlobalISel] Remove duplicate test. NFCI

    Fixup for r349026. I forgot to delete these test functions from the
    original file when I moved them to arm-legalize-exts.mir. (detail)
    by rovka
  645. [clangd] Fix memory leak in ClangdTests.

    Summary:
    createInvocationFromCommandLine sets DisableFree to true by default,
    which leads memory leak in clangd. The fix is to  use the `BuildCompilationInvocation`
    to create CI with the correct options (DisableFree is false).

    Fix https://bugs.llvm.org/show_bug.cgi?id=39991.

    Reviewers: kadircet

    Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55702 (detail)
    by hokein
  646. [clangd] Fix an assertion failure in background index.

    Summary:
    When indexing a file which contains an uncompilable error, we will
    trigger an assertion failure -- the IndexFileIn data is not set, but we
    access them in the backgound index.

    Reviewers: kadircet

    Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55650 (detail)
    by hokein
  647. [ARM GlobalISel] Minor refactoring. NFCI

    Refactor the ARMInstructionSelector to cache some opcodes in the
    constructor instead of checking all the time if we're in ARM or Thumb
    mode. (detail)
    by rovka
  648. [ARM GlobalISel] Allow simple binary ops in Thumb2

    Mark G_ADD, G_SUB, G_MUL, G_AND, G_OR and G_XOR as legal for both ARM
    and Thumb2.

    Extract the legalizer tests for these opcodes into another file.

    Add tests for the instruction selector. (detail)
    by rovka
  649. [TableGen:AsmWriter] Cope with consecutive tied operands.

    When you define an instruction alias as a subclass of InstAlias, you
    specify all the MC operands for the instruction it expands to, except
    for operands that are tied to a previous one, which you leave out in
    the expectation that the Tablegen output code will fill them in
    automatically.

    But the code in Tablegen's AsmWriter backend that skips over a tied
    operand was doing it using 'if' instead of 'while', because it wasn't
    expecting to find two tied operands in sequence.

    So if an instruction updates a pair of registers in place, so that its
    MC representation has two input operands tied to the output ones (for
    example, Arm's UMLAL instruction), then any alias which wants to
    expand to a special case of that instruction is likely to fail to
    match, because the indices of subsequent operands will be off by one
    in the generated printAliasInstr function.

    This patch re-indents some existing code, so it's clearest when
    viewed as a diff with whitespace changes ignored.

    Reviewers: fhahn, rengolin, sdesmalen, atanasyan, asb, jholewinski, t.p.northover, kparzysz, craig.topper, stoklund

    Reviewed By: rengolin

    Subscribers: javed.absar, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D53816 (detail)
    by statham
  650. Revert rL349136: [llvm-exegesis] Optimize ToProcess in dbScan

    Summary:
    Use `vector<char> Added + vector<size_t> ToProcess` to replace `SetVector ToProcess`

    We also check `Added[P]` to enqueueing a point more than once, which
    also saves us a `ClusterIdForPoint_[Q].isUndef()` check.

    Reviewers: courbet, RKSimon, gchatelet, john.brawn, lebedev.ri

    Subscribers: tschuett, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54442
    ........
    Patch wasn't approved and breaks buildbots (detail)
    by rksimon
  651. Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteMap`, and `TwoLevelByteMap`.

    Summary:
    This is a follow up patch to r346956 for the `SizeClassAllocator32`
    allocator.

    This patch makes `AddressSpaceView` a template parameter both to the
    `ByteMap` implementations (but makes `LocalAddressSpaceView` the
    default), some `AP32` implementations and is used in `SizeClassAllocator32`.
    The actual changes to `ByteMap` implementations and
    `SizeClassAllocator32` are very simple. However the patch is large
    because it requires changing all the `AP32` definitions, and users of
    those definitions.

    For ASan and LSan we make `AP32` and `ByteMap` templateds type that take
    a single `AddressSpaceView` argument. This has been done because we will
    instantiate the allocator with a type that isn't `LocalAddressSpaceView`
    in the future patches. For the allocators used in the other sanitizers
    (i.e. HWAsan, MSan, Scudo, and TSan) use of `LocalAddressSpaceView` is
    hard coded because we do not intend to instantiate the allocators with
    any other type.

    In the cases where untemplated types have become templated on a single
    `AddressSpaceView` parameter (e.g. `PrimaryAllocator`) their name has
    been changed to have a `ASVT` suffix (Address Space View Type) to
    indicate they are templated.  The only exception to this are the `AP32`
    types due to the desire to keep the type name as short as possible.

    In order to check that template is instantiated in the correct a way a
    `static_assert(...)` has been added that checks that the
    `AddressSpaceView` type used by `Params::ByteMap::AddressSpaceView` matches
    the `Params::AddressSpaceView`. This uses the new `sanitizer_type_traits.h`
    header.

    rdar://problem/45284065

    Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

    Subscribers: mgorny, llvm-commits, #sanitizers

    Differential Revision: https://reviews.llvm.org/D54904 (detail)
    by delcypher
  652. [DAGCombiner][X86] Prevent visitSIGN_EXTEND from returning N when (sext (setcc)) already has the target desired type for the setcc

    Summary:
    If the setcc already has the target desired type we can reach the getSetCC/getSExtOrTrunc after the MatchingVecType check with the exact same types as the nodes we started with. This causes those causes VsetCC to be CSEd to N0 and the getSExtOrTrunc will CSE to N. When we return N, the caller will think that meant we called CombineTo and did our own worklist management. But that's not what happened. This prevents target hooks from being called for the node.

    To fix this, I've now returned SDValue if the setcc is already the desired type. But to avoid some regressions in X86 I've had to disable one of the target combines that wasn't being reached before in the case of a (sext (setcc)). If we get vector widening legalization enabled that entire function will be deleted anyway so hopefully this is only for the short term.

    Reviewers: RKSimon, spatel

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55459 (detail)
    by ctopper
  653. [llvm-exegesis] Optimize ToProcess in dbScan

    Summary:
    Use `vector<char> Added + vector<size_t> ToProcess` to replace `SetVector ToProcess`

    We also check `Added[P]` to enqueueing a point more than once, which
    also saves us a `ClusterIdForPoint_[Q].isUndef()` check.

    Reviewers: courbet, RKSimon, gchatelet, john.brawn, lebedev.ri

    Subscribers: tschuett, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54442 (detail)
    by maskray
  654. [ThinLTO] Fix test added in rL349076 (detail)
    by maskray
  655. [sanitizer] Fix nolibc internal_sleep

    Reviewers: kubamracek, vitalybuka

    Reviewed By: vitalybuka

    Subscribers: delcypher, llvm-commits, #sanitizers

    Differential Revision: https://reviews.llvm.org/D55692 (detail)
    by maskray
  656. [Object] Rename getRelrRelocationType to getRelativeRelocationType

    Summary:
    The two utility functions were added in D47919 to support SHT_RELR.
    However, these are just relative relocations types and are't
    necessarily be named Relr.

    Reviewers: phosek, dberris

    Reviewed By: dberris

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55691 (detail)
    by maskray
  657. [clang-tidy] Remove extra config.h includes

    It's included in a new header ClangTidyForceLinker.h and should not
    be included the second time.

    Follow up for the https://reviews.llvm.org/D55595 (detail)
    by yvvan
  658. [clang-tidy] Share the forced linking code between clang-tidy tool and plugin

    Extract code that forces linking to the separate header and include it in both plugin and standalone tool.
    Try 2: missing header guard and "clang/Config/config.h" are added to the new header.

    Differential Revision: https://reviews.llvm.org/D55595 (detail)
    by yvvan
  659. [llvm-xray] Use correct variable name

    This fixes the compiler error introduced in r349129. (detail)
    by phosek
  660. [llvm-xray] Store offset pointers in temporaries

    DataExtractor::getU64 modifies the OffsetPtr which also pass to
    RelocateOrElse which breaks on Windows. This addresses the issue
    introduced in r349120.

    Differential Revision: https://reviews.llvm.org/D55689 (detail)
    by phosek
  661. Update google benchmark again (detail)
    by ericwf
  662. Update google benchmark version (detail)
    by ericwf
  663. Fix up diagnostics.

    Move some diagnostics around between Diagnostic*Kinds.td files.  Diagnostics
    used in multiple places were moved to DiagnosticCommonKinds.td.  Diagnostics
    listed in the wrong place (ie, Sema diagnostics listed in
    DiagnosticsParseKinds.td) were moved to the correct places.  One diagnostic
    split into two so that the diagnostic string is in the .td file instead of in
    code.  Cleaned up the diagnostic includes after all the changes. (detail)
    by rtrieu
  664. [gn build] Merge r348963 and r349076 (detail)
    by nico
  665. [clang-tidy] Improve google-objc-function-naming diagnostics 📙

    Summary:
    The diagnostics from google-objc-function-naming check will be more
    actionable if they provide a brief description of the requirements from
    the Google Objective-C style guide. The more descriptive diagnostics may
    help clarify that functions in the global namespace must have an
    appropriate prefix followed by Pascal case (engineers working previously
    with static functions might not immediately understand the different
    requirements of static and non-static functions).

    Test Notes:
    Verified against the clang-tidy tests.

    Reviewers: benhamilton, aaron.ballman

    Reviewed By: benhamilton

    Subscribers: MyDeveloperDay, xazax.hun, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55482 (detail)
    by stephanemoore
  666. Revert "[clang-tidy] Share the forced linking code between clang-tidy tool and plugin"

    This reverts commit r349038 as it was causing test failures:

    http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/22185
    http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40886 (detail)
    by dyung
  667. [llvm-xray] Support for PIE

    When the instrumented binary is linked as PIE, we need to apply the
    relative relocations to sleds. This is handled by the dynamic linker
    at runtime, but when processing the file we have to do it ourselves.

    Differential Revision: https://reviews.llvm.org/D55542 (detail)
    by phosek
  668. [macho] save the SDK version stored in module metadata into the version min and
    build version load commands in the object file

    This commit introduces a new metadata node called "SDK Version". It will be set
    by the frontend to mark the platform SDK (macOS/iOS/etc) version which was used
    during that particular compilation.
    This node is used when machine code is emitted, by either saving the SDK version
    into the appropriate macho load command (version min/build version), or by
    emitting the assembly for these load commands with the SDK version specified as
    well.
    The assembly for both load commands is extended by allowing it to contain the
    sdk_version X, Y [, Z] trailing directive to represent the SDK version
    respectively.

    rdar://45774000

    Differential Revision: https://reviews.llvm.org/D55612 (detail)
    by arphaman
  669. Revert "Try to update the test to fix the breakage With the new warning, we are showing one more output in the test."

    This reverts commit r349064.

    This wasn't updating the right test.  Causing (not the different line number
    from the previous revert):

    ======================================================================
    FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py", line 18, in test_diagnostic_warning
        self.assertEqual(len(tu.diagnostics), 2)
    AssertionError: 1 != 2 (detail)
    by anemet
  670. Revert "Make -Wstring-plus-int warns even if when the result is not out of bounds"

    This reverts commit r349054.

    It's causing:

    FAILED: tools/clang/bindings/python/tests/CMakeFiles/check-clang-python
    FAIL: test_diagnostic_range (tests.cindex.test_diagnostics.TestDiagnostics)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File
      "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
      line 55, in test_diagnostic_range
          self.assertEqual(len(tu.diagnostics), 1)
          AssertionError: 2 != 1

    ======================================================================
    FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File
      "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
      line 18, in test_diagnostic_warning
          self.assertEqual(len(tu.diagnostics), 2)
          AssertionError: 1 != 2 (detail)
    by anemet
  671. Windows ASan: Instrument _msize_base()

    Summary:
    A recent update to the VS toolchain in chromium [1] broke the windows
    ASan bot because the new toolchain calls _msize_base() instead of
    _msize() in a number of _aligned_* UCRT routines. Instrument
    _msize_base() as well.

    [1] https://crbug.com/914947

    Reviewers: rnk, #sanitizers, vitalybuka

    Reviewed By: rnk, #sanitizers, vitalybuka

    Subscribers: vitalybuka, kubamracek, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55684 (detail)
    by vlad.tsyrklevich
  672. [Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for MS compatibility. Remove declarations from intrin.h and implementations from lzcntintrin.h

    intrin.h had forward declarations for these and lzcntintrin.h had implementations that were only available with -mlzcnt or a -march that supported the lzcnt feature.

    For MS compatibility we should always have these builtins available regardless of X86 being the target or the CPU support the lzcnt instruction. The backends should be able to gracefully fallback to something support even if its just shifts and bit ops.

    Unfortunately, gcc also implements 2 of the 3 function names here on X86 when lzcnt feature is enabled.

    This patch adds builtins for these for MSVC compatibility and drops the forward declarations from intrin.h. To keep the gcc compatibility the two intrinsics that collided have been turned into macros that use the X86 specific builtins with the lzcnt feature check. These macros are only defined when _MSC_VER is not defined. Without them being macros we can get a redefinition error because -ms-extensions doesn't seem to set _MSC_VER but does make the MS builtins available.

    Should fix PR40014

    Differential Revision: https://reviews.llvm.org/D55677 (detail)
    by ctopper
  673. Silence CMP0048 warning in the benchmark utility library

    I'm testing this in LLVM before sending it upstream.

    Part of PR38874 (detail)
    by rnk
  674. [gn build] Add infrastructure to create symlinks and use it to create lld's symlinks

    This is slightly involved, see the comments in the code.

    The GN build now builds a functional lld!

    Differential Revision: https://reviews.llvm.org/D55606 (detail)
    by nico
  675. [DAGCombiner] clean up visitEXTRACT_VECTOR_ELT

    This isn't quite NFC, but I don't know how to expose
    any outward diffs from these changes. Mostly, this
    was confusing because it used 'VT' to refer to the
    operand type rather the usual type of the input node.

    There's also a large block at the end that is dedicated
    solely to matching loads, but that wasn't obvious. This
    could probably be split up into separate functions to
    make it easier to see.

    It's still not clear to me when we make certain transforms
    because the legality and constant conditions are
    intertwined in a way that might be improved. (detail)
    by spatel
  676. [X86] Demote EmitTest to a helper function of EmitCmp. Route all callers except EmitCmp through EmitCmp.

    This requires the two callers to manifest a 0 to make EmitCmp call EmitTest.

    I'm looking into changing how we combine TEST and flag setting instructions to not be part of lowering. And instead be part of DAG combine or isel. Which will mean EmitTest will probably become gutted and maybe disappear entirely. (detail)
    by ctopper
  677. Revert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"

    Breaks sanitizer-android buildbot.

    This reverts commit 85e02baff327e7b67ea5b47897302901abb2aa5d. (detail)
    by eugenis
  678. Revert "[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"

    Breaks sanitizer-android buildbot.

    This reverts commit af8443a984c3b491c9ca2996b8d126ea31e5ecbe. (detail)
    by eugenis
  679. [AArch64] Fix Exynos predicates (NFC)

    Fix the logic in the definition of the `ExynosShiftExPred` as a more
    specific version of `ExynosShiftPred`.  But, since `ExynosShiftExPred` is
    not used yet, this change has NFC. (detail)
    by evandro
  680. [SampleFDO] handle ProfileSampleAccurate when initializing function entry count

    ProfileSampleAccurate is used to indicate the profile has exact match to the
    code to be optimized.

    Previously ProfileSampleAccurate is handled in ProfileSummaryInfo::isColdCallSite
    and ProfileSummaryInfo::isColdBlock. A better solution is to initialize function
    entry count to 0 when ProfileSampleAccurate is true, so we don't have to handle
    ProfileSampleAccurate in multiple places.

    Differential Revision: https://reviews.llvm.org/D55660 (detail)
    by wmi
  681. [CUDA] Make all host-side shadows of device-side variables undef.

    The host-side code can't (and should not) access the values that may
    only exist on the device side. E.g. address of a __device__ function
    does not exist on the host side as we don't generate the code for it there.

    Differential Revision: https://reviews.llvm.org/D55663 (detail)
    by tra
  682. Attempt to fix code completion test to handle LLP64 platforms (detail)
    by rnk
  683. Fix test after -Wstring-plus-int warning was enabled

    Use array indexing instead of addition. (detail)
    by rnk
  684. Revert r348971: [AMDGPU] Support for "uniform-work-group-size" attribute

    This patch breaks RADV (and probably RadeonSI as well) (detail)
    by aakanksha555
  685. Fix debug-info-abspath.c on Windows by removing /tmp/t.o line

    This object seemed unused, so I believe we can just remove this compiler
    invocation without losing any test coverage. (detail)
    by rnk
  686. Update the scan-build to generate SARIF.

    This updates the scan-build perl script to allow outputting to sarif in a more natural fashion by specifying -sarif as a command line argument, similar to how -plist is already supported. (detail)
    by aaronballman
  687. AMDGPU/GlobalISel: Legalize/regbankselect block_addr (detail)
    by arsenm
  688. [libc++] Fix _LIBCPP_EXPORTED_FROM_ABI when visibility annotations are disabled

    Fixes a bug where functions would get exported when building with
    -fvisibility=hidden and defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS. No
    visibility annotations should be added in this case.

    The new logic for _LIBCPP_EXPORTED_FROM_ABI matches that of the other visibility
    annotations around it.

    Differential Revision: https://reviews.llvm.org/D55664 (detail)
    by thomasanderson
  689. Reapply "[MemCpyOpt] memset->memcpy forwarding with undef tail"

    Currently memcpyopt optimizes cases like

        memset(a, byte, N);
        memcpy(b, a, M);

    to

        memset(a, byte, N);
        memset(b, byte, M);

    if M <= N. Often this allows further simplifications down the line,
    which drop the first memset entirely.

    This patch extends this optimization for the case where M > N, but we
    know that the bytes a[N..M] are undef due to alloca/lifetime.start.

    This situation arises relatively often for Rust code, because Rust does
    not initialize trailing structure padding and loves to insert redundant
    memcpys. This also fixes https://bugs.llvm.org/show_bug.cgi?id=39844.

    The previous version of this patch did not perform dependency checking
    properly: While the dependency is checked at the position of the memset,
    the used size must be that of the memcpy. Previously the size of the
    memset was used, which missed modification in the region
    MemSetSize..CopySize, resulting in miscompiles. The added tests cover
    variations of this issue.

    Differential Revision: https://reviews.llvm.org/D55120 (detail)
    by nikic
  690. Implement a small subset of the C++ `type_traits` header inside sanitizer_common so we can avoid depending on system C++ headers.

    Summary:
    In particular we implement the `is_same<T,U>` templated type. This is
    useful for doing compile-time comparison of types in `static_assert`s.
    The plan is to use this in another patch (
    https://reviews.llvm.org/D54904 ).

    Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

    Subscribers: mgorny, #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54951 (detail)
    by delcypher
  691. [ThinLTO] Compute synthetic function entry count

    Summary:
    This patch computes the synthetic function entry count on the whole
    program callgraph (based on module summary) and writes the entry counts
    to the summary. After function importing, this count gets attached to
    the IR as metadata. Since it adds a new field to the summary, this bumps
    up the version.

    Reviewers: tejohnson

    Subscribers: mehdi_amini, inglorion, llvm-commits

    Differential Revision: https://reviews.llvm.org/D43521 (detail)
    by eraman
  692. [llvm] Address base discriminator overflow in X86DiscriminateMemOps

    Summary:
    Macros are expanded on a single line. In case of large expansions,
    with sufficiently many instructions with memory operands (and when
    -fdebug-info-for-profiling is requested), we may be unable to generate
    new base discriminator values - new values overflow (base
    discriminators may not be larger than 2^12).

    This CL warns instead of asserting in such a case. A subsequent CL
    will add APIs to check for overflow before creating new debug info.

    See https://bugs.llvm.org/show_bug.cgi?id=39890

    Reviewers: davidxl, wmi, gbedwell

    Reviewed By: davidxl

    Subscribers: aprantl, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55643 (detail)
    by mtrofin
  693. [llvm-size][libobject] Add explicit "inTextSegment" methods similar to "isText" section methods to calculate size correctly.

    Summary:
    llvm-size uses "isText()" etc. which seem to indicate whether the section contains code-like things, not whether or not it will actually go in the text segment when in a fully linked executable.

    The unit test added (elf-sizes.test) shows some types of sections that cause discrepencies versus the GNU size tool. llvm-size is not correctly reporting sizes of things mapping to text/data segments, at least for ELF files.

    This fixes pr38723.

    Reviewers: echristo, Bigcheese, MaskRay

    Reviewed By: MaskRay

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54369 (detail)
    by rupprecht
  694. [clang-tidy] Add the abseil-duration-subtraction check

    Summary:
    This check uses the context of a subtraction expression as well as knowledge
    about the Abseil Time types, to infer the type of the second operand of some
    subtraction expressions in Duration conversions. For example:

       absl::ToDoubleSeconds(duration) - foo

    can become
       absl::ToDoubleSeconds(duration - absl::Seconds(foo))

    This ensures that time calculations are done in the proper domain, and also
    makes it easier to further deduce the types of the second operands to these
    expressions.

    Reviewed By: JonasToth

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D55245 (detail)
    by hwright
  695. [CostModel][X86] Don't count 2 shuffles on the last level of a pairwise arithmetic or min/max reduction

    This is split from D55452 with the correct patch this time.

    Pairwise reductions require two shuffles on every level but the last. On the last level the two shuffles are <1, u, u, u...> and <0, u, u, u...>, but <0, u, u, u...> will be dropped by InstCombine/DAGCombine as being an identity shuffle.

    Differential Revision: https://reviews.llvm.org/D55615 (detail)
    by ctopper
  696. [libcxx] Fix pop_back() tests to make sure they don't always just pass (detail)
    by Louis Dionne
  697. [CMake] llvm_codesign workaround for Xcode double-signing errors

    Summary:
    When using Xcode to build LLVM with code signing, the post-build rule is executed even if the actual build-step was skipped. This causes double-signing errors. We can currently only avoid it by passing the `--force` flag.

    Plus some polishing for my previous patch D54443.

    Reviewers: beanz, kubamracek

    Reviewed By: kubamracek

    Subscribers: #lldb, mgorny, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55116 (detail)
    by stefan.graenitz
  698. [LoopUtils] Use i32 instead of `void`.

    The actual type of the first argument of the @dbg intrinsic
    doesn't really matter as we're setting it to `undef`, but the
    bitcode reader is picky about `void` types. (detail)
    by davide
  699. Don't add unnecessary compiler flags to llvm-config output

    Summary:
    llvm-config --cxxflags --cflags, should only output the minimal flags
    required to link against the llvm libraries.  They currently contain
    all flags used to compile llvm including flags like -g, -pedantic,
    -Wall, etc, which users may not always want.

    This changes the llvm-config output to only include flags that have been
    explictly added to the COMPILE_FLAGS property of the llvm-config target
    by the llvm build system.

    llvm.org/PR8220

    Output from llvm-config when running cmake with:
    cmake -G Ninja .. -DCMAKE_CXX_FLAGS=-funroll-loops

    Before:

    --cppflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include
                -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
    --cflags:   -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include
                -fPIC -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings \
                -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough \
                -Wno-comment -fdiagnostics-color -g -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS \
                -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
    --cxxflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include\
                -funroll-loops -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall \
                -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers \
                -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized \
                -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment \
                -fdiagnostics-color -g  -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG \
                -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"

    After:

    --cppflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include \
                -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
    --cflags:   -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include \
                -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
    --cxxflags: -I$HEADERS_DIR/llvm/include -I$HEADERS_DIR/llvm/build/include \
                 -std=c++11   -fno-exceptions -fno-rtti \
                 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

    Reviewers: sylvestre.ledru, infinity0, mgorny

    Reviewed By: sylvestre.ledru, mgorny

    Subscribers: mgorny, dmgreen, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55391 (detail)
    by tstellar
  700. Correctly handle skewed streams in drop_front() method.

    When calling BinaryStreamArray::drop_front(), if the stream
    is skewed it means we must never drop the first bytes of the
    stream since offsets which occur in records assume the existence
    of those bytes.  So if we want to skip the first record in a
    stream, then what we really want to do is just set the begin
    pointer to the next record.  But we shouldn't actually remove
    those bytes from the underlying view of the data. (detail)
    by zturner
  701. Reinstate DW_AT_comp_dir support after D55519.

    The DIFile used by the CU is special and distinct from the main source
    file. Its directory part specifies what becomes the DW_AT_comp_dir
    (the compilation directory), even if the source file was specified
    with an absolute path.

    To support the .dwo workflow, a valid DW_AT_comp_dir is necessary even
    if source files were specified with an absolute path. (detail)
    by Adrian Prantl
  702. Try to update the test to fix the breakage
    With the new warning, we are showing one more output in the test. (detail)
    by sylvestre
  703. [CodeComplete] Adhere to LLVM naming style in CodeCompletionTest. NFC

    Also reuses the same var for multiple to reduce the chance of
    accidentally referecing the previous test. (detail)
    by ibiryukov
  704. [CodeComplete] Temporarily disable failing assertion

    Found the case in the clang codebase where the assertion fires.
    To avoid crashing assertion-enabled builds before I re-add the missing
    operation.
    Will restore the assertion alongside the upcoming fix. (detail)
    by ibiryukov
  705. [MachO][TLOF] Add support for local symbols in the indirect symbol table

    On 32-bit archs, before, we would assume that an indirect symbol will
    never have local linkage. This can lead to miscompiles where the
    symbol's value would be 0 and the linker would use that value, because
    the indirect symbol table would contain the value
    `INDIRECT_SYMBOL_LOCAL` for that specific symbol.

    Differential Revision: https://reviews.llvm.org/D55573 (detail)
    by thegameg
  706. Fix CodeCompleteTest.cpp for older gcc plus ccache builds

    Some versions of gcc, especially when invoked through ccache (-E), can have
    trouble with raw string literals inside macros. This moves the string out of
    the macro. (detail)
    by dmgreen
  707. [DAGCombiner] after simplifying demanded elements of vector operand of extract, revisit the extract; 2nd try

    This is a retry of rL349051 (reverted at rL349056). I changed the check for dead-ness from
    number of uses to an opcode test for DELETED_NODE based on existing similar code.

    Differential Revision: https://reviews.llvm.org/D55655 (detail)
    by spatel
  708. [X86][SSE] Add SSE vector imm/var shift support to SimplifyDemandedVectorEltsForTargetNode (detail)
    by rksimon
  709. revert rL349051: [DAGCombiner] after simplifying demanded elements of vector operand of extract, revisit the extract

    This causes an address sanitizer bot failure:
    http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/27187/steps/check-llvm%20asan/logs/stdio (detail)
    by spatel
  710. Recommit r349041: [tblgen][disasm] Separate encodings from instructions

    Removed const from the ArrayRef<const EncodingAndInst> to avoid the
    std::vector<const EncodingAndInst> that G++ saw (detail)
    by dsanders
  711. Make -Wstring-plus-int warns even if when the result is not out of bounds

    Summary: Patch by Arnaud Bienner

    Reviewers: sylvestre.ledru, thakis

    Reviewed By: thakis

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55382 (detail)
    by sylvestre
  712. [CodeComplete] Fill preferred type on binary expressions

    Reviewers: kadircet

    Reviewed By: kadircet

    Subscribers: arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55648 (detail)
    by ibiryukov
  713. [X86][SSE] Fix all remaining modulo vector rotation amounts (PR38243)

    There's still a couple of minor SimplifyDemandedElts regressions in some of the shift amount splats that will be fixed in future patches. (detail)
    by rksimon
  714. [DAGCombiner] after simplifying demanded elements of vector operand of extract, revisit the extract

    Differential Revision: https://reviews.llvm.org/D55655 (detail)
    by spatel
  715. [CodeComplete] Set preferred type to bool on conditions

    Reviewers: kadircet

    Reviewed By: kadircet

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55431 (detail)
    by ibiryukov
  716. [clangd] Enable cross-namespace completions by default in clangd

    Summary:
    Code completion will suggest symbols from any scope (incl. inaccessible
    scopes) when there's no qualifier explicitly specified. E.g.
    {F7689815}

    As we are assigning relatively low scores for cross-namespace completion items, the overall code completion quality doesn't regress. The feature has been tried out by a few folks, and the feedback is generally positive, so I think it should be ready to be enabled by default.

    Reviewers: hokein, ilya-biryukov, kadircet

    Reviewed By: hokein, ilya-biryukov

    Subscribers: MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55649 (detail)
    by ioeric
  717. [Sparc] Add membar assembler tags

    Summary: The Sparc V9 membar instruction can enforce different types of
    memory orderings depending on the value in its immediate field.  In the
    architectural manual the type is selected by combining different assembler
    tags into a mask. This patch adds support for these tags.

    Reviewers: jyknight, venkatra, brad

    Reviewed By: jyknight

    Subscribers: fedor.sergeev, jrtc27, jfb, llvm-commits

    Differential Revision: https://reviews.llvm.org/D53491 (detail)
    by dcederman
  718. [X86][SSE] Fix modulo rotation amounts for v8i16/v16i16/v4i32 (PR38243) (detail)
    by rksimon
  719. Revert r349041: [tblgen][disasm] Separate encodings from instructions

    One of the GCC based bots is objecting to a vector of const EncodingAndInst's:
    In file included from /usr/include/c++/8/vector:64,
                     from /export/users/atombot/llvm/clang-atom-d525-fedora-rel/llvm/utils/TableGen/CodeGenInstruction.h:22,
                     from /export/users/atombot/llvm/clang-atom-d525-fedora-rel/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp:15:
    /usr/include/c++/8/bits/stl_vector.h: In instantiation of 'class std::vector<const {anonymous}::EncodingAndInst, std::allocator<const {anonymous}::EncodingAndInst> >':
    /export/users/atombot/llvm/clang-atom-d525-fedora-rel/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp:375:32:   required from here
    /usr/include/c++/8/bits/stl_vector.h:351:21: error: static assertion failed: std::vector must have a non-const, non-volatile value_type
           static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/8/bits/stl_vector.h:354:21: error: static assertion failed: std::vector must have the same value_type as its allocator
           static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (detail)
    by dsanders
  720. [Sparc] Use float register for integer constrained with "f"  in inline asm

    Summary:
    Constraining an integer value to a floating point register using "f"
    causes an llvm_unreachable to trigger. This patch allows i32 integers
    to be placed in a single precision float register and i64 integers to
    be placed in a double precision float register. This matches the behavior
    of GCC.

    For other types the llvm_unreachable is removed to instead trigger an
    error message that points out the offending line.

    Reviewers: jyknight, venkatra

    Reviewed By: jyknight

    Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

    Differential Revision: https://reviews.llvm.org/D51614 (detail)
    by dcederman
  721. [PowerPC][NFC] Sorting out Pseudo related classes to avoid confusion

    There are several Pseudo in PowerPC backend.
    eg:

    * ISel Pseudo-instructions , which has let usesCustomInserter=1 in td
    ExpandISelPseudos -> EmitInstrWithCustomInserter will deal with them.
    * Post-RA pseudo instruction, which has let isPseudo = 1 in td, or Standard pseudo (SUBREG_TO_REG,COPY etc.)
    ExpandPostRAPseudos -> expandPostRAPseudo will expand them
    * Multi-instruction pseudo operations will expand them PPCAsmPrinter::EmitInstruction
    * Pseudo instruction in CodeEmitter, which has encoding of 0.

    Currently, in td files, especially PPCInstrVSX.td,
    we did not distinguish Post-RA pseudo instruction and Pseudo instruction in CodeEmitter very clearly.

    This patch is to

    * Rename Pseudo<> class to PPCEmitTimePseudo, which means encoding of 0 in CodeEmitter
    * Introduce new class PPCPostRAExpPseudo <> for previous PostRA Pseudo
    * Introduce new class PPCCustomInserterPseudo <> for previous Isel Pseudo

    Differential Revision: https://reviews.llvm.org/D55143 (detail)
    by jsji
  722. [mir] Fix uninitialized variable in r349035 noticed by clang-atom-d525-fedora-rel and 3 other bots (detail)
    by dsanders
  723. [Sanitizer] capsicum further support of the API

    Reviewers: vitalybuka, krytarowski, emaste

    Reviewed By: emaste

    Differential Revision: https://reviews.llvm.org/D55622 (detail)
    by David CARLIER
  724. [tblgen][disasm] Separate encodings from instructions

    Summary:
    Separate the concept of an encoding from an instruction. This will enable
    the definition of additional encodings for the same instruction which can
    be used to support variable length instruction sets in the disassembler
    (and potentially assembler but I'm not working towards that right now)
    without causing an explosion in the number of Instruction records that
    CodeGen then has to pick between.

    Reviewers: bogner, charukcs

    Reviewed By: bogner

    Subscribers: kparzysz, llvm-commits

    Differential Revision: https://reviews.llvm.org/D52366 (detail)
    by dsanders
  725. [X86][SSE] Merge the vXi16/vXi32 vector rotation expansion cases. NFCI.

    Merged the repeated code into a single if(). (detail)
    by rksimon
  726. [clang-tidy] Share the forced linking code between clang-tidy tool and plugin

    Extract code that forces linking to the separate header and include it in both plugin and standalone tool

    Differential Revision: https://reviews.llvm.org/D55595 (detail)
    by yvvan
  727. [SystemZ]  Pass copy-hinted regs first from getRegAllocationHints().

    When computing register allocation hints for a GRX32Bit register, make sure
    that any of the hinted registers that are also copy hints are returned first
    in the list.

    Review: Ulrich Weigand. (detail)
    by jonpa
  728. [mir] Serialize DILocation inline when not possible to use a metadata reference

    Summary:
    Sometimes MIR-level passes create DILocations that were not present in the
    LLVM-IR. For example, it may merge two DILocations together to produce a
    DILocation that points to line 0.

    Previously, the address of these DILocations were printed which prevented the
    MIR from being read back into LLVM. With this patch, DILocations will use
    metadata references where possible and fall back on serializing them inline like so:
        MOV32mr %stack.0.x.addr, 1, _, 0, _, %0, debug-location !DILocation(line: 1, scope: !15)

    Reviewers: aprantl, vsk, arphaman

    Reviewed By: aprantl

    Subscribers: probinson, llvm-commits

    Tags: #debug-info

    Differential Revision: https://reviews.llvm.org/D55243 (detail)
    by dsanders
  729. [X86][BWI] Don't custom lower vXi8 rotations.

    We always expand to shifts anyhow - test changes are just different scheduling only. (detail)
    by rksimon
  730. [clangd] Refine the way of checking a declaration is referenced by the written code.

    Summary:
    The previous solution (checking the AST) is not a reliable way to
    determine whether a declaration is explicitly referenced by the source
    code, we are still missing a few cases.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55191 (detail)
    by hokein
  731. [clangd] Avoid emitting Queued status when we are able to acquire the Barrier.

    Reviewers: ilya-biryukov

    Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55359 (detail)
    by hokein
  732. [clangd] Move the utility function to anonymous namespace, NFC. (detail)
    by hokein
  733. [NFC][PowerPC] add verify-machineinstrs check

    After rL349029 and rL348566, sj-ctr-loop.ll is ok for verify-machineinstrs check. (detail)
    by shchenz
  734. [PowerPC] intrinsic llvm.eh.sjlj.setjmp should not have flag isBarrier.

    Differential Revision: https://reviews.llvm.org/D55499 (detail)
    by shchenz
  735. [DAGCombine] Moved X86 rotate_amount % bitwidth == 0 early out to DAGCombiner

    Remove common code from custom lowering (code is still safe if somehow a zero value gets used). (detail)
    by rksimon
  736. [ARM GlobalISel] Support exts and truncs for Thumb2

    Mark G_SEXT, G_ZEXT and G_ANYEXT to 32 bits as legal and add support for
    them in the instruction selector. This uses handwritten code again
    because the patterns that are generated with TableGen are tuned for what
    the DAG combiner would produce and not for simple sext/zext nodes.
    Luckily, we only need to update the opcodes to use the Thumb2 variants,
    everything else can be reused from ARM. (detail)
    by rovka
  737. [TargetLowering] Add ISD::ROTL/ROTR vector expansion

    Move existing rotation expansion code into TargetLowering and set it up for vectors as well.

    Ideally this would share more of the funnel shift expansion, but we handle the shift amount modulo quite differently at the moment.

    Begun removing x86 vector rotate custom lowering to use the expansion. (detail)
    by rksimon
  738. [RISCV] Add support for the various RISC-V FMA instruction variants

    Adds support for the various RISC-V FMA instructions (fmadd, fmsub, fnmsub, fnmadd).

    The criteria for choosing whether a fused add or subtract is used, as well as
    whether the product is negated or not, is whether some of the arguments to the
    llvm.fma.* intrinsic are negated or not. In the tests, extraneous fadd
    instructions were added to avoid the negation being performed using a xor
    trick, which prevented the proper FMA forms from being selected and thus
    tested.

    The FMA instruction patterns might seem incorrect (e.g., fnmadd: -rs1 * rs2 -
    rs3), but they should be correct. The misleading names were inherited from
    MIPS, where the negation happens after computing the sum.

    The llvm.fmuladd.* intrinsics still do not generate RISC-V FMA instructions,
    as that depends on TargetLowering::isFMAFasterthanFMulAndFAdd.

    Some comments in the test files about what type of instructions are there
    tested were updated, to better reflect the current content of those test
    files.

    Differential Revision: https://reviews.llvm.org/D54205
    Patch by Luís Marques. (detail)
    by asb
  739. [AArch64] Catch some more CMN opportunities.

    Fixes https://bugs.llvm.org/show_bug.cgi?id=33486 (detail)
    by aadg
  740. Add a new interceptors for cdbr(3) and cdbw(3) API from NetBSD

    Summary:
    cdb - formats of the constant database.

    cdbr, cdbr_open, cdbr_open_mem, cdbr_entries, cdbr_get, cdbr_find,
    cdbr_close - constant database access methods.

    cdbw_open, cdbw_put, cdbw_put_data, cdbw_put_key, cdbw_stable_seeder,
    cdbw_output, cdbw_close - creates constant databases.

    Add a dedicated test for this API.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55167 (detail)
    by kamil
  741. [OpenCL] Add generic AS to 'this' pointer

    Address spaces are cast into generic before invoking the constructor.

    Added support for a trailing Qualifiers object in FunctionProtoType.

    Note: This recommits the previously reverted patch,
          but now it is commited together with a fix for lldb.

    Differential Revision: https://reviews.llvm.org/D54862 (detail)
    by mikael
  742. Add new interceptors for vis(3) API in NetBSD

    Summary:
    Add interceptors for the NetBSD style of vis(3) present inside libc:

    - vis
    - nvis
    - strvis
    - stravis
    - strnvis
    - strvisx
    - strnvisx
    - strenvisx
    - svis
    - snvis
    - strsvis
    - strsnvis
    - strsvisx
    - strsnvisx
    - strsenvisx
    - unvis
    - strunvis
    - strnunvis
    - strunvisx
    - strnunvisx

    Add a dedicated test verifying the installed interceptors.

    Based on original work by Yang Zheng.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54594 (detail)
    by kamil
  743. [CodeGen] Allow mempcy/memset to generate small overlapping stores.

    Summary:
    All targets either just return false here or properly model `Fast`, so I
    don't think there is any reason to prevent CodeGen from doing the right
    thing here.

    Subscribers: nemanjai, javed.absar, eraman, jsji, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55365 (detail)
    by courbet
  744. [asan] Don't check ODR violations for particular types of globals

    Summary:
    private and internal: should not trigger ODR at all.
    unnamed_addr: current ODR checking approach fail and rereport false violation if
    a linker merges such globals
    linkonce_odr, weak_odr: could cause similar problems and they are already not
    instrumented for ELF.

    Reviewers: eugenis, kcc

    Subscribers: kubamracek, hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55621 (detail)
    by Vitaly Buka
  745. AMDGPU/GlobalISel: Legalize f64 fadd/fmul (detail)
    by arsenm
  746. Fix missing C++ mode comment in header (detail)
    by arsenm
  747. AMDGPU/GlobalISel: RegBankSelect some simple operations (detail)
    by arsenm
  748. AMDGPU/GlobalISel: Test cleanups

    Remove IR and registers sections (detail)
    by arsenm
  749. Portable Python script across Python version

    SocketServer has been renamed socketserver in Python3.

    Differential Revision: https://reviews.llvm.org/D55258 (detail)
    by serge_sans_paille
  750. Portable Python script across Python version

    Queue module as been renamed into queue in Python3

    Differential Revision: https://reviews.llvm.org/D55202 (detail)
    by serge_sans_paille
  751. Portable Python script across Python version

    Use higher-level and more compatible threading module to start a new thread.

    Differential Revision: https://reviews.llvm.org/D55259 (detail)
    by serge_sans_paille
  752. [X86] Remove assert leftover from when i1 was a legal type. Add more accurate assert. NFC (detail)
    by ctopper
  753. [AMDGPU] Fix build failure, second attempt

    Some compilers complain that variable is captured and some
    complain when it is not. Switch to [&]. (detail)
    by rampitec
  754. [AMDGPU] Fix build failure

    Fixed error 'lambda capture 'CondReg' is not required to be captured
    for this use'. (detail)
    by rampitec
  755. [clang] Add AST matcher for block expressions 🔍

    Summary:
    This change adds a new AST matcher for block expressions.

    Test Notes:
    Ran the clang unit tests.

    Reviewers: aaron.ballman

    Reviewed By: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55546 (detail)
    by stephanemoore
  756. [AMDGPU] Simplify negated condition

    Optimize sequence:

      %sel = V_CNDMASK_B32_e64 0, 1, %cc
      %cmp = V_CMP_NE_U32 1, %1
      $vcc = S_AND_B64 $exec, %cmp
      S_CBRANCH_VCC[N]Z
    =>
      $vcc = S_ANDN2_B64 $exec, %cc
      S_CBRANCH_VCC[N]Z

    It is the negation pattern inserted by DAGCombiner::visitBRCOND() in the
    rebuildSetCC().

    Differential Revision: https://reviews.llvm.org/D55402 (detail)
    by rampitec
  757. Revert r348645 - "[MemCpyOpt] memset->memcpy forwarding with undef tail"

    This revision caused trucated memsets for structs with padding. See:
    http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181210/610520.html (detail)
    by dlj
  758. Remove unused Args parameter from EmitFunctionBody, NFC (detail)
    by rnk
  759. [analyzer] RunLoopAutoreleaseLeakChecker: Come up with a test for r348822.

    Statement memoization was removed in r348822 because it was noticed to cause
    memory corruption. This was happening because a reference to an object
    in a DenseMap was used after being invalidated by inserting a new key
    into the map.

    This test case crashes reliably under ASan (i.e., when Clang is built with
    -DLLVM_USE_SANITIZER="Address") on at least some machines before r348822
    and doesn't crash after it. (detail)
    by dergachev
  760. [LoopUtils] Prefer a set over a map. NFCI. (detail)
    by davide
  761. [test] Add a set of test for constant folding deopt operands with CVP

    For anyone curious, the first test example is illustrative of a real code idiom produced by branching on the result of a three way comparison. (detail)
    by reames
  762. [Support] Fix FileNameLength passed to SetFileInformationByHandle

    The rename_internal function used for Windows has a minor bug where the
    filename length is passed as a character count instead of a byte count.
    Windows internally ignores this field, but other tools that hook NT
    api's may use the documented behavior:

    MSDN documentation specifying the size should be in bytes:
    https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_rename_info

    Patch by Ben Hillis.

    Differential Revision: https://reviews.llvm.org/D55624 (detail)
    by smeenai
  763. [libcxx] Add assertion in deque::pop_back when popping from an empty deque

    Also, add tests making sure that vector and deque both catch the problem
    when assertions are enabled. Otherwise, deque would segfault and vector
    would never terminate. (detail)
    by Louis Dionne
  764. [gn build] Fix defines define on Windows

    On Windows, we won't go into the `host_os != "win"` block, so `defines`
    won't have been defined, and we'll run into an undefined identifier
    error when we try to later append to it. Unconditionally define it at
    the start and append to it everywhere else.

    Differential Revision: https://reviews.llvm.org/D55617 (detail)
    by smeenai
  765. [globalisel] Add GISelChangeObserver::changingInstr()

    Summary:
    In addition to knowing that an instruction is changed. It's also useful to
    know when it's about to change. For example, it might print the instruction so
    you can track the changes in a debug log, it might remove it from some queue
    while it's being worked on, or it might want to change several instructions as
    a single transaction and act on all the changes at once.

    Added changingInstr() to all existing uses of changedInstr()

    Reviewers: aditya_nandakumar

    Reviewed By: aditya_nandakumar

    Subscribers: rovka, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55623 (detail)
    by dsanders
  766. Emit a proper diagnostic when attempting to forward inalloca arguments

    The previous assertion was relatively easy to trigger, and likely will
    be easy to trigger going forward. EmitDelegateCallArg is relatively
    popular.

    This cleanly diagnoses PR28299 while I work on a proper solution. (detail)
    by rnk
  767. [WebAssembly] Update dylink section parsing

    This updates the format of the dylink section in accordance with
    recent "spec" change:
      https://github.com/WebAssembly/tool-conventions/pull/77

    Differential Revision: https://reviews.llvm.org/D55609 (detail)
    by sbc
  768. [LoopDeletion] Update debug values after loop deletion.

    When loops are deleted, we don't keep track of variables modified inside
    the loops, so the DI will contain the wrong value for these.

    e.g.

    int b() {

    int i;
    for (i = 0; i < 2; i++)
      ;
    patatino();
    return a;
    -> 6 patatino();

    7     return a;
    8   }
    9   int main() { b(); }
    (lldb) frame var i
    (int) i = 0

    We mark instead these values as unavailable inserting a
    @llvm.dbg.value(undef to make sure we don't end up printing an incorrect
    value in the debugger. We could consider doing something fancier,
    for, e.g. constants, in the future.

    PR39868.
    rdar://problem/46418795)

    Differential Revision: https://reviews.llvm.org/D55299 (detail)
    by davide
  769. [InstCombine] Fix negative GEP offset evaluation for 32-bit pointers

    This fixes https://bugs.llvm.org/show_bug.cgi?id=39908.

    The evaluateGEPOffsetExpression() function simplifies GEP offsets for
    use in comparisons against zero, basically by converting X*Scale+Offset==0
    to X+Offset/Scale==0 if Scale divides Offset. However, before this is done,
    Offset is masked down to the pointer size. This results in incorrect
    results for negative Offsets, because we basically end up dividing the
    32-bit offset *zero* extended to 64-bit bits (rather than sign extended).

    Fix this by explicitly sign extending the truncated value.

    Differential Revision: https://reviews.llvm.org/D55449 (detail)
    by nikic
  770. [hwasan] Link ubsan_cxx to shared runtime library.

    Summary: This is needed for C++-specific ubsan and cfi error reporting to work.

    Reviewers: kcc, vitalybuka

    Subscribers: srhines, kubamracek, mgorny, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55589 (detail)
    by eugenis
  771. [llvm-objcopy] Change Segment::Type from uint64_t to uint32_t

    Summary:
    In both Elf{32,64}_Phdr, the field Elf{32,64}_World p_type is uint32_t.

    Also reorder the fields to be similar to Elf64_Phdr (which is different
    from Elf32_Phdr but quite similar).

    Reviewers: rupprecht, jhenderson, jakehehrlich, alexshap, espindola

    Reviewed By: rupprecht

    Subscribers: emaste, arichardson, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55618 (detail)
    by maskray
  772. Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)

    Summary:
    The TLS_SLOT_TSAN slot is available starting in N, but its location (8)
    is incompatible with the proposed solution for implementing ELF TLS on
    Android (i.e. bump ARM/AArch64 alignment to reserve an 8-word TCB).

    Instead, starting in Q, Bionic replaced TLS_SLOT_DLERROR(6) with
    TLS_SLOT_SANITIZER(6). Switch compiler-rt to the new slot.

    Reviewers: eugenis, srhines, enh

    Reviewed By: eugenis

    Subscribers: ruiu, srhines, kubamracek, javed.absar, kristof.beyls, delcypher, llvm-commits, #sanitizers

    Differential Revision: https://reviews.llvm.org/D55581 (detail)
    by rprichard
  773. [hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)

    Summary:
    The change is needed to support ELF TLS in Android. See D55581 for the
    same change in compiler-rt.

    Reviewers: srhines, eugenis

    Reviewed By: eugenis

    Subscribers: srhines, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55592 (detail)
    by rprichard
  774. Revert "Declares __cpu_model as dso local"

    This reverts r348978 (detail)
    by hhb
  775. [PhaseOrdering] add test for funnel shift (rotate); NFC

    As mentioned in D55604, there are 2 bugs here:
    1. The new pass manager is speculating wildly by default.
    2. The old pass manager is not converting this to funnel shift. (detail)
    by spatel
  776. [hwasan] Verify Android TLS slot at startup.

    Summary:
    Add a check that TLS_SLOT_TSAN / TLS_SLOT_SANITIZER, whichever
    android_get_tls_slot is using, is not conflicting with
    TLS_SLOT_DLERROR.

    Reviewers: rprichard, vitalybuka

    Subscribers: srhines, kubamracek, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55587 (detail)
    by eugenis
  777. Declares __cpu_model as dso local

    __builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local.

    Differential Revision: https://reviews.llvm.org/D53850 (detail)
    by hhb
  778. [AST] Store "UsesADL" information in CallExpr.

    Summary:
    Currently the Clang AST doesn't store information about how the callee of a CallExpr was found. Specifically if it was found using ADL.

    However, this information is invaluable to tooling. Consider a tool which renames usages of a function. If the originally CallExpr was formed using ADL, then the tooling may need to additionally qualify the replacement.
    Without information about how the callee was found, the tooling is left scratching it's head. Additionally, we want to be able to match ADL calls as quickly as possible, which means avoiding computing the answer on the fly.

    This patch changes `CallExpr` to store whether it's callee was found using ADL. It does not change the size of any AST nodes.


    Reviewers: fowles, rsmith, klimek, shafik

    Reviewed By: rsmith

    Subscribers: aaron.ballman, riccibruno, calabrese, titus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55534 (detail)
    by ericwf
  779. [globalisel] Rename GISelChangeObserver's erasedInstr() to erasingInstr() and related nits. NFC

    Summary:
    There's little of interest that can be done to an already-erased instruction.
    You can't inspect it, write it to a debug log, etc. It ought to be notification
    that we're about to erase it. Rename the function to clarify the timing of the
    event and reflect current usage.

    Also fixed one case where we were trying to print an erased instruction.

    Reviewers: aditya_nandakumar

    Reviewed By: aditya_nandakumar

    Subscribers: rovka, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55611 (detail)
    by dsanders
  780. [X86] Don't emit MULX by default with BMI2

    MULX has somewhat improved register allocation constraints compared to the legacy MUL instruction. Both output registers are encoded instead of fixed to EAX/EDX, but EDX is used as input. It also doesn't touch flags. Unfortunately, the encoding is longer.

    Prefering it whenever BMI2 is enabled is probably not optimal. Choosing it should somehow be a function of register allocation constraints like converting adds to three address. gcc and icc definitely don't pick MULX by default. Not sure what if any rules they have for using it.

    Differential Revision: https://reviews.llvm.org/D55565 (detail)
    by ctopper
  781. Fix for llvm-dwarfdump changes for subroutine types (detail)
    by dblaikie
  782. [test] [depr.c.headers] XFAIL uchar.h on NetBSD (detail)
    by mgorny
  783. [X86] Move stack folding test for MULX to a MIR test. Add a MULX32 case as well

    A future patch may stop using MULX by default so use MIR to ensure we're always testing MULX.

    Add the 32-bit case that we couldn't do in the 64-bit mode IR test due to it being promoted to a 64-bit mul. (detail)
    by ctopper
  784. [AMDGPU] Support for "uniform-work-group-size" attribute

    Updated the annotate-kernel-features pass to support the propagation of uniform-work-group attribute from the kernel to the called functions. Once this pass is run, all kernels, even the ones which initially did not have the attribute, will be able to indicate weather or not they have uniform work group size depending on the value of the attribute.

    Differential Revision: https://reviews.llvm.org/D50200 (detail)
    by aakanksha555
  785. Support: use internal `call_once` on PPC64le

    Use the replacement execute once threading support in LLVM for PPC64le.  It
    seems that GCC does not define `__ppc__` and so we would actually call out to
    the C++ runtime there which is not what the current code intended.  Check both
    `__ppc__` and `__PPC__`.  This avoids the need for checking the endianness.

    Thanks to nemanjai for the hint about GCC's behaviour and the fact that the
    reviewed condition could be simplified.

    Original patch by Sarvesh Tamba! (detail)
    by Saleem Abdulrasool
  786. Teach __builtin_unpredictable to work through implicit casts.

    The __builtin_unpredictable implementation is confused by any implicit
    casts, which happen in C++.  This patch strips those off so that
    if/switch statements now work with it in C++.

    Change-Id: I73c3bf4f1775cd906703880944f4fcdc29fffb0a (detail)
    by erichkeane
  787. [test] [filesystems] NetBSD can do symlink permissions too (detail)
    by mgorny
  788. [test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSD

    NetBSD also uses tv_sec==-1 as error status indicator, and does not
    support setting such a value. (detail)
    by mgorny
  789. [X86] Added missing constant pool checks. NFCI.

    So the extra checks in D55600 don't look like a regression. (detail)
    by rksimon
  790. DebugInfo/DWARF: Pretty print subroutine types

    Doesn't handle varargs and other fun things, but it's a start. (also
    doesn't print these strictly as valid C++ when it's a pointer to
    function, it'll print as "void(int)*" instead of "void (*)(int)") (detail)
    by dblaikie
  791. [AMDGPU] Emit MessagePack HSA Metadata for v3 code object

    Continue to present HSA metadata as YAML in ASM and when output by tools
    (e.g. llvm-readobj), but encode it in Messagepack in the code object.

    Differential Revision: https://reviews.llvm.org/D48179 (detail)
    by scott.linder
  792. DebugInfo/DWARF: Improve dumping of pointers to members ('int foo::*' rather than 'int*') (detail)
    by dblaikie
  793. DebugInfo/DWARF: Refactor type dumping to dump types, rather than DIEs that reference types

    This lays the foundation for dumping types not referenced by DW_AT_type
    attributes (in the near-term, that'll be DW_AT_containing_type for a
    DW_TAG_ptr_to_member_type - in the future, potentially dumping the
    pretty printed name next to the DW_TAG for the type, rather than only
    when the type is referenced from elsewhere) (detail)
    by dblaikie
  794. DebugInfo/DWARF: Refactor getAttributeValueAsReferencedDie to accept a DWARFFormValue

    Save searching for the attribute again when you already have the
    DWARFFormValue at hand. (detail)
    by dblaikie
  795. [X86] Emit SBB instead of SETCC_CARRY from LowerSELECT. Break false dependency on the SBB input.

    I'm hoping we can just replace SETCC_CARRY with SBB. This is another step towards that.

    I've explicitly used zero as the input to the setcc to avoid a false dependency that we've had with the SETCC_CARRY. I changed one of the patterns that used NEG to instead use an explicit compare with 0 on the LHS. We needed the zero anyway to avoid the false dependency. The negate would clobber its input register. By using a CMP we can avoid that which could be useful.

    Differential Revision: https://reviews.llvm.org/D55414 (detail)
    by ctopper
  796. Fix Wdocumentation warning. NFCI. (detail)
    by rksimon
  797. [ConstantFold] Use getMinSignedBits for APInt in isIndexInRangeOfArrayType.

    Indices for getelementptr can be signed so we should use
    getMinSignedBits instead of getActiveBits here. The function later calls
    getSExtValue to get the int64_t value, which also checks
    getMinSignedBits.

    This fixes  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11647.

    Reviewers: mssimpso, efriedma, davide

    Reviewed By: efriedma

    Differential Revision: https://reviews.llvm.org/D55536 (detail)
    by fhahn
  798. [X86] Added missing constant pool checks. NFCI.

    So the extra checks in D55600 don't look like a regression. (detail)
    by rksimon
  799. llvm-dwarfdump: Dump array dimensions in stringified type names (detail)
    by dblaikie
  800. [SelectionDAG] Add a generic isSplatValue function

    This patch introduces a generic function to determine whether a given vector type is known to be a splat value for the specified demanded elements, recursing up the DAG looking for BUILD_VECTOR or VECTOR_SHUFFLE splat patterns.

    It also keeps track of the elements that are known to be UNDEF - it returns true if all the demanded elements are UNDEF (as this may be useful under some circumstances), so this needs to be handled by the caller.

    A wrapper variant is also provided that doesn't take the DemandedElts or UndefElts arguments for cases where we just want to know if the SDValue is a splat or not (with/without UNDEFS).

    I had hoped to completely remove the X86 local version of this function, but I'm seeing some regressions in shift/rotate codegen that will take a little longer to fix and I hope to get this in sooner so I can continue work on PR38243 which needs more capable splat detection.

    Differential Revision: https://reviews.llvm.org/D55426 (detail)
    by rksimon
  801. [NVPTX] do not rely on cached subtarget info.
    If a module has function references, but no functions
    themselves, we may end up never calling runOnMachineFunction
    and therefore would never initialize nvptxSubtarget field
    which would eventually cause a crash.

    Instead of relying on nvptxSubtarget being initialized by
    one of the methods, retrieve subtarget info directly.

    Differential Revision: https://reviews.llvm.org/D55580 (detail)
    by tra
  802. Change CallGraph print to show the fully qualified name

    CallGraph previously would just show the normal name of a function,
    which gets really confusing when using it on large C++ projects.  This
    patch switches the printName call to a printQualifiedName, so that the
    namespaces are included.

    Change-Id: Ie086d863f6b2251be92109ea1b0946825b28b49a (detail)
    by erichkeane
  803. [LV] Fix signed/unsigned comparison warning. (detail)
    by meinersbur
  804. [gn build] Merge r348944 (detail)
    by nico
  805. [docs] Use correct ending quotes. (detail)
    by meinersbur
  806. [x86] allow 8-bit adds to be promoted by convertToThreeAddress() to form LEA

    This extends the code that handles 16-bit add promotion to form LEA to also allow 8-bit adds.
    That allows us to combine add ops with register moves and save some instructions. This is
    another step towards allowing add truncation in generic DAGCombiner (see D54640).

    Differential Revision: https://reviews.llvm.org/D55494 (detail)
    by spatel
  807. [gn build] Add all non-test build files for lld

    Version.inc.in processing has a potentially interesting part which I've punted
    on for now (LLD_REVISION and LLD_REPOSITORY are set to empty strings for now).

    lld now builds in the gn build. But no symlinks to it are created yet, so it
    can't be meaningfully run yet.

    Differential Revision: https://reviews.llvm.org/D55593 (detail)
    by nico
  808. [Unroll/UnrollAndJam/Vectorizer/Distribute] Add followup loop attributes.

    When multiple loop transformation are defined in a loop's metadata, their order of execution is defined by the order of their respective passes in the pass pipeline. For instance, e.g.

        #pragma clang loop unroll_and_jam(enable)
        #pragma clang loop distribute(enable)

    is the same as

        #pragma clang loop distribute(enable)
        #pragma clang loop unroll_and_jam(enable)

    and will try to loop-distribute before Unroll-And-Jam because the LoopDistribute pass is scheduled after UnrollAndJam pass. UnrollAndJamPass only supports one inner loop, i.e. it will necessarily fail after loop distribution. It is not possible to specify another execution order. Also,t the order of passes in the pipeline is subject to change between versions of LLVM, optimization options and which pass manager is used.

    This patch adds 'followup' attributes to various loop transformation passes. These attributes define which attributes the resulting loop of a transformation should have. For instance,

        !0 = !{!0, !1, !2}
        !1 = !{!"llvm.loop.unroll_and_jam.enable"}
        !2 = !{!"llvm.loop.unroll_and_jam.followup_inner", !3}
        !3 = !{!"llvm.loop.distribute.enable"}

    defines a loop ID (!0) to be unrolled-and-jammed (!1) and then the attribute !3 to be added to the jammed inner loop, which contains the instruction to distribute the inner loop.

    Currently, in both pass managers, pass execution is in a fixed order and UnrollAndJamPass will not execute again after LoopDistribute. We hope to fix this in the future by allowing pass managers to run passes until a fixpoint is reached, use Polly to perform these transformations, or add a loop transformation pass which takes the order issue into account.

    For mandatory/forced transformations (e.g. by having been declared by #pragma omp simd), the user must be notified when a transformation could not be performed. It is not possible that the responsible pass emits such a warning because the transformation might be 'hidden' in a followup attribute when it is executed, or it is not present in the pipeline at all. For this reason, this patche introduces a WarnMissedTransformations pass, to warn about orphaned transformations.

    Since this changes the user-visible diagnostic message when a transformation is applied, two test cases in the clang repository need to be updated.

    To ensure that no other transformation is executed before the intended one, the attribute `llvm.loop.disable_nonforced` can be added which should disable transformation heuristics before the intended transformation is applied. E.g. it would be surprising if a loop is distributed before a #pragma unroll_and_jam is applied.

    With more supported code transformations (loop fusion, interchange, stripmining, offloading, etc.), transformations can be used as building blocks for more complex transformations (e.g. stripmining+stripmining+interchange -> tiling).

    Reviewed By: hfinkel, dmgreen

    Differential Revision: https://reviews.llvm.org/D49281
    Differential Revision: https://reviews.llvm.org/D55288 (detail)
    by meinersbur
  809. [Driver] Add support for -fembed-bitcode for assembly file

    Summary:
    Handle -fembed-bitcode for assembly inputs. When the input file is
    assembly, write a marker as "__LLVM,__asm" section.

    Fix llvm.org/pr39659

    Reviewers: compnerd, dexonsmith

    Reviewed By: compnerd

    Subscribers: rjmccall, dblaikie, jkorous, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55525 (detail)
    by steven_wu
  810. Make clang::CallGraph look into template instantiations

    Clang's CallGraph analysis doesn't use the RecursiveASTVisitor's setting
    togo into template instantiations.  The result is that anything wanting
    to do call graph analysis ends up missing any template function calls.

    Change-Id: Ib4af44ed59f15d43f37af91622a203146a3c3189 (detail)
    by erichkeane
  811. [SampleFDO] Extend profile-sample-accurate option to cover isFunctionColdInCallGraph

    For SampleFDO, when a callsite doesn't appear in the profile, it will not be marked as cold callsite unless the option -profile-sample-accurate is specified.

    But profile-sample-accurate doesn't cover function isFunctionColdInCallGraph which is used to decide whether a function should be put into text.unlikely section, so even if the user knows the profile is accurate and specifies profile-sample-accurate, those functions not appearing in the sample profile are still not be put into text.unlikely section right now.

    The patch fixes that.

    Differential Revision: https://reviews.llvm.org/D55567 (detail)
    by wmi
  812. Basic: make `int_least64_t` and `int_fast64_t` match on Darwin

    The Darwin targets use `int64_t` and `uint64_t` to define the `int_least64_t`
    and `int_fast64_t` types.  The underlying type is actually a `long long`.  Match
    the types to allow the printf specifiers to work properly and have the compiler
    vended macros match the implementation on the target. (detail)
    by Saleem Abdulrasool
  813. [ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element types

    Summary:
    `memchr` and `memcmp` operate upon the character units of the object
    representation; that is, the `size_t` parameter expresses the number of
    character units. The constant folding implementation is updated in this
    patch to account for multibyte element types in the arrays passed to
    `memchr`/`memcmp` and, in the case of `memcmp`, to account for the
    possibility that the arrays may have differing element types (even when
    they are byte-sized).

    Actual inspection of the object representation is not implemented.
    Comparisons are done only between elements with the same object size;
    that is, `memchr` will fail when inspecting at least one character unit
    of a multibyte element. The integer types are assumed to have two's
    complement representation with 0 for `false`, 1 for `true`, and no
    padding bits.

    `memcmp` on multibyte elements will only be able to fold in cases where
    enough elements are equal for the answer to be 0.

    Various tests are added to guard against incorrect folding for cases
    that miscompile on some system or other prior to this patch. At the same
    time, the unsigned 32-bit `wchar_t` testing in
    `test/SemaCXX/constexpr-string.cpp` is restored.

    Reviewers: rsmith, aaron.ballman, hfinkel

    Reviewed By: rsmith

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55510 (detail)
    by hubert.reinterpretcast
  814. [AMDGPU] Extend the SI Load/Store optimizer to combine more things.

    I've extended the load/store optimizer to be able to produce dwordx3
    loads and stores, This change allows many more load/stores to be combined,
    and results in much more optimal code for our hardware.

    Differential Revision: https://reviews.llvm.org/D54042 (detail)
    by sheredom
  815. [mips] Enable using of integrated assembler in all cases. (detail)
    by atanasyan
  816. [mips] Enable using of integrated assembler in all cases. (detail)
    by atanasyan
  817. [AggressiveInstCombine] add tests for rotates with branch; NFC (detail)
    by spatel
  818. Remove TODO leftover from my devleopment branch

    Accidentially checked in a TODO line from r348899. This removes it.

    Change-Id: I74b59c0ecfe147af8a08dd7fd10893a4ca351d6d (detail)
    by erichkeane
  819. Revert "[OpenCL] Add generic AS to 'this' pointer"

    Reverting because the patch broke lldb. (detail)
    by mikael
  820. [CUDA][OPENMP][NVPTX]Improve logic of the debug info support.

    Summary:
    Added support for the -gline-directives-only option + fixed logic of the
    debug info for CUDA devices. If optimization level is O0, then options
    --[no-]cuda-noopt-device-debug do not affect the debug info level. If
    the optimization level is >O0, debug info options are used +
    --no-cuda-noopt-device-debug is used or no --cuda-noopt-device-debug is
    used, the optimization level for the device code is kept and the
    emission of the debug directives is used.
    If the opt level is > O0, debug info is requested +
    --cuda-noopt-device-debug option is used, the optimization is disabled
    for the device code + required debug info is emitted.

    Reviewers: tra, echristo

    Subscribers: aprantl, guansong, JDevlieghere, cfe-commits

    Differential Revision: https://reviews.llvm.org/D51554 (detail)
    by abataev
  821. [clang-fuzzer] Add explicit dependency on clangSerialization for clangHandleCXX after rC348907

    This library was breaking my -DBUILD_SHARED_LIBS=1 build. rC348915 seemed to miss this case.

    As this seems an "obvious" fix, I am committing without pre-commit review as
    per the LLVM developer policy. (detail)
    by asb
  822. [OpenCL] Add generic AS to 'this' pointer

    Address spaces are cast into generic before invoking the constructor.

    Added support for a trailing Qualifiers object in FunctionProtoType.

    Differential Revision: https://reviews.llvm.org/D54862 (detail)
    by mikael
  823. [TargetLowering] Add ISD::AND handling to SimplifyDemandedVectorElts

    If either of the operand elements are zero then we know the result element is going to be zero (even if the other element is undef).

    Differential Revision: https://reviews.llvm.org/D55558 (detail)
    by rksimon
  824. Regenerate knownbits test. NFCI.

    A future SimplifyDemandedBits patch will affect this code and I want to ensure the codegen diff is obvious. (detail)
    by rksimon
  825. [ASTImporter] Remove import of definition from GetAlreadyImportedOrNull

    Summary: a_sidorin

    Reviewers: a.sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53755 (detail)
    by martong
  826. [AMDGPU] Set metadata access for explicit section

    Summary:
    This patch provides a means to set Metadata section kind
    for a global variable, if its explicit section name is
    prefixed with ".AMDGPU.metadata."
    This could be useful to make the global variable go to
    an ELF section without any section flags set.

    Reviewers: dstuttard, tpr, kzhuravl, nhaehnle, t-tye

    Reviewed By: dstuttard, kzhuravl

    Subscribers: llvm-commits, arsenm, jvesely, wdng, yaxunl, t-tye

    Differential Revision: https://reviews.llvm.org/D55267 (detail)
    by Piotr Sobczak
  827. [lit]Add llvm-readelf to tool substitutions

    Reviewed by: rnk, alexsahp

    Differential Revision: https://reviews.llvm.org/D55564 (detail)
    by jhenderson
  828. [ARM GlobalISel] Select load/store for Thumb2

    Unfortunately we can't use TableGen for this because it doesn't yet
    support predicates on the source pattern root. Therefore, add a bit of
    handwritten code to the instruction selector to handle the most basic
    cases.

    Also mark them as legal and extract their legalizer test cases to a new
    test file. (detail)
    by rovka
  829. [OpenCL] Fix for TBAA information of pointer after addresspacecast

    Summary: When addresspacecast is generated resulting pointer should preserve TBAA information from original value.

    Reviewers: rjmccall, yaxunl, Anastasia

    Reviewed By: rjmccall

    Subscribers: asavonic, kosarev, cfe-commits, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55262 (detail)
    by asavonic
  830. [SystemZ]  Minor cleanup of SchedModels

    Some fixes of a few InstRWs for z13 and z14.

    Review: Ulrich Weigand (detail)
    by jonpa
  831. Add explicit dependency on clangSerialization after rC348911 (detail)
    by maskray
  832. Add explicit dependency on clangSerialization for a bunch of components to fix -DBUILD_SHARED_LIBS=on build

    This is a more thorough fix of rC348911.
    The story about -DBUILD_SHARED_LIBS=on build after rC348907 (Move PCHContainerOperations from Frontend to Serialization) is:

    1. libclangSerialization.so defines PCHContainerReader dtor, ...
    2. clangFrontend and clangTooling define classes inheriting from PCHContainerReader, thus their DSOs have undefined references on PCHContainerReader dtor
    3. Components depending on either clangFrontend or clangTooling cannot be linked unless they have explicit dependency on clangSerialization due to the default linker option -z defs. The explicit dependency could be avoided if libclang{Frontend,Tooling}.so had these undefined references.

    This patch adds the explicit dependency on clangSerialization to make them build. (detail)
    by maskray
  833. [mips] Use llvm-mc -triple option instead of combination of arch,target-abi,mcpu. NFC (detail)
    by atanasyan
  834. Fix compiler warning about unused variable [NFC] (detail)
    by uabelho
  835. [Intrinsic] Signed Fixed Point Multiplication Intrinsic

    Add an intrinsic that takes 2 signed integers with the scale of them provided
    as the third argument and performs fixed point multiplication on them.

    This is a part of implementing fixed point arithmetic in clang where some of
    the more complex operations will be implemented as intrinsics.

    Differential Revision: https://reviews.llvm.org/D54719 (detail)
    by leonardchan
  836. [CodeGen] Fix -DBUILD_SHARED_LIBS=on build after rC348907 (detail)
    by maskray
  837. [X86] Combine vpmovdw+vpacksswb into vpmovdb.

    This is similar to the combine we already have for vpmovdw+vpackuswb. (detail)
    by ctopper
  838. [X86] Add a few more fptosi test cases to demonstrate -x86-experimental-vector-widening legalization not combining vpacksswb+vpmovdw.

    We are able to combine vpackuswb+vpmovdw, but we didn't have packsswb+vpmovdw at the time that combine was added. (detail)
    by ctopper
  839. [gn build] Add build files for DebugInfo/{DWARF,PDB}, Option, ToolDrivers/llvm-lib, and WindowsManifest

    The diff in targets.gni is due to me running `gn format` on all .gn and .gni
    files.

    llvm_enable_dia_sdk is in a gni file because I'm going to have to read it when
    writing the lit invocations for check-llvm and check-lld. I've never had the
    DIA sdk installed locally so I never tested building with it enabled -- it
    probably doesn't Just Work and needs some path to diaguids.lib. We can finish
    that once somebody needs it.

    Differential Revision: https://reviews.llvm.org/D55591 (detail)
    by nico
  840. Move PCHContainerOperations from Frontend to Serialization

    Fix a layering violation.  Frontend depends on Serialization, so anything used
    by both should be in Serialization. (detail)
    by rtrieu
  841. [ConstantInt] Check active bits before calling getZExtValue.

    Without this check, we hit an assertion in getZExtValue, if the constant
    value does not fit into an uint64_t.

    As getZExtValue returns an uint64_t, should we update
    getAggregateElement to take an uin64_t as well?

    This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6109.

    Reviewers: efriedma, craig.topper, spatel

    Reviewed By: efriedma

    Differential Revision: https://reviews.llvm.org/D55547 (detail)
    by fhahn
  842. [gn build] Add build files for lib/LTO, lib/Linker, lib/Passes, lib/Transforms/{IPO,Instrumentation,ObjCARC}

    Differential Revision: https://reviews.llvm.org/D55553 (detail)
    by nico
  843. Implement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64

    lldb on Windows uses the ExecutionEngine for expression evaluation
    and hits the llvm_unreachable due to this relocation. Thus, implement
    the relocation and add a test to verify it's function. (detail)
    by lanza
  844. [gn build] Add build files for Target/X86/... and for tools/llc

    The tablegen setup for Target/X86 is a bit different from the CMake build: In
    the CMake build, Target/X86/CMakeLists.txt has a single tablegen target that
    does everything. But some of the generated files are only used privately by a
    subproject, so in the GN build some of the tablegen invocations are
    smaller-scoped, mostly for build cleanliness. (It helps also a tiny bit with
    build parallelism since now e.g. the cpp files in MCTargetDesc can build after
    just 3 .inc files are generated instead of being blocked on all 13. But it's
    not a big win, since things depending on Target still need to wait for all 11,
    even though all .inc file use is internal to lib/Target.)

    Also add a build file for llc, since now all its dependencies have build files.

    Differential Revision: https://reviews.llvm.org/D55524 (detail)
    by nico
  845. [codeview] Look through typedefs in getCompleteTypeIndex

    Summary:
    Any time a symbol record, whether it's S_UDT, S_LOCAL, or S_[GL]DATA32,
    references a record type, it should use the complete type index, even if
    there's a typedef in the way.

    Fixes the compiler part of PR39853.

    Reviewers: zturner, aganea

    Subscribers: hiraditya, arphaman, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55236 (detail)
    by rnk
  846. [GISel] Add parentheses to an assert because gcc is mean. (detail)
    by ctopper
  847. Replace Const-Member checking with non-recursive version.

    As reported in PR39946, these two implementations cause stack overflows
    to occur when a type recursively contains itself.  While this only
    happens when an incomplete version of itself is used by membership (and
    thus an otherwise invalid program), the crashes might be surprising.

    The solution here is to replace the recursive implementation with one
    that uses a std::vector as a queue.  Old values are kept around to
    prevent re-checking already checked types.

    Change-Id: I582bb27147104763d7daefcfee39d91f408b9fa8 (detail)
    by erichkeane
  848. Revert "debuginfo: Use symbol difference for CU length to simplify assembly reading/editing"

    Temporarily reverts commit r348806 due to strange asm compilation issues in certain modes (combination of asan+cuda+other things). Will provide repro soon. (detail)
    by rupprecht
  849. [coroutines] Improve suspend point simplification

    Summary:
    Enable suspend point simplification for cases where:
    * coro.save and coro.suspend are in different basic blocks
    * where there are intervening intrinsics

    Reviewers: modocache, tks2103, lewissbaker

    Reviewed By: modocache

    Subscribers: EricWF, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55160 (detail)
    by gornishanov
  850. [Debuginfo] Prevent CodeGenPrepare from dropping debuginfo references.

    This fixes PR39845. CodeGenPrepare employs a transactional model when
    performing optimizations, i.e. it changes the IR to attempt an optimization
    and rolls back the change when it finds the change inadequate. It is during
    the rollback that references to locals were dropped from debug value
    intrinsics. This patch reinstates debuginfo references during rollbacks.

    Reviewers: aprantl, vsk

    Differential Revision: https://reviews.llvm.org/D55396 (detail)
    by wolfgangp
  851. [ConstantFolding] Handle leading zero-size elements in load folding

    Struct types may have leading zero-size elements like [0 x i32], in
    which case the "real" element at offset 0 will not necessarily coincide
    with the 0th element of the aggregate. ConstantFoldLoadThroughBitcast()
    wants to drill down the element at offset 0, but currently always picks
    the 0th aggregate element to do so. This patch changes the code to find
    the first non-zero-size element instead, for the struct case.

    The motivation behind this change is https://github.com/rust-lang/rust/issues/48627.
    Rust is fond of emitting [0 x iN] separators between struct elements to
    enforce alignment, which prevents constant folding in this particular case.

    The additional tests with [4294967295 x [0 x i32]] check that we don't
    end up unnecessarily looping over a large number of zero-size elements
    of a zero-size array.

    Differential Revision: https://reviews.llvm.org/D55169 (detail)
    by nikic
  852. [GISel]: Add MachineIRBuilder support for passing in Flags while building

    https://reviews.llvm.org/D55516

    Add the ability to pass in flags to buildInstr calls. Currently no
    validation is performed but that can be easily performed based on the
    opcode (if necessary).

    Reviewed by: paquette. (detail)
    by aditya_nandakumar
  853. Revert r348889; it fails some tests.

    http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40784 (detail)
    by aaronballman
  854. Stop stripping comments from AST matcher example code.

    The AST matcher documentation dumping script was being a bit over-zealous about stripping comment markers, which ended up causing comments in example code to stop being comments. Fix that by only stripping comments at the start of a line, rather than removing any forward slash (which also impacts prose text). (detail)
    by aaronballman
  855. Emit -Wformat properly for bit-field promotions.

    Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C. (detail)
    by aaronballman
  856. [Sanitizer] Expand FSEEK interception to FreeBSD

    Reviewers: krytarowski

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55556 (detail)
    by David CARLIER
  857. [NewPM] fixing asserts on deleted loop in -print-after-all

    IR-printing AfterPass instrumentation might be called on a loop
    that has just been invalidated. We should skip printing it to
    avoid spurious asserts.

    Reviewed By: chandlerc, philip.pfaffe
    Differential Revision: https://reviews.llvm.org/D54740 (detail)
    by fedor.sergeev
  858. [analyzer][CStringChecker] evaluate explicit_bzero


    - explicit_bzero has limited scope/usage only for security/crypto purposes but is non-optimisable version of memset/0 and bzero.
    - explicit_memset has similar signature and semantics as memset but is also a non-optimisable version.

    Reviewers: NoQ

    Reviewed By: NoQ

    Differential Revision: https://reviews.llvm.org/D54592 (detail)
    by David CARLIER
  859. [COFF, ARM64] Emit COFF function header

    Summary:
    Emit COFF header when printing out the function. This is important as the
    header contains two important pieces of information: the storage class for the
    symbol and the symbol type information. This bit of information is required for
    the linker to correctly identify the type of symbol that it is dealing with.

    This patch mimics X86 and ARM COFF behavior for function header emission.

    Reviewers: rnk, mstorsjo, compnerd, TomTan, ssijaric

    Reviewed By: mstorsjo

    Subscribers: dmajor, javed.absar, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55535 (detail)
    by mgrang
  860. [test] Permit NetBSD in filesystem_dynamic_test_helper.py (detail)
    by mgorny
  861. [libcxx] Only enable the availability LIT feature when we're testing libc++

    Other standard libraries don't implement availability markup, so it doesn't
    make sense to e.g. XFAIL tests based on availability markup outside of
    libc++. (detail)
    by Louis Dionne
  862. [HotColdSplitting] Disable outlining landingpad instructions (PR39917)

    It's currently not safe to outline landingpad instructions (see
    llvm.org/PR39917). Like @llvm.eh.typeid.for, the order and content of
    previous landingpad instructions in a function alters the lowering of
    subsequent landingpads by renumbering type info ID's. Outlining a
    landingpad therefore breaks exception handling & unwinding. (detail)
    by Vedant Kumar
  863. [XRay] Add a helper function sortByKey to simplify code

    Reviewers: dberris, mboerger

    Reviewed By: dberris

    Subscribers: mgrang, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55548 (detail)
    by maskray
  864. [libcxx] Remove the no_default_flags LIT configuration

    This is part of an ongoing cleanup of the LIT test suite, where I'm
    trying to reduce the number of configuration options. In this case,
    the original intent seemed to be running the test suite with libstdc++,
    but this is now supported by specifying cxx_stdlib_under_test=libstdc++. (detail)
    by Louis Dionne
  865. [NFC] Fix incorrect (but unreachable) LIT error message

    It is unreachable because we test that the cxx_stdlib_under_test is
    in the supported set of libraries elsewhere. Furthermore, this code
    relied on the `use_stdlib_type`, which is never defined. (detail)
    by Louis Dionne
  866. Remove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly. (detail)
    by Adrian Prantl
  867. Reuse code from CGDebugInfo::getOrCreateFile() when creating the file
    for the DICompileUnit.

    This addresses post-commit feedback for D55085. Without this patch, a
    main source file with an absolute paths may appear in different
    DIFiles, once with the absolute path and once with the common prefix
    between the absolute path and the current working directory.

    Differential Revision: https://reviews.llvm.org/D55519 (detail)
    by Adrian Prantl
  868. Pass PartialOverloading argument to the correct corresponding parameter (detail)
    by ericwf
  869. [ASan] Minor documentation fix: clarify static linking limitation.

    Summary:
    ASan does not support statically linked binaries, but ASan runtime itself can
    be statically linked into a target binary executable.

    Reviewers: eugenis, kcc

    Reviewed By: eugenis

    Subscribers: cfe-commits, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55066 (detail)
    by dor1s
  870. [InstCombine] try to convert x86 movmsk intrinsic to generic IR (PR39927)

    call iM movmsk(sext <N x i1> X) --> zext (bitcast <N x i1> X to iN) to iM

    This has the potential to create less-than-8-bit scalar types as shown in
    some of the test diffs, but it looks like the backend knows how to deal
    with that in these patterns. This is the simple part of the fix suggested in:
    https://bugs.llvm.org/show_bug.cgi?id=39927

    Differential Revision: https://reviews.llvm.org/D55529 (detail)
    by spatel
  871. [BDCE] Add tests for PR39771; NFC

    These involve cases where certain uses are dead by means of having
    no demanded bits, even though the used instruction still has demanded
    bits when other uses are taken into account. BDCE currently does not
    simplify such cases. (detail)
    by nikic
  872. Adding tests for -ast-dump; NFC.

    This adds tests for expressions in C++. (detail)
    by aaronballman
  873. [llvm-readelf] Add -e/--headers support to readobj/elf

    Differential Revision: https://reviews.llvm.org/D55298 (detail)
    by sidneym
  874. Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"

    This reverts commit rL348299. (detail)
    by stefanp
  875. Fix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare

    Summary:
    When doing X86CondBrFolding::analyzeCompare, it will meet the SUB32ri instruction as below to use the global address for its operand,
      %733:gr32 = SUB32ri %62:gr32(tied-def 0), @img2buf_normal, implicit-def $eflags
      JNE_1 %bb.41, implicit $eflags

    so the assertion "assert(MI.getOperand(ValueIndex).isImm() && "Expecting Imm operand")" is not correct and change the assert to if make X86CondBrFolding::analyzeCompare return false as not finding the compare for this

    Patch by Jianping Chen

    Reviewers: smaslov, LuoYuanke, liutianle, Jianping

    Reviewed By: Jianping

    Subscribers: lebedev.ri, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54250 (detail)
    by ctopper
  876. [x86] clean up code for converting 16-bit ops to LEA; NFC

    As discussed in D55494, we want to extend this to handle 8-bit
    ops too, but that could be extended further to enable this on
    32-bit systems too. (detail)
    by spatel
  877. [libcxx] Fix test failure on GCC 4.9

    GCC 4.9 seems to think that a constexpr default constructor implies
    the constructor to be noexcept. (detail)
    by Louis Dionne
  878. [analyzer] Fix a minor typo. (detail)
    by xazax
  879. [pair] Mark constructors as conditionally noexcept

    Summary:
    std::tuple marks its constructors as noexcept when the corresponding
    memberwise constructors are noexcept too -- this commit improves std::pair
    so that it behaves the same.

    This is a re-application of r348824, which broke the build in C++03 mode
    because a test was marked as supported in C++03 when it shouldn't be.

    Note:
    I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
    constructors because those are non-standard extensions, and supporting them
    properly is tedious (we have to copy the rvalue-referenceness of the deduced
    _Tuple&& onto the result of tuple_element).

    <rdar://problem/29537079>

    Reviewers: mclow.lists, EricWF

    Subscribers: christof, llvm-commits

    Differential Revision: https://reviews.llvm.org/D48669 (detail)
    by Louis Dionne
  880. [libcxx] Fix test on compilers that do not support char8_t yet (detail)
    by Louis Dionne
  881. [x86] remove dead code for 16-bit LEA formation; NFC

    As discussed in:
    D55494
    ...this code has been disabled/dead for a long time (the code references
    Athlon and Pentium 4), and there's almost no chance that it will be used
    given the last decade of uarch evolution. Also, in SDAG we promote 16-bit
    ops to 32-bit, so there's almost no way to test this code any more. (detail)
    by spatel
  882. Revert r348843 "[CodeGen] Allow mempcy/memset to generate small overlapping stores."

    Breaks ARM/memcpy-inline.ll (detail)
    by courbet
  883. [CodeGen] Allow mempcy/memset to generate small overlapping stores.

    Summary:
    All targets either just return false here or properly model `Fast`, so I
    don't think there is any reason to prevent CodeGen from doing the right
    thing here.

    Subscribers: nemanjai, javed.absar, eraman, jsji, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55365 (detail)
    by courbet
  884. Use the standard Duration factory matcher

    Summary: A new check came in over the weekend; it should use our existing infrastructure for matching `absl::Duration` factories.

    Patch by hwright.

    Reviewers: JonasToth

    Reviewed By: JonasToth

    Subscribers: astrelni

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D55541 (detail)
    by jonastoth
  885. Fix bug where we'd try symbolize a second time with the same arguments.

    Summary:
    Fix bug where we'd try symbolize a second time with the same arguments even though symbolization failed the first time.

    This looks like a long standing typo given that the guard for trying
    symbolization again is to only try it if symbolization failed using
    `binary` and `original_binary != binary`.

    Reviewers: kubamracek, glider, samsonov

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55504 (detail)
    by delcypher
  886. [clang-tidy] NFC Consolidate test absl::Time implementation

    Summary: Several tests re-implement these same prototypes (differently), so we can put them in a common location.

    Patch by hwright.

    Reviewers: JonasToth

    Reviewed By: JonasToth

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D55540 (detail)
    by jonastoth
  887. [TargetLowering] Add ISD::EXTRACT_VECTOR_ELT support to SimplifyDemandedBits

    Let SimplifyDemandedBits attempt to simplify all elements of a vector extraction.

    Part of PR39689. (detail)
    by rksimon
  888. Fix "not all control paths return a value" MSVC warnings. NFCI. (detail)
    by rksimon
  889. [DeadArgElim] Fixes for dbg.values using dead arg/return values

    Summary:
    When eliminating a dead argument or return value in a function with
    local linkage, all uses, including in dbg.value intrinsics, would be
    replaced with null constants. This would mean that, for example for an
    integer argument, the debug info would incorrectly express that the
    value is 0. Instead, replace all uses with undef to indicate that the
    argument/return value is optimized out.

    Also, make sure that metadata uses of return values are rewritten even
    if there are no non-metadata uses of the value.

    As a bit of historical curiosity, the code that emitted null constants
    was introduced in the initial check-in of the pass in 2003, before
    'undef' values even existed in LLVM.

    This fixes PR23260.

    Reviewers: dblaikie, aprantl, vsk, djtodoro

    Reviewed By: aprantl

    Subscribers: llvm-commits

    Tags: #debug-info

    Differential Revision: https://reviews.llvm.org/D55513 (detail)
    by dstenb
  890. Cleanup test case by removing unused attribute dso_local

    Attribute 'dso_local' generated in bitcode from compiling
    original C file but isn't needed.

    Differential Revision: https://reviews.llvm.org/D55521 (detail)
    by rsingh
  891. Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."

    Fix a dangling reference to temporary, never return nullptr. (detail)
    by courbet
  892. [X86] Switch the 64-bit mulx schedule test to use inline assembly.

    I'm not sure we should always prefer MULX over MUL. So making the MULX guaranteed with inline assembly. (detail)
    by ctopper
  893. Revert r348830 "[Sema]improve static_assert(!expr)"

    Submitted the wrong change. (detail)
    by courbet
  894. [Sema]improve static_assert(!expr) (detail)
    by courbet
  895. Fix problems with char8_t stuff on compilers that don't support char8_t yet (detail)
    by marshall
  896. Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308 (detail)
    by marshall
  897. Move CodeGenOptions from Frontend to Basic

    Basic uses CodeGenOptions and should not depend on Frontend. (detail)
    by rtrieu
  898. [PPC][NFC] store operands are dst not src

    Differential Revision: https://reviews.llvm.org/D55502 (detail)
    by martell
  899. Revert "[pair] Mark constructors as conditionally noexcept"

    This broke the tests on Linux. Reverting until I find out why the tests
    are broken (tomorrow). (detail)
    by Louis Dionne
  900. [pair] Mark constructors as conditionally noexcept

    Summary:
    std::tuple marks its constructors as noexcept when the corresponding
    memberwise constructors are noexcept too -- this commit improves std::pair
    so that it behaves the same.

    Note:
    I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
    constructors because those are non-standard extensions, and supporting them
    properly is tedious (we have to copy the rvalue-referenceness of the deduced
    _Tuple&& onto the result of tuple_element).

    <rdar://problem/29537079>

    Reviewers: mclow.lists, EricWF

    Subscribers: christof, llvm-commits

    Differential Revision: https://reviews.llvm.org/D48669 (detail)
    by Louis Dionne
  901. [gn build] Add build files for AsmParser, MIRParser, IRReader, MCDisassembler, Vectorize

    These are all remaining build dependencies of llc, except for Target/X86 which
    is in a separate patch at https://reviews.llvm.org/D55524

    Differential Revision: https://reviews.llvm.org/D55518 (detail)
    by nico
  902. [analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker

    Memoization dose not seem to be necessary, as other statement visitors
    run just fine without it,
    and in fact seems to be causing memory corruptions.
    Just removing it instead of investigating the root cause.

    rdar://45945002

    Differential Revision: https://reviews.llvm.org/D54921 (detail)
    by George Karpenkov
  903. [analyzer] Hack for backwards compatibility for options for RetainCountChecker.

    To be removed once the clients update. (detail)
    by George Karpenkov
  904. [analyzer] Display a diagnostics when an inlined function violates its os_consumed summary

    This is currently a diagnostics, but might be upgraded to an error in the future,
    especially if we introduce os_return_on_success attributes.

    rdar://46359592

    Differential Revision: https://reviews.llvm.org/D55530 (detail)
    by George Karpenkov
  905. [analyzer] Resolve another bug where the name of the leaked object was not printed properly

    Differential Revision: https://reviews.llvm.org/D55528 (detail)
    by George Karpenkov
  906. [WebAssembly] Add '.eventtype' directive support

    Summary:
    This patch supports `.eventtype` directive printing and parsing in the
    same syntax with `.functype`.

    Reviewers: aardappel, sbc100

    Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55353 (detail)
    by aheejin
  907. [TextAPI][elfabi] Make SoName optional

    This change makes DT_SONAME treated as an optional trait for ELF TextAPI
    stubs. This change accounts for the fact that shared objects aren't
    guaranteed to have a DT_SONAME entry. Tests have been updated to check
    for correct behavior of an optional soname.

    Differential Revision: https://reviews.llvm.org/D55533 (detail)
    by amontanez
  908. [WebAssembly] TargetStreamer cleanup (NFC)

    Summary:
    - Unify mixed argument names (`Symbol` and `Sym`) to `Sym`
    - Changed `MCSymbolWasm*` argument of `emit***` functions to `const
      MCSymbolWasm*`. It seems not very intuitive that emit function in the
      streamer modifies symbol contents.
    - Moved empty function bodies to the header
    - clang-format

    Reviewers: aardappel, dschuff, sbc100

    Subscribers: jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55347 (detail)
    by aheejin
  909. [GISel]: Refactor MachineIRBuilder to allow passing additional parameters to build Instrs

    https://reviews.llvm.org/D55294

    Previously MachineIRBuilder::buildInstr used to accept variadic
    arguments for sources (which were either unsigned or
    MachineInstrBuilder). While this worked well in common cases, it doesn't
    allow us to build instructions that have multiple destinations.
    Additionally passing in other optional parameters in the end (such as
    flags) is not possible trivially. Also a trivial call such as

    B.buildInstr(Opc, Reg1, Reg2, Reg3)
    can be interpreted differently based on the opcode (2defs + 1 src for
    unmerge vs 1 def + 2srcs).
    This patch refactors the buildInstr to

    buildInstr(Opc, ArrayRef<DstOps>, ArrayRef<SrcOps>)
    where DstOps and SrcOps are typed unions that know how to add itself to
    MachineInstrBuilder.
    After this patch, most invocations would look like

    B.buildInstr(Opc, {s32, DstReg}, {SrcRegs..., SrcMIBs..});
    Now all the other calls (such as buildAdd, buildSub etc) forward to
    buildInstr. It also makes it possible to build instructions with
    multiple defs.
    Additionally in a subsequent patch, we should make it possible to add
    flags directly while building instructions.
    Additionally, the main buildInstr method is now virtual and other
    builders now only have to override buildInstr (for say constant
    folding/cseing) is straightforward.

    Also attached here (https://reviews.llvm.org/F7675680) is a clang-tidy
    patch that should upgrade the API calls if necessary. (detail)
    by aditya_nandakumar
  910. Follow-up fix to r348811 for null Errors (which is the case for end iterators)

    Not sure how I missed that in my testing, but obvious enough - this
    causes segfaults when attempting to dereference the Error in end
    iterators. (detail)
    by dblaikie
  911. Add a version of std::function that includes a few optimizations in ABI V2.

    Patch by Jordan Soyke (jsoyke@google.com)
    Reviewed as D55045

    The result of running the benchmarks and comparing them can be found
    here: https://gist.github.com/EricWF/a77fd42ec87fc98da8039e26d0349498 (detail)
    by ericwf
  912. llvm-objcopy: Improve/simplify llvm::Error handling during notes iteration

    Using an Error as an out parameter from an indirect operation like
    iteration as described in the documentation (
    http://llvm.org/docs/ProgrammersManual.html#building-fallible-iterators-and-iterator-ranges
    ) seems to be a little fussy - so here's /one/ possible solution, though
    I'm not sure it's the right one.

    Alternatively such APIs may be better off being switched to a standard
    algorithm style, where they take a lambda to do the iteration work that
    is then called back into (eg: "Error e = obj.for_each_note([](const
    Note& N) { ... });"). This would be safer than having an unwritten
    assumption that the user of such an iteration cannot return early from
    the inside of the function - and must always exit through the gift
    shop... I mean error checking. (even though it's guaranteed that if
    you're mid-way through processing an iteration, it's not in an  error
    state).

    Alternatively we'd need some other (the super untrustworthy/thing we've
    generally tried to avoid) error handling primitive that actually clears
    the error state entirely so it's safe to ignore.

    Fleshed this solution out a bit further during review - it now relies on
    op==/op!= comparison as the equivalent to "if (Err)" testing the Error.
    So just like an Error must be checked (even if it's in a success state),
    the Error hiding in the iterator must be checked after each increment
    (including by comparison with another iterator - perhaps this could be
    constrained to only checking if the iterator is compared to the end
    iterator? Not sure it's too important).

    So now even just creating the iterator and not incrementing it at all
    should still assert because the Error has not been checked.

    Reviewers: lhames, jakehehrlich

    Differential Revision: https://reviews.llvm.org/D55235 (detail)
    by dblaikie
  913. Update test for instcombine change (detail)
    by arsenm
  914. [builtins] Remove trailing whitespaces, NFC

    Remove trailing whitespaces so that it is easier to diff the code between
    div{s,d,t}f3.c (detail)
    by kongyi
  915. debuginfo: Use symbol difference for CU length to simplify assembly reading/editing

    Mucking about simplifying a test case ( https://reviews.llvm.org/D55261 ) I stumbled across something I've hit before - that LLVM's (GCC's does too, FWIW) assembly output includes a hardcode length for a DWARF unit in its header. Instead we could emit a label difference - making the assembly easier to read/edit (though potentially at a slight (I haven't tried to observe it) performance cost of delaying/sinking the length computation into the MC layer).

    Reviewers: JDevlieghere, probinson, ABataev

    Differential Revision: https://reviews.llvm.org/D55281 (detail)
    by dblaikie
  916. [Local] Promote an utility that could be used elsewhere. NFCI. (detail)
    by davide
  917. Fix LLVM_LINK_LLVM_DYLIB build of TapiTests

    A dependency on TestingSupport was introduced in rL348735 but
    library was not incldued in the LLVM_LINK_LLVM_DYLIB build.

    Differential Revision: https://reviews.llvm.org/D55526 (detail)
    by sbc
  918. [Hexagon] Couple of fixes in optimize addressing mode

    - Check if an operand is an immediate before calling getImm. Some operands
      that take constant values can actually have global symbols or other
      constant expressions.
    - When a load-constant instruction can be folded into users, make sure to
      only delete it when all users have been successfully converted. (detail)
    by kparzysz
  919. InstCombine: Scalarize single use icmp/fcmp (detail)
    by arsenm
  920. [InstCombine] add tests for movmsk (PR39927) NFC (detail)
    by spatel
  921. Revert "Change InitListExpr dump to label and pointer"

    This reverts commit r348794. (detail)
    by steveire
  922. Fix nits (detail)
    by steveire
  923. Re-order content of template parameter dumps

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55393 (detail)
    by steveire
  924. [Targets] Fixup incorrect targets in codemodel tests (detail)
    by dmgreen
  925. Re-order content in OMPDeclareReductionDecl dump

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55395 (detail)
    by steveire
  926. Change InitListExpr dump to label and pointer

    Summary: Don't add a child just for the label.

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55495 (detail)
    by steveire
  927. [clang-tidy]  insert release notes for new checkers alphabetically

    Summary:
    Almost all code review comments on new checkers {D55433} {D48866} {D54349} seem to ask for the release notes to be added alphabetically, plus I've seen commits by @Eugene.Zelenko reordering the lists

    Make add_new_check.py add those release notes alphabetically based on checker name

    If include-fixer section is seen add it at the end

    Minor change in the message format to prevent double newlines added before the checker.

    Do the tools themselves have unit tests? (sorry new to this game)

    - Tested adding new checker at the beginning
    - Tested on adding new checker in the middle
    - Tested on empty ReleasesNotes.rst (as we would see after RC)

    Patch by MyDeveloperDay.

    Reviewers: alexfh, JonasToth, curdeius, aaron.ballman, benhamilton, hokein

    Reviewed By: JonasToth

    Subscribers: cfe-commits, xazax.hun, Eugene.Zelenko

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D55508 (detail)
    by jonastoth
  928. Revert "[Hexagon] Check if operand is an immediate before getImm"

    This reverts r348787. The patch wasn't quite correct. (detail)
    by kparzysz
  929. APFloat: allow 64-bit of payload

    Summary: The APFloat and Constant APIs taking an APInt allow arbitrary payloads,
    and that's great. There's a convenience API which takes an unsigned, and that's
    silly because it then directly creates a 64-bit APInt. Just change it to 64-bits
    directly.

    At the same time, add ConstantFP NaN getters which match the APFloat ones (with
    getQNaN / getSNaN and APInt parameters).

    Improve the APFloat testing to set more payload bits.

    Reviewers: scanon, rjmccall

    Subscribers: jkorous, dexonsmith, kristina, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55460 (detail)
    by jfb
  930. Add an explicit triple to this test to fix failing test bots. (detail)
    by aaronballman
  931. [constexpr][c++2a] Try-catch blocks in constexpr functions

    Implement support for try-catch blocks in constexpr functions, as
    proposed in http://wg21.link/P1002 and voted in San Diego for c++20.

    The idea is that we can still never throw inside constexpr, so the catch
    block is never entered. A try-catch block like this:

    try { f(); } catch (...) { }

    is then morally equivalent to just

    { f(); }

    Same idea should apply for function/constructor try blocks.

    rdar://problem/45530773

    Differential Revision: https://reviews.llvm.org/D55097 (detail)
    by Bruno Lopes
  932. [GlobalISel] Restrict G_MERGE_VALUES capability and replace with new opcodes.

    This patch restricts the capability of G_MERGE_VALUES, and uses the new
    G_BUILD_VECTOR and G_CONCAT_VECTORS opcodes instead in the appropriate places.

    This patch also includes AArch64 support for selecting G_BUILD_VECTOR of <4 x s32>
    and <2 x s64> vectors.

    Differential Revisions: https://reviews.llvm.org/D53629 (detail)
    by aemerson
  933. [Hexagon] Check if operand is an immediate before getImm (detail)
    by kparzysz
  934. Adding tests for -ast-dump; NFC.

    This adds tests for expressions in C. (detail)
    by aaronballman
  935. [Hexagon] Add patterns for any_extend from i1 and short vectors of i1 (detail)
    by kparzysz
  936. [TargetLowering] Add UNDEF folding to SimplifyDemandedVectorElts

    If all the demanded elements of the SimplifyDemandedVectorElts are known to be UNDEF, we can simplify to an ISD::UNDEF node.

    Zero constant folding will be handled in a future patch - its a little trickier as we often have bitcasted zero values.

    Differential Revision: https://reviews.llvm.org/D55511 (detail)
    by rksimon
  937. [docs] Add the new Objective-C ARC intrinsics to the LangRef.

    These were added in r348441. This mostly just points to the clang documentation
    to describe the intended semantics of each intrinsic. (detail)
    by epilk
  938. [DAGCombiner] Remove unnecessary recursive DAGCombiner::visitINSERT_SUBVECTOR call.

    As discussed on D55511, this caused an issue if the inner node deletes a node that the outer node depends upon. As it doesn't affect any lit-tests and I've only been able to expose this with the D55511 change I'm committing this now. (detail)
    by rksimon
  939. Refactor std::function to more easily support alternative implementations.

    Patch from Jordan Soyke (jsoyke@google.com)
    Reviewed as D55520

    This change adds a new internal class, called __value_func, that adds
    a minimal subset of value-type semantics to the internal __func interface.

    The change is NFC, and is cleanup for the upcoming ABI v2 function implementation (D55045). (detail)
    by ericwf
  940. ComputeLineNumbers: delete SSE2 vectorization

    Summary:
    SSE2 vectorization was added in 2012, but it is 2018 now and I can't
    observe any performance boost (testing clang -E [all Sema/* CodeGen/* with proper -I options]) with the existing _mm_movemask_epi8+countTrailingZeros or the following SSE4.2 (compiling with -msse4.2):

      __m128i C = _mm_setr_epi8('\r','\n',0,0,0,0,0,0,0,0,0,0,0,0,0,0);
      _mm_cmpestri(C, 2, Chunk, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_POSITIVE_POLARITY | _SIDD_LEAST_SIGNIFICANT)

    Delete the vectorization to simplify the code.

    Also simplify the code a bit and don't check the line ending sequence \n\r

    Reviewers: bkramer, #clang

    Reviewed By: bkramer

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55484 (detail)
    by maskray
  941. [x86] fix formatting; NFC

    This should really be generalized to allow increment and/or
    we should replace it by using ISD::matchUnaryPredicate().
    See D55515 for context. (detail)
    by spatel
  942. [AArch64] Refactor the Exynos scheduling predicates

    Refactor the scheduling predicates based on `MCInstPredicate`.  In this
    case, for the Exynos processors.

    Differential revision: https://reviews.llvm.org/D55345 (detail)
    by evandro
  943. [AMDGPU] Change the l1 flush instruction for AMDPAL/MESA3D.

    This commit changes which l1 flush instruction is used for AMDPAL and
    MESA3d workloads to flush the entire l1 cache instead of just the
    volatile lines.

    Differential Revision: https://reviews.llvm.org/D55367 (detail)
    by sheredom
  944. [Sanitizer] expand sysctl/getmntinfo/nl_langinfo to Darwin

    Reviewers: vitalybuka, krytarowski, kubamracek

    Reviewed By: vitalybuka, krytarowski

    Differential Revision: https://reviews.llvm.org/D55473 (detail)
    by David CARLIER
  945. [x86] add tests for LowerVSETCC with min/max; NFC (detail)
    by spatel
  946. [AArch64] Refactor the scheduling predicates

    Refactor the scheduling predicates based on `MCInstPredicate`.  Augment the
    number of helper predicates used by processor specific predicates.

    Differential revision: https://reviews.llvm.org/D55375 (detail)
    by evandro
  947. [AMDGPU] Add new Mode Register pass - minor fix

    Trivial change to add parentheses to an expression to avoid a
    sanitizer error in SIModeRegister.cpp, which was committed earlier. (detail)
    by timcorringham
  948. [llvm-mca] Add new tests for Exynos (NFC) (detail)
    by evandro
  949. [DAGCombiner] Simplify test case from r348759

    Thanks Simon for pointing that out. (detail)
    by thegameg
  950. [libclang] Revert removal of tidy plugin support from libclang introduced in r347496

    Differential Revision: https://reviews.llvm.org/D55415 (detail)
    by yvvan
  951. [AVX512] Update typo in comment

    Should be "Sae" for "Suppress All Exceptions".

    NFC (detail)
    by mcinally
  952. Use zip_longest for iterator range comparisons. NFC.

    Use zip_longest in two locations that compare iterator ranges.
    zip_longest allows the iteration using a range-based for-loop and to be
    symmetric over both ranges instead of prioritizing one over the other.
    In that latter case code have to handle the case that the first is
    longer than the second, the second is longer than the first, and both
    are of the same length, which must partially be checked after the loop.

    With zip_longest, this becomes an element comparison within the loop
    like the comparison of the elements themselves. The symmetry makes it
    clearer that neither the first and second iterators are handled
    differently. The iterators are not event used directly anymore, just
    the ranges.

    Differential Revision: https://reviews.llvm.org/D55468 (detail)
    by meinersbur
  953. [GlobalISel] Set stack protector index when translating Intrinsic::stackprotector

    Record the stack protector index in MachineFrameInfo when translating
    Intrinsic::stackprotector similarly as is done by SelectionDAG when
    processing the same intrinsic.

    Setting this index allows the Prologue/Epilogue Insertion to recognize
    that the stack protection is enabled. The pass can then make sure that
    the stack protector comes before local variables on the stack and
    assigns potentially vulnerable objects first so they are close to the
    stack protector slot.

    Differential Revision: https://reviews.llvm.org/D55418 (detail)
    by petr.pavlu
  954. [mips][mc] Emit R_{MICRO}MIPS_JALR when expanding jal to jalr

    When replacing jal with jalr, also emit '.reloc R_MIPS_JALR' (R_MICROMIPS_JALR
    for micromips). The linker might then be able to turn jalr into a direct
    call.
    Add '-mips-jalr-reloc' to enable/disable this feature (default is true).

    Differential revision: https://reviews.llvm.org/D55292 (detail)
    by vstefanovic
  955. [DAGCombiner] Use the result value type in visitCONCAT_VECTORS

    This triggers an assert when combining concat_vectors of a bitcast of
    merge_values.

    With asserts disabled, it fails to select:
    fatal error: error in backend: Cannot select: 0x7ff19d000e90: i32 = any_extend 0x7ff19d000ae8
      0x7ff19d000ae8: f64,ch = CopyFromReg 0x7ff19d000c20:1, Register:f64 %1
        0x7ff19d000b50: f64 = Register %1
    In function: d

    Differential Revision: https://reviews.llvm.org/D55507 (detail)
    by thegameg
  956. [NFC][AArch64] Remove duplicate Arch list in target parser tests

    The list generated in the target parser tests is the
    same as the one in the AArch64 target parser.
    Use that one instead.

    Differential Revision: https://reviews.llvm.org/D55509 (detail)
    by davidspickett
  957. Misc typos fixes in ./lib folder

    Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned`

    Reviewers: teemperor

    Reviewed By: teemperor

    Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55475 (detail)
    by Raphael Isemann
  958. [AMDGPU] Add new Mode Register pass

    A new pass to manage the Mode register.

    Currently this just manages the floating point double precision
    rounding requirements, but is intended to be easily extended to
    encompass all Mode register settings.

    The immediate motivation comes from the requirement to use the
    round-to-zero rounding mode for the 16 bit interpolation
    instructions, where the rounding mode setting is shared between
    16 and 64 bit operations. (detail)
    by timcorringham
  959. [DebugInfo] Don't drop dbg.value's of nullptr

    Currently, dbg.value's of "nullptr" are dropped when entering a SelectionDAG --
    apparently just because of an oversight when recognising Values that are
    constant (see PR39787). This patch adds ConstantPointerNull to the list of
    constants that can be turned into DBG_VALUEs.

    The matter of what bit-value a null pointer constant in LLVM has was raised
    in this mailing list thread:

      http://lists.llvm.org/pipermail/llvm-dev/2018-December/128234.html

    Where it transpires LLVM relies on (IR) null pointers being zero valued,
    thus I've baked this assumption into the patch.

    Differential Revision: https://reviews.llvm.org/D55227 (detail)
    by jmorse
  960. [OpenCL][CodeGen] Fix replacing memcpy with addrspacecast

    Summary:
    If a function argument is byval and RV is located in default or alloca address space
    an optimization of creating addrspacecast instead of memcpy is performed. That is
    not correct for OpenCL, where that can lead to a situation of address space casting
    from __private * to __global *. See an example below:

    ```
    typedef struct {
      int x;
    } MyStruct;

    void foo(MyStruct val) {}

    kernel void KernelOneMember(__global MyStruct* x) {
      foo (*x);
    }
    ```

    for this code clang generated following IR:
    ...
    %0 = load %struct.MyStruct addrspace(1)*, %struct.MyStruct addrspace(1)**
    %x.addr, align 4
    %1 = addrspacecast %struct.MyStruct addrspace(1)* %0 to %struct.MyStruct*
    ...

    So the optimization was disallowed for OpenCL if RV is located in an address space
    different than that of the argument (0).


    Reviewers: yaxunl, Anastasia

    Reviewed By: Anastasia

    Subscribers: cfe-commits, asavonic

    Differential Revision: https://reviews.llvm.org/D54947 (detail)
    by asavonic
  961. [DebugInfo] Emit undef DBG_VALUEs when SDNodes are optimised out

    This is a fix for PR39896, where dbg.value's of SDNodes that have been
    optimised out do not lead to "DBG_VALUE undef" instructions being created.
    Such undef instructions are necessary to terminate earlier variable
    ranges, otherwise variable values leak past the point where they're valid.

    The "invalidated" flag of SDDbgValue is currently being abused to mean two
    things:
    * The corresponding SDNode is now invalid
    * This SDDbgValue should not be emitted
    Of which there are several legitimate combinations of meaning:
    * The SDNode has been invalidated and we should emit "DBG_VALUE undef"
    * The SDNode has been invalidated but the debug data was salvaged, don't
       emit anything for this SDDbgValue
    * This SDDbgValue has been emitted

    This patch introduces distinct "Emitted" and "Invalidated" fields to the
    SDDbgValue class, updates users accordingly, and generates "undef"
    DBG_VALUEs for invalidated records. Awkwardly, there are circumstances
    where we emit SDDbgValue's twice, specifically DebugInfo/X86/dbg-addr-dse.ll
    which I've preserved.

    Differential Revision: https://reviews.llvm.org/D55372 (detail)
    by jmorse
  962. [X86] Fix AvoidStoreForwardingBlocks pass for negative displacements

    Fixes https://bugs.llvm.org/show_bug.cgi?id=39926.

    The size of the first copy was computed as
    std::abs(std::abs(LdDisp2) - std::abs(LdDisp1)), which results in
    skipped bytes if the signs of LdDisp2 and LdDisp1 differ. As far as
    I can see, this should just be LdDisp2 - LdDisp1. The case where
    LdDisp1 > LdDisp2 is already handled in the code above, in which case
    LdDisp2 is set to LdDisp1 and this subtraction will evaluate to
    Size1 = 0, which is the correct value to skip an overlapping copy.

    Differential Revision: https://reviews.llvm.org/D55485 (detail)
    by nikic
  963. Add data types needed for md2(3)/NetBSD interceptors

    Missing part of D55469. (detail)
    by kamil
  964. Add interceptors for the sha2(3) from NetBSD

    Summary:
    SHA224_Init, SHA224_Update, SHA224_Final, SHA224_End, SHA224_File,
    SHA224_FileChunk, SHA224_Data, SHA256_Init, SHA256_Update, SHA256_Final,
    SHA256_End, SHA256_File, SHA256_FileChunk, SHA256_Data, SHA384_Init,
    SHA384_Update, SHA384_Final, SHA384_End, SHA384_File, SHA384_FileChunk,
    SHA384_Data, SHA512_Init, SHA512_Update, SHA512_Final, SHA512_End,
    SHA512_File, SHA512_FileChunk, SHA512_Data – calculates the NIST Secure
    Hash Standard (version 2)

    Add tests for new interceptors.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54987 (detail)
    by kamil
  965. Add interceptors for md2(3) from NetBSD

    Summary:
    MD2Init, MD2Update, MD2Final, MD2End, MD2File, MD2Data - calculates the
    RSA Data Security, Inc., "MD2" message digest.

    Add a dedicated test.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55469 (detail)
    by kamil
  966. Add new interceptors for FILE repositioning stream

    Summary:
    Add new interceptors for a set of functions to reposition a stream:
    fgetpos, fseek, fseeko, fsetpos, ftell, ftello, rewind .

    Add a dedicated test.

    Enable this interface on NetBSD.

    Reviewers: joerg, vitalybuka

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55471 (detail)
    by kamil
  967. Revert r348741 "[Sema] Further improvements to to static_assert diagnostics."

    Seems to break build bots. (detail)
    by courbet
  968. [Sema] Further improvements to to static_assert diagnostics.

    Summary:
    We're now handling cases like `static_assert(!expr)` and
    static_assert(!(expr))`.

    Reviewers: aaron.ballman, Quuxplusone

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55270 (detail)
    by courbet
  969. [llvm-exegesis] Also check latency mode in local lit.

    Summary: This should avoid failing on old CPUs that do not have a cycle counter.

    Subscribers: tschuett, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55416 (detail)
    by courbet
  970. [CostModel][X86][AArch64] Adjust cost of the scalarization part of min/max reduction.

    Summary: The comment says we need 3 extracts and a select at the end. But didn't we just account for the select in the vector cost above. Aren't we just extracting the single element after taking the min/max in the vector register?

    Reviewers: RKSimon, spatel, ABataev

    Reviewed By: RKSimon

    Subscribers: javed.absar, kristof.beyls, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55480 (detail)
    by ctopper
  971. [X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that matches gcc.

    The addcarry and addcarryx builtins do the same thing. The only difference is that addcarryx previously required adx feature.

    This commit removes the adx feature check from addcarryx and removes the addcarry builtin. This matches the builtins that gcc has. We don't guarantee compatibility in builtins, but we generally try to be consistent if its not a burden. (detail)
    by ctopper
  972. [X86] Merge addcarryx/addcarry intrinsic into a single addcarry intrinsic.

    Both intrinsics do the exact same thing so we really only need one.

    Earlier in the 8.0 cycle we changed the signature of this intrinsic without renaming it. But it looks difficult to get the autoupgrade code to allow me to merge the intrinsics and change the signature at the same time. So I've renamed the intrinsic slightly for the new merged intrinsic. I'm skipping autoupgrading from the previous new to 8.0 signature. I've also renamed the subborrow for consistency. (detail)
    by ctopper
  973. [TextAPI][elfabi] Fix build by adding std::move() to r348735 (detail)
    by amontanez
  974. [TextAPI][elfabi] Make TBE handlers functions that return Errors

    Since TBEHandler doesn't maintain state or otherwise have any need to be
    a class right now, the read and write functions have been moved out and
    turned into standalone functions. Additionally, the TBE read function
    has been updated to return an Expected value for better error handling.
    Tests have been updated to reflect these changes.

    Differential Revision: https://reviews.llvm.org/D55450 (detail)
    by amontanez
  975. [bugpoint] Find 'opt', etc., in bugpoint directory

    Summary:
    When bugpoint attempts to find the other executables it needs to run,
    such as `opt` or `clang`, it tries searching the user's PATH. However,
    in many cases, the 'bugpoint' executable is part of an LLVM build, and
    the 'opt' executable it's looking for is in that same directory.

    Many LLVM tools handle this case by using the `Paths` parameter of
    `llvm::sys::findProgramByName`, passing the parent path of the currently
    running executable. Do this same thing for bugpoint. However, to
    preserve the current behavior exactly, first search the user's PATH,
    and then search for 'opt' in the directory containing 'bugpoint'.

    Test Plan:
    `check-llvm`. Many of the existing bugpoint tests no longer need to use the
    `--opt-command` option as a result of these changes.

    Reviewers: MatzeB, silvas, davide

    Reviewed By: MatzeB, davide

    Subscribers: davide, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54884 (detail)
    by modocache
  976. Re-commit "[IR] Add NODISCARD to attribute functions"

    Now that https://reviews.llvm.org/D55435 is committed,
    https://reviews.llvm.org/D55217 can be committed once again -- all warnings are
    now fixed. (detail)
    by modocache
  977. [AMDGPU] Fix discarded result of addAttribute

    Summary:
    `llvm::AttributeList` and `llvm::AttributeSet` are immutable, and so methods
    defined on these classes, such as `addAttribute`, return a new immutable
    object with the attribute added. In https://reviews.llvm.org/D55217 I attempted
    to annotate methods such as `addAttribute` with `LLVM_NODISCARD`, since
    calling these methods has no side-effects, and so ignoring the result
    that is returned is almost certainly a programmer error.

    However, committing the change resulted in new warnings in the AMDGPU target.
    The AMDGPU simplify libcalls pass added in https://reviews.llvm.org/D36436
    attempts to add the readonly and nounwind attributes to simplified
    library functions, but instead calls the `addAttribute` methods and
    ignores the result.

    Modify the simplify libcalls pass to actually add the nounwind and
    readonly attributes. Also update the simplify libcalls test to assert
    that these attributes are actually being set.

    Reviewers: rampitec, vpykhtin, rnk

    Reviewed By: rampitec

    Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55435 (detail)
    by modocache
  978. Speculatively fixing the build; it seems add_pointer_t and add_const_t are not implemented everywhere. (detail)
    by aaronballman
  979. Move the make_const_ptr trait into STLExtras; use add_pointer where possible; NFC. (detail)
    by aaronballman
  980. Adding an STL-like type trait that is duplicated in multiple places in Clang.

    This trait is used by several AST visitor classes to control whether the AST is visiting const nodes or non-const nodes. These uses cannot be easily replaced with the STL traits directly due to use of an unspecialized templated when a type is expected (due to the template template parameter involved). (detail)
    by aaronballman
  981. [X86] Add some comments about when some X86 intrinsic autoupgrade code was added.

    Someday we'd like to remove old autoupgrade code so it helps to annotate how long its been there so we don't have to go digging through commit history. (detail)
    by ctopper
  982. [X86] If the carry input to an addcarry/subborrow intrinsic is known to be 0, emit a flag setting ADD/SUB instead of ADC/SBB.

    Previously we had to take the carry in and add -1 to it to set the carry flag so we could use it with ADC/SBB. But if we know its 0 then we don't need to bother.

    This should go a long way towards fixing PR24545. (detail)
    by ctopper
  983. Remove unneeded dependency from lib/Target/X86/Utils/ to lib/IR (aka Core).

    The dependency was added in r213995 in response to r213986 which did make
    X86/Utils depend on IR, but r256680 later removed that dependency again. (detail)
    by nico
  984. [x86] regenerate test checks; NFC (detail)
    by spatel
  985. [x86] don't try to convert add with undef operands to LEA

    The existing code tries to handle an undef operand while transforming an add to an LEA,
    but it's incomplete because we will crash on the i16 test with the debug output shown below.
    It's better to just give up instead. Really, GlobalIsel should have folded these before we
    could get into trouble.

    # Machine code for function add_undef_i16: NoPHIs, TracksLiveness, Legalized, RegBankSelected, Selected

    bb.0 (%ir-block.0):
      liveins: $edi
      %1:gr32 = COPY killed $edi
      %0:gr16 = COPY %1.sub_16bit:gr32
      %5:gr64_nosp = IMPLICIT_DEF
      %5.sub_16bit:gr64_nosp = COPY %0:gr16
      %6:gr64_nosp = IMPLICIT_DEF
      %6.sub_16bit:gr64_nosp = COPY %2:gr16
      %4:gr32 = LEA64_32r killed %5:gr64_nosp, 1, killed %6:gr64_nosp, 0, $noreg
      %3:gr16 = COPY killed %4.sub_16bit:gr32
      $ax = COPY killed %3:gr16
      RET 0, implicit killed $ax

    # End machine code for function add_undef_i16.

    *** Bad machine code: Reading virtual register without a def ***
    - function:    add_undef_i16
    - basic block: %bb.0  (0x7fe6cd83d940)
    - instruction: %6.sub_16bit:gr64_nosp = COPY %2:gr16
    - operand 1:   %2:gr16
    LLVM ERROR: Found 1 machine code errors.

    Differential Revision: https://reviews.llvm.org/D54710 (detail)
    by spatel
  986. [X86] Extend pfm counter coverage for llvm-exegesis

    Extension to rL348617, turns out llvm-exegesis doesn't need to match the perf counter name against a scheduler model resource name - so I've added a few more counters that I could find in the libpfm4 source code (and fix a typo in the knl/knm retired_uops counter - which uses 'all' instead of 'any'). (detail)
    by rksimon
  987. NFC: Rename TemplateDecl dump utilities

    There is a clang::TemplateDecl AST type, so a method called
    VisitTemplateDecl looks like it should 'override' the method from the
    base visitor, but it does not because of the extra parameters it takes.

    In reality, these methods are utilities, so name them like utilities. (detail)
    by steveire
  988. NFC: Move dump of individual comment nodes to NodeDumper

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55190 (detail)
    by steveire
  989. Revert "Introduce optional labels to dumpStmt"

    This reverts commit 933402caa09963792058198578522a95f013c69c. (detail)
    by steveire
  990. Introduce optional labels to dumpStmt

    If the label is present, it is added as a child, with the statement a
    child of the label.  This preserves behavior of the InitListExpr dump
    output. (detail)
    by steveire
  991. Inline hasNodes into only caller

    It is easier to refactor with fewer utility methods. (detail)
    by steveire
  992. Inline dumpFullComment into callers

    It causes confusion over whether it or dumpComment is the more
    important. It is easier to refactor with fewer utility methods. (detail)
    by steveire
  993. Re-order content from InitListExpr

    Summary:
    This causes no change in the output of ast-dump-stmt.cpp due to the way
    child nodes are printed with a delay.

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55398 (detail)
    by steveire
  994. Fix InitListExpr test

    Wrong case of Check meant this has no effect. (detail)
    by steveire
  995. [X86] Add test for PR39926; NFC

    The test file shows a case where the avoid store forwarding block
    pass misses to copy a range (-1..1) when the load displacement
    changes sign.

    Baseline test for D55485. (detail)
    by nikic
  996. SourceManager: insert(make_pair(..)) -> try_emplace. NFC (detail)
    by maskray
  997. [COFF] Map truncated .eh_frame section name

    PE/COFF sections can have section names truncated to 8 chars, in order to
    have the name available at runtime. (The string table, where long untruncated
    names are stored, isn't loaded at runtime.)

    This allows various llvm tools to dump the .eh_frame section from such
    executables.

    Patch by Peiyuan Song!

    Differential Revision: https://reviews.llvm.org/D55407 (detail)
    by mstorsjo
  998. Fix conflict types for this FreeBSD test. (detail)
    by David CARLIER
  999. [DAGCombiner] re-enable truncation of binops

    This is effectively re-committing the changes from:
    rL347917 (D54640)
    rL348195 (D55126)
    ...which were effectively reverted here:
    rL348604
    ...because the code had a bug that could induce infinite looping
    or eventual out-of-memory compilation.

    The bug was that this code did not guard against transforming
    opaque constants. More details are in the post-commit mailing
    list thread for r347917. A reduced test for that is included
    in the x86 bool-math.ll file. (I wasn't able to reduce a PPC
    backend test for this, but it was almost the same pattern.)

    Original commit message for r347917:

    The motivating case for this is shown in:
    https://bugs.llvm.org/show_bug.cgi?id=32023
    and the corresponding rot16.ll regression tests.

    Because x86 scalar shift amounts are i8 values, we can end up with trunc-binop-trunc
    sequences that don't get folded in IR.

    As the TODO comments suggest, there will be regressions if we extend this (for x86,
    we mostly seem to be missing LEA opportunities, but there are likely vector folds
    missing too). I think those should be considered existing bugs because this is the
    same transform that we do as an IR canonicalization in instcombine. We just need
    more tests to make those visible independent of this patch. (detail)
    by spatel
  1000. [x86] add 32-bit RUN for tests and test with opaque constants; NFC

    The opaque constant test is reduced from a Chrome file that
    infinite-looped with rL347917. (detail)
    by spatel
  1001. [gn build] Add build files for CodeGen subfolders AsmPrinter, GlobalISel, SelectionDAG.

    Differential Revision: https://reviews.llvm.org/D55462 (detail)
    by nico
  1002. [WebAssembly] Make WasmSymbol's signature usable for events (NFC)

    Summary:
    WasmSignature used to use its `WasmSignature` member variable only for
    function types, but now it also can be used for events as well.

    Reviewers: sbc100

    Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55247 (detail)
    by aheejin
  1003. [llvm-readobj] Little clean up inside `parseDynamicTable`

    Summary:
    This anoymous function actually has same logic with `Obj->toMappedAddr`.

    Besides, I have a question on resolving illegal value. `gnu-readelf`, `gnu-objdump` and `llvm-objdump` could parse the test file 'test/tools/llvm-objdump/Inputs/private-headers-x86_64.elf', but `llvm-readobj` will fail when parse `DT_RELR` segment. Because, the value is 0x87654321 which is illegal. So, shall we do this clean up rather then remove the checking statements inside anoymous function?

    ```
    if (Delta >= Phdr.p_filesz)
        return createError("Virtual address is not in any segment");
    ```

    Reviewers: rupprecht, jhenderson

    Reviewed By: jhenderson

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55329 (detail)
    by Xing
  1004. Convert some ObjC msgSends to runtime calls.

    It is faster to directly call the ObjC runtime for methods such as alloc/allocWithZone instead of sending a message to those functions.

    This patch adds support for converting messages to alloc/allocWithZone to their equivalent runtime calls.

    Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions.

    Reviewed By: rjmccall

    https://reviews.llvm.org/D55349 (detail)
    by Pete Cooper
  1005. Move diagnostic enums into Basic.

    Move enums from */*Diagnostic.h to Basic/Diagnostic*.h.  Basic/AllDiagnostics.h
    needs all the enums and moving the sources to Basic prevents a Basic->*->Basic
    dependency loop.  This also allows each Basic/Diagnostics*Kinds.td to have a
    header at Basic/Diagnostic*.h (except for Common).  The old headers are kept in place since other packages are still using them. (detail)
    by rtrieu
  1006. Fix a typo in the strtoi test

    https://reviews.llvm.org/D54702 (detail)
    by kamil
  1007. Revert a chunk of previous change in sanitizer_platform_limits_netbsd.h

    Undefining INLINE breaks the build.
    The invalid change in this file has been overlooked in D55386. (detail)
    by kamil
  1008. Add interceptors for md5(3) from NetBSD

    Summary:
    MD5Init, MD5Update, MD5Final, MD5End, MD5File, MD5Data - calculates the
    RSA Data Security, Inc., "MD5" message digest.

    Add a dedicated test.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54993 (detail)
    by kamil
  1009. Add interceptors for the rmd160(3) from NetBSD

    Summary:
    RMD160Init, RMD160Update, RMD160Final, RMD160Transform, RMD160End,
    RMD160File, RMD160Data - calculates the ``RIPEMD-160'' message digest.

    Add a dedicated test for this API.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54991 (detail)
    by kamil
  1010. Add interceptors for the md4(3) from NetBSD

    Summary:
    MD4Init, MD4Update, MD4Final, MD4End, MD4File, MD4Data - calculates the
    RSA Data Security, Inc., "MD4" message digest.

    Add dedicated test.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54990 (detail)
    by kamil
  1011. Add interceptors for the sha1(3) from NetBSD

    Summary:
    Add interceptors for:

    - SHA1Init
    - SHA1Update
    - SHA1Final
    - SHA1Transform
    - SHA1End
    - SHA1File
    - SHA1FileChunk
    - SHA1Data

    Add a dedicated regression test for this API.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: mgorny, llvm-commits, kubamracek, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54927 (detail)
    by kamil
  1012. Stop tracking retain count of OSObject after escape to void * / other primitive types

    Escaping to void * / uint64_t / others non-OSObject * should stop tracking,
    as such functions can have heterogeneous semantics depending on context,
    and can not always be annotated.

    rdar://46439133

    Differential Revision: https://reviews.llvm.org/D55465 (detail)
    by George Karpenkov
  1013. [sanitizer] Add lit.local.cfg for FreeBSD (detail)
    by Vitaly Buka
  1014. [sanitizer] Suppress lint warning conflicting with clang-format (detail)
    by Vitaly Buka
  1015. Fix style. (detail)
    by David CARLIER
  1016. [gn build] Merge r348593 (detail)
    by nico
  1017. [SelectionDAG] Remove ISD::ADDC/ADDE from some undef handling code in getNode. NFCI

    These nodes should have two results. A real VT and a Glue. But this code would have returned Undef which would only be a single result. But we're in the single result version of getNode so these opcodes should never be seen by this function anyway. (detail)
    by ctopper
  1018. Conflict fixes from previous commits. (detail)
    by David CARLIER
  1019. [Sanitizer] capsicum api subset interception

    - For the moment a subset of this api dealing with file descriptors permissions and ioctls.

    Reviewers: vitalybuka, krytarowski

    Reviewed By: vitalybuka

    Differential Revision: https://reviews.llvm.org/D55368 (detail)
    by David CARLIER
  1020. [gn build] Add build files for lib/CodeGen, lib/Transforms/..., and lib/Bitcode/Writer

    Differential Revision: https://reviews.llvm.org/D55454 (detail)
    by nico
  1021. [Documentation] Alphabetical order in new checks list. (detail)
    by eugenezelenko
  1022. [tests] Fix the FileManagerTest getVirtualFile test on Windows

    Summary: The test passes on Windows only when it is executed on the C: drive. If the build and tests run on a different drive, the test is currently failing.

    Reviewers: kadircet, asmith

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55451 (detail)
    by stella.stamenova
  1023. Add interceptors for the strtoi(3)/strtou(3) from NetBSD

    Summary:
    strtoi/strtou converts string value to an intmax_t/uintmax_t integer.

    Add a dedicated test.

    Enable this API for NetBSD.

    It's a reworked version of the original work by Yang Zheng.

    Reviewers: joerg, vitalybuka

    Reviewed By: vitalybuka

    Subscribers: kubamracek, tomsun.0.7, mgorny, llvm-commits, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54702 (detail)
    by kamil
  1024. [CUDA] Added missing 'inline' for functions defined in a header. (detail)
    by tra
  1025. [X86] Remove the XFAILed test added in r348620

    It seems to be unexpectedly passing on some bots probably because it requires asserts to fail, but doesn't say that. But we already have a patch in review to make it not xfail so I'd rather just focus on getting it passing rather than trying to figure out an unexpected pass. (detail)
    by ctopper
  1026. Update a couple of vector<bool> tests that were testing libc++-specific bahavior. Thanks to Andrey Maksimov for the catch. (detail)
    by marshall
  1027. Fix IOError exception being raised in `asan_symbolize.py`crash when
    using `atos` symbolizer on Darwin when the binaries don't exist.

    For now we just produce an unsymbolicated stackframe when the binary
    doesn't exist. (detail)
    by delcypher
  1028. AMDGPU: Fix offsets for < 4-byte aggregate kernel arguments

    We were still using the rounded down offset and alignment even though
    they aren't handled because you can't trivially bitcast the loaded
    value. (detail)
    by arsenm
  1029. [GlobalISel] Add IR translation support for the @llvm.log10 intrinsic

    This adds IR translation support for @llvm.log10 and updates relevant tests.

    https://reviews.llvm.org/D55392 (detail)
    by paquette
  1030. Add a new interceptors for statvfs1(2) and fstatvfs1(2) from NetBSD

    Summary:
    statvfs1, fstatvfs1 - get file system statistics.

    While there, use file descriptor related macros in the fstatvfs interceptor.

    Add a dedicated test.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: dvyukov, kubamracek, mgorny, llvm-commits, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55031 (detail)
    by kamil
  1031. [Hexagon] Fix post-ra expansion of PS_wselect (detail)
    by kparzysz
  1032. Add a new interceptor for fparseln(3) from NetBSD

    Summary:
    fparseln - returns the next logical line from a stream.

    Add a dedicated test for this API.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55019 (detail)
    by kamil
  1033. [libcxx] Remove the availability_markup LIT feature

    It is now equivalent to the 'availability' LIT feature, so there's no
    reason to keep both. (detail)
    by Louis Dionne
  1034. Add new interceptor for strtonum(3)

    Summary:
    strtonum(3) reliably convertss string value to an integer.
    This function is used in OpenBSD compat namespace
    and is located inside NetBSD's libc.

    Add a dedicated test for this interface.

    It's a reworked version of the original code by Yang Zheng.

    Reviewers: joerg, vitalybuka

    Reviewed By: vitalybuka

    Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54527 (detail)
    by kamil
  1035. [ModuleSummary] use StringRefs to avoid a redundant copy; NFC

    `Saver` is a StringSaver, which has a few overloads of `save` that all
    ultimately just call `StringRef save(StringRef)`. Just take a StringRef
    here instead of building up a std::string to convert it to a StringRef. (detail)
    by George Burgess IV
  1036. Fix unused variable warning. NFCI. (detail)
    by rksimon
  1037. [WebAssembly] clang-format/clang-tidy AsmParser (NFC)

    Summary:
    - LLVM clang-format style doesn't allow one-line ifs.
    - LLVM clang-tidy style says method names should start with a lowercase
      letter. But currently WebAssemblyAsmParser's parent class
      MCTargetAsmParser is mixing lowercase and uppercase method names
      itself so overridden methods cannot be renamed now.
    - Changed else ifs after returns to ifs.
    - Added some newlines for readability.

    Reviewers: aardappel, sbc100

    Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55350 (detail)
    by aheejin
  1038. Delete registerScope function

    `unregisterScope()` is not currently used, so removing it. (detail)
    by aheejin
  1039. Follow-up from r348441 to add the rest of the objc ARC intrinsics.

    This adds the other intrinsics used by ARC and codegen's them to their respective runtime methods. (detail)
    by Pete Cooper
  1040. [MemCpyOpt] memset->memcpy forwarding with undef tail

    Currently memcpyopt optimizes cases like

        memset(a, byte, N);
        memcpy(b, a, M);

    to

        memset(a, byte, N);
        memset(b, byte, M);

    if M <= N. Often this allows further simplifications down the line,
    which drop the first memset entirely.

    This patch extends this optimization for the case where M > N, but we
    know that the bytes a[N..M] are undef due to alloca/lifetime.start.

    This situation arises relatively often for Rust code, because Rust does
    not initialize trailing structure padding and loves to insert redundant
    memcpys. This also fixes https://bugs.llvm.org/show_bug.cgi?id=39844.

    For the implementation, I'm reusing a bit of code for a similar existing
    optimization (direct memcpy of undef). I've also added memset support to
    MemDepAnalysis GetLocation -- Instead, getPointerDependencyFrom could be
    used, but it seems to make more sense to add this to GetLocation and thus
    make the computation cachable.

    Differential Revision: https://reviews.llvm.org/D55120 (detail)
    by nikic
  1041. [MemCpyOpt] Add tests for memset->memcpy forwaring with undef tail; NFC

    These are baseline tests for D55120. (detail)
    by nikic
  1042. AMDGPU: Use gfx9 instead of gfx8 in a test

    They are the same for the purposes of the tests,
    but it's much easier to write check lines for
    the memory instructions with offsets. (detail)
    by arsenm
  1043. [Preprocessor] Don't avoid entering included files after hitting a fatal error.

    Change in r337953 violated the contract for `CXTranslationUnit_KeepGoing`:

    > Do not stop processing when fatal errors are encountered.

    Use different approach to fix long processing times with multiple inclusion
    cycles. Instead of stopping preprocessing for fatal errors, do this after
    reaching the max allowed include depth and only for the files that were
    processed already. It is likely but not guaranteed those files cause a cycle.

    rdar://problem/46108547

    Reviewers: erik.pilkington, arphaman

    Reviewed By: erik.pilkington

    Subscribers: jkorous, dexonsmith, ilya-biryukov, Dmitry.Kozhevnikov

    Differential Revision: https://reviews.llvm.org/D55095 (detail)
    by vsapsai
  1044. [HotColdSplitting] Refine definition of unlikelyExecuted

    The splitting pass uses its 'unlikelyExecuted' predicate to statically
    decide which blocks are cold.

    - Do not treat noreturn calls as if they are cold unless they are actually
      marked cold. This is motivated by functions like exit() and longjmp(), which
      are not beneficial to outline.

    - Do not treat inline asm as an outlining barrier. In practice asm("") is
      frequently used to inhibit basic block merging; enabling outlining in this case
      results in substantial memory savings.

    - Treat invokes of cold functions as cold.

    As a drive-by, remove the 'exceptionHandlingFunctions' predicate, because it's
    no longer needed. The pass can identify & outline blocks dominated by EH pads,
    so there's no need to special-case __cxa_begin_catch etc.

    Differential Revision: https://reviews.llvm.org/D54244 (detail)
    by Vedant Kumar
  1045. [HotColdSplitting] Outline more than once per function

    Algorithm: Identify maximal cold regions and put them in a worklist. If
    a candidate region overlaps with another, discard it. While the worklist
    is full, remove a single-entry sub-region from the worklist and attempt
    to outline it. By the non-overlap property, this should not invalidate
    parts of the domtree pertaining to other outlining regions.

    Testing: LNT results on X86 are clean. With test-suite + externals, llvm
    outlines 134KB pre-patch, and 352KB post-patch (+ ~2.6x). The file
    483.xalancbmk/src/Constants.cpp stands out as an extreme case where llvm
    outlines over 100 times in some functions (mostly EH paths). There was
    not a significant performance impact pre vs. post-patch.

    Differential Revision: https://reviews.llvm.org/D53887 (detail)
    by Vedant Kumar
  1046. [analyzer] Move out tracking retain count for OSObjects into a separate checker

    Allow enabling and disabling tracking of ObjC/CF objects
    separately from tracking of OS objects.

    Differential Revision: https://reviews.llvm.org/D55400 (detail)
    by George Karpenkov
  1047. [analyzer] RetainCountChecker: remove untested, unused, incorrect option IncludeAllocationLine

    The option has no tests, is not used anywhere, and is actually
    incorrect: it prints the line number without the reference to a file,
    which can be outright incorrect.

    Differential Revision: https://reviews.llvm.org/D55385 (detail)
    by George Karpenkov
  1048. Missing freebsd files.

    A    lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
    A    lib/sanitizer_common/sanitizer_platform_limits_freebsd.h (detail)
    by David CARLIER
  1049. [Sanitizer] Separate FreeBSD interception data structures

    Reviewers: vitalybuka, krytarowski

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55386 (detail)
    by David CARLIER
  1050. [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'

    Patch by Alex Strelnikov.
    Reviewed as D53830

    Introduce a new check to upgrade user code based on upcoming API breaking changes to absl::Duration.

    The check finds calls to arithmetic operators and factory functions for absl::Duration that rely on
    an implicit user defined conversion to int64_t. These cases will no longer compile after proposed
    changes are released. Suggested fixes explicitly cast the argument int64_t. (detail)
    by ericwf
  1051. Update the Swift version numbers reported by objdump

    Summary:
    Add Swift 4.1, Swift 4.2, and Swift 5 version numbers to objdump's
    MachODump's print_imae_info routines.

    rdar://46548425

    Reviewers: pete, lhames, bob.wilson

    Reviewed By: pete, bob.wilson

    Subscribers: bob.wilson, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55442 (detail)
    by mtrent
  1052. [NativePDB] Reconstruct function declarations from debug info.

    Previously we would create an lldb::Function object for each function
    parsed, but we would not add these to the clang AST. This is a first
    step towards getting local variable support working, as we first need an
    AST decl so that when we create local variable entries, they have the
    proper DeclContext.

    Differential Revision: https://reviews.llvm.org/D55384 (detail)
    by zturner
  1053. [llvm-tapi] Don't try to override SequenceTraits for std::string

    For some reason this doesn't seem to work with LLVM_LINK_LLVM_DYLIB
    build.

    See https://logs.chromium.org/logs/chromium/bb/client.wasm.llvm/linux/37764/+/recipes/steps/LLVM_regression_tests/0/stdout

    What is more it seems that overriding these traits for core types
    (including std::string) is not supported/recommend by YAMLTraits.h.
    See line 1918 which has the assertion:
    "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"

    Differential Revision: https://reviews.llvm.org/D55381 (detail)
    by sbc
  1054. [DAGCombiner] split trunc from extend in hoistLogicOpWithSameOpcodeHands; NFC

    This duplicates several shared checks, but we need to split
    this up to fix underlying bugs in smaller steps. (detail)
    by spatel
  1055. [X86] Replace instregex with instrs list. NFCI. (detail)
    by rksimon
  1056. AMDGPU: Allow f32 types for llvm.amdgcn.s.buffer.load (detail)
    by arsenm
  1057. [llvm-mca][x86] Add RDSEED instruction resource tests for GLM (detail)
    by rksimon
  1058. [llvm-mca][x86] Add missing AES instruction resource tests

    Add missing non-VEX instructions (detail)
    by rksimon
  1059. [llvm-mca][x86] Add RDRAND/RDSEED instruction resource tests (detail)
    by rksimon
  1060. [CostModel][X86] Fix overcounting arithmetic cost in illegal types in getArithmeticReductionCost/getMinMaxReductionCost

    We were overcounting the number of arithmetic operations needed at each level before we reach a legal type. We were using the full vector type for that level, but we are going to split the input vector at that level in half. So the effective arithmetic operation cost at that level is half the width.

    So for example on 8i32 on an sse target. Were were calculating the cost of an 8i32 op which is likely 2 for basic integer. Then after the loop we count 2 more v4i32 ops. For a total arith cost of 4. But if you look at the assembly there would only be 3 arithmetic ops.

    There are still more bugs in this code that I'm going to work on next. The non pairwise code shouldn't count extract subvectors in the loop. There are no extracts, the types are split in registers. For pairwise we need to use 2 two src permute shuffles.

    Differential Revision: https://reviews.llvm.org/D55397 (detail)
    by ctopper
  1061. [X86] Initialize and Register X86CondBrFoldingPass

    To make X86CondBrFoldingPass can be run with --run-pass option, this can test one wrong assertion on analyzeCompare function for SUB32ri when its operand is not imm

    Patch by Jianping Chen

    Differential Revision: https://reviews.llvm.org/D55412 (detail)
    by ctopper
  1062. AMDGPU: Remove llvm.SI.tbuffer.store (detail)
    by arsenm
  1063. Make testcase more robust for bots actually building in /var (detail)
    by Adrian Prantl
  1064. [X86] Improve pfm counter coverage for llvm-exegesis

    This patch attempts to improve pfm perf counter coverage for all the x86 CPUs that libpfm4 supports.

    Intel/AMD CPU families tend to share names for cycle/uops counters so even if they don't have a scheduler model yet they can at least use the default values (checked against the libpfm4 source code).

    The remaining CPUs (where their port/pipe resource counters are known) I've tried to add to the existing model mappings.

    These are untested but don't represent a regression to current llvm-exegesis behaviour for these CPUs.

    Differential Revision: https://reviews.llvm.org/D55432 (detail)
    by rksimon
  1065. AMDGPU: Remove llvm.SI.buffer.load.dword (detail)
    by arsenm
  1066. AMDGPU: Remove llvm.AMDGPU.kill

    This is the last of the old AMDGPU intrinsics. (detail)
    by arsenm
  1067. [CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot (detail)
    by martong
  1068. Adding an AST dump test for statement expressions; NFC. (detail)
    by aaronballman
  1069. Make testcase more robust for completely-out-of-tree builds.

    Thats to Dave Zarzycki for reprorting this! (detail)
    by Adrian Prantl
  1070. [libcxx] Add paranoid cast-to-void in comma operator (detail)
    by Louis Dionne
  1071. [CTU] Add triple/lang mismatch handling

    Summary:
    We introduce a strict policy for C++ CTU. It can work across TUs only if
    the C++ dialects are the same. We neither allow C vs C++ CTU.  We do this
    because the same constructs might be represented with different properties in
    the corresponding AST nodes or even the nodes might be completely different (a
    struct will be RecordDecl in C, but it will be a CXXRectordDecl in C++, thus it
    may cause certain assertions during cast operations).

    Reviewers: xazax.hun, a_sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55134 (detail)
    by martong
  1072. [CTU] test/Analysis/ctu-main.cpp Attempt to fix failing windows bot (detail)
    by martong
  1073. [CTU] Add more lit tests and better error handling

    Summary:
    Adding some more CTU list tests. E.g. to check if a construct is unsupported.
    We also slightly modify the handling of the return value of the `Import`
    function from ASTImporter.

    Reviewers: xazax.hun, balazske, a_sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55131 (detail)
    by martong
  1074. [DAGCombiner] disable truncation of binops by default

    As discussed in the post-commit thread of r347917, this
    transform is fighting with an existing transform causing
    an infinite loop or out-of-memory, so this is effectively
    reverting r347917 and its follow-up r348195 while we
    investigate the bug. (detail)
    by spatel
  1075. [unittests] Add C++17 and C++2a support to the tooling tests (detail)
    by hamzasood
  1076. Reapply "[DemandedBits][BDCE] Support vectors of integers"

    DemandedBits and BDCE currently only support scalar integers. This
    patch extends them to also handle vector integer operations. In this
    case bits are not tracked for individual vector elements, instead a
    bit is demanded if it is demanded for any of the elements. This matches
    the behavior of computeKnownBits in ValueTracking and
    SimplifyDemandedBits in InstCombine.

    Unlike the previous iteration of this patch, getDemandedBits() can now
    again be called on arbirary (sized) instructions, even if they don't
    have integer or vector of integer type. (For vector types the size of the
    returned mask will now be the scalar size in bits though.)

    The added LoopVectorize test case shows a case which triggered an
    assertion failure with the previous attempt, because getDemandedBits()
    was called on a pointer-typed instruction.

    Differential Revision: https://reviews.llvm.org/D55297 (detail)
    by nikic
  1077. [AMDGPU] Shrink scalar AND, OR, XOR instructions

    This change attempts to shrink scalar AND, OR and XOR instructions which take an immediate that isn't inlineable.

    It performs:
    AND s0, s0, ~(1 << n) -> BITSET0 s0, n
    OR s0, s0, (1 << n) -> BITSET1 s0, n
    AND s0, s1, x -> ANDN2 s0, s1, ~x
    OR s0, s1, x -> ORN2 s0, s1, ~x
    XOR s0, s1, x -> XNOR s0, s1, ~x

    In particular, this catches setting and clearing the sign bit for fabs (and x, 0x7ffffffff -> bitset0 x, 31 and or x, 0x80000000 -> bitset1 x, 31). (detail)
    by gsellers
  1078. Make CPUDispatch resolver emit dependent functions.

    Inline cpu_specific versions referenced before the cpu_dispatch function
    weren't properly emitted, since they hadn't been referred to.  This
    patch ensures that during resolver generation that all appropriate
    versions are emitted.

    Change-Id: I94c3766aaf9c75ca07a0ad8258efdbb834654ff8 (detail)
    by erichkeane
  1079. Add an explicit triple to this test to prevent failures due to size_t differences. (detail)
    by aaronballman
  1080. Fix spelling of WINDOWS in a test

    Change-Id: I232515655359f14308e1c5509c4b7db96d1fafcb (detail)
    by erichkeane
  1081. [DAGCombiner] remove explicit calls to AddToWorkList; NFCI

    As noted in the post-commit thread for rL347917:
    http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181203/608936.html
    ...we don't need to repeat these calls because the combiner does it automatically. (detail)
    by spatel
  1082. Adding tests for -ast-dump; NFC.

    This adds tests for various statements in C++ that are not covered by C. (detail)
    by aaronballman
  1083. Revert "Multiversioning- Ensure all MV functions are emitted."

    This reverts commit 65df29f9318ac13a633c0ce13b2b0bccf06e79ca.

    AS suggested by @rsmith here: https://reviews.llvm.org/rL345839
    I'm reverting this and solving the initial problem in a different way. (detail)
    by erichkeane
  1084. [CTU] Add DisplayCTUProgress analyzer switch

    Summary:
    With a new switch we may be able to print to stderr if a new TU is being loaded
    during CTU.  This is very important for higher level scripts (like CodeChecker)
    to be able to parse this output so they can create e.g. a zip file in case of
    a Clang crash which contains all the related TU files.

    Reviewers: xazax.hun, Szelethus, a_sidorin, george.karpenkov

    Subscribers: whisperity, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp,

    Differential Revision: https://reviews.llvm.org/D55135 (detail)
    by martong
  1085. Introduce llvm.experimental.widenable_condition intrinsic

    This patch introduces a new instinsic `@llvm.experimental.widenable_condition`
    that allows explicit representation for guards. It is an alternative to using
    `@llvm.experimental.guard` intrinsic that does not contain implicit control flow.

    We keep finding places where `@llvm.experimental.guard` is not supported or
    treated too conservatively, and there are 2 reasons to that:

    - `@llvm.experimental.guard` has memory write side effect to model implicit control flow,
      and this sometimes confuses passes and analyzes that work with memory;
    - Not all passes and analysis are aware of the semantics of guards. These passes treat them
      as regular throwing call and have no idea that the condition of guard may be used to prove
      something. One well-known place which had caused us troubles in the past is explicit loop
      iteration count calculation in SCEV. Another example is new loop unswitching which is not
      aware of guards. Whenever a new pass appears, we potentially have this problem there.

    Rather than go and fix all these places (and commit to keep track of them and add support
    in future), it seems more reasonable to leverage the existing optimizer's logic as much as possible.
    The only significant difference between guards and regular explicit branches is that guard's condition
    can be widened. It means that a guard contains (explicitly or implicitly) a `deopt` block successor,
    and it is always legal to go there no matter what the guard condition is. The other successor is
    a guarded block, and it is only legal to go there if the condition is true.

    This patch introduces a new explicit form of guards alternative to `@llvm.experimental.guard`
    intrinsic. Now a widenable guard can be represented in the CFG explicitly like this:


        %widenable_condition = call i1 @llvm.experimental.widenable.condition()
        %new_condition = and i1 %cond, %widenable_condition
        br i1 %new_condition, label %guarded, label %deopt

      guarded:
        ; Guarded instructions

      deopt:
        call type @llvm.experimental.deoptimize(<args...>) [ "deopt"(<deopt_args...>) ]

    The new intrinsic `@llvm.experimental.widenable.condition` has semantics of an
    `undef`, but the intrinsic prevents the optimizer from folding it early. This form
    should exploit all optimization boons provided to `br` instuction, and it still can be
    widened by replacing the result of `@llvm.experimental.widenable.condition()`
    with `and` with any arbitrary boolean value (as long as the branch that is taken when
    it is `false` has a deopt and has no side-effects).

    For more motivation, please check llvm-dev discussion "[llvm-dev] Giving up using
    implicit control flow in guards".

    This patch introduces this new intrinsic with respective LangRef changes and a pass
    that converts old-style guards (expressed as intrinsics) into the new form.

    The naming discussion is still ungoing. Merging this to unblock further items. We can
    later change the name of this intrinsic.

    Reviewed By: reames, fedor.sergeev, sanjoy
    Differential Revision: https://reviews.llvm.org/D51207 (detail)
    by mkazantsev
  1086. ARM: use correct offset from base pointer (r6) in call frame regions.

    When we had dynamic call frames (i.e. sp adjustment around each call) we
    were including that adjustment into offsets calculated based on r6, even
    though it's only sp that changes. This led to incorrect stack slot
    accesses. (detail)
    by Tim Northover
  1087. [CodeComplete] Fix assertion failure

    Summary:
    ...that fires when running completion inside an argument of
    UnresolvedMemberExpr (see the added test).

    The assertion that fires is from Sema::TryObjectArgumentInitialization:

        assert(FromClassification.isLValue());

    This happens because Sema::AddFunctionCandidates does not account for
    object types which are pointers. It ends up classifying them incorrectly.
    All usages of the function outside code completion are used to run
    overload resolution for operators. In those cases the object type being
    passed is always a non-pointer type, so it's not surprising the function
    did not expect a pointer in the object argument.

    However, code completion reuses the same function and calls it with the
    object argument coming from UnresolvedMemberExpr, which can be a pointer
    if the member expr is an arrow ('->') access.

    Extending AddFunctionCandidates to allow pointer object types does not
    seem too crazy since all the functions down the call chain can properly
    handle pointer object types if we properly classify the object argument
    as an l-value, i.e. the classification of the implicitly dereferenced
    pointer.

    Reviewers: kadircet

    Reviewed By: kadircet

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55331 (detail)
    by ibiryukov
  1088. [unittests] Merge the PrintedStmtCXX..Matches functions (NFC)

    This was reviewed as part of https://reviews.llvm.org/D36527 (detail)
    by hamzasood
  1089. Adding tests for -ast-dump; NFC.

    This adds tests for various statements in C. (detail)
    by aaronballman
  1090. [CTU] Eliminate race condition in CTU lit tests

    Summary:
    We plan to introduce additional CTU related lit test. Since lit may run the
    tests in parallel, it is not safe to use the same directory (%T) for these
    tests. It is safe to use however test case specific directories (%t).

    Reviewers: xazax.hun, a_sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55129 (detail)
    by martong
  1091. [CTU] Add asserts to protect invariants

    Reviewers: xazax.hun, a_sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55132 (detail)
    by martong
  1092. [Targets] Add errors for tiny and kernel codemodel on targets that don't support them

    Adds fatal errors for any target that does not support the Tiny or Kernel
    codemodels by rejigging the getEffectiveCodeModel calls.

    Differential Revision: https://reviews.llvm.org/D50141 (detail)
    by dmgreen
  1093. [CTU] Add statistics

    Reviewers: xazax.hun, a_sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55133 (detail)
    by martong
  1094. [clang-tidy] Remove duplicated getText implementation, NFC (detail)
    by hokein
  1095. Add a AArch64 triple to tiny codemodel test.

    Most other targets do not support the tiny code model. (detail)
    by dmgreen
  1096. Fix gcc7.3 -Wparentheses warning. NFCI. (detail)
    by rksimon
  1097. [yaml2obj] format some codes NFC.

    Summary: This line is longer than 80 characters.

    Subscribers: llvm-commits, jakehehrlich

    Differential Revision: https://reviews.llvm.org/D55419 (detail)
    by Xing
  1098. [yaml2obj] revert bad change (detail)
    by Xing
  1099. [yaml2obj] format some codes NFC.

    Summary: This line is longer than 80 characters.

    Subscribers: llvm-commits, jakehehrlich

    Differential Revision: https://reviews.llvm.org/D55419 (detail)
    by Xing
  1100. Fix test/tools/llvm-mca/AArch64/Exynos/direct-branch.s on Mac

    It was failing as below. Adding a triple seems to help.

    --
    : 'RUN: at line 2';   /work/llvm.combined/build.release/bin/llvm-mca -march=aarch64 -mcpu=exynos-m1 -resource-pressure=false < /work/llvm.combined/llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s | /work/llvm.combined/build.release/bin/FileCheck /work/llvm.combined/llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s -check-prefixes=ALL,M1
    : 'RUN: at line 3';   /work/llvm.combined/build.release/bin/llvm-mca -march=aarch64 -mcpu=exynos-m3 -resource-pressure=false < /work/llvm.combined/llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s | /work/llvm.combined/build.release/bin/FileCheck /work/llvm.combined/llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s -check-prefixes=ALL,M3
    --
    Exit Code: 1

    Command Output (stderr):
    --
    /work/llvm.combined/llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s:36:12: error: M1-NEXT: expected string not found in input
               ^
    <stdin>:21:2: note: scanning from here
     1 0 0.25 b Ltmp0
     ^

    -- (detail)
    by hans
  1101. [utils] Use operator "in" instead of bound function "has_key"

    has_key has been removed in Python 3. The in comparison operator can be used
    instead.

    Differential Revision: https://reviews.llvm.org/D55310 (detail)
    by rogfer01
  1102. [X86] Add ivybridge to llvm-exegesis PFM counter mappings (detail)
    by rksimon
  1103. [SelectionDAG] Don't pass on DemandedElts when handling SCALAR_TO_VECTOR

    Fixes an assertion:

    llc: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2200: llvm::KnownBits llvm::SelectionDAG::computeKnownBits(llvm::SDValue, const llvm::APInt&, unsigned int) const: Assertion `(!Op.getValueType().isVector() || NumElts == Op.getValueType().getVectorNumElements()) && "Unexpected vector size"' failed.

    Committed on behalf of: @pendingchaos (Rhys Perry)

    Differential Revision: https://reviews.llvm.org/D55223 (detail)
    by rksimon
  1104. [CMake] Add support for NO_INSTALL_RPATH argument in llvm_add_library()

    Summary:
    Allow clients to suppress setup of default RPATHs in designated library targets. This is used in LLDB when emitting liblldb as a framework bundle, which itself doesn't load further RPATH-dependent libraries.
    This follows the approach in add_llvm_executable().

    Reviewers: aprantl, JDevlieghere, davide, friss

    Reviewed By: aprantl

    Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

    Differential Revision: https://reviews.llvm.org/D55316 (detail)
    by stefan.graenitz
  1105. [PowerPC] VSX register support for inline assembly

    Summary:
    The patch is to add the VSX register support for inline assembly. After this
    patch, we can use VSX register in inline assembly clobber list without error.

    Reviewed By: jsji,  nemanjai

    Differential Revision: https://reviews.llvm.org/D55192 (detail)
    by zhangkang
  1106. [IR] Don't assume all functions are 4 byte aligned

    In some cases different alignments for function might be used to save
    space e.g. thumb mode with -Oz will try to use 2 byte function
    alignment. Similar patch that fixed this in other areas exists here
    https://reviews.llvm.org/D46110

    This was approved previously https://reviews.llvm.org/D55115 (r348215)
    but when committed it caused failures on the sanitizer buildbots when
    building llvm with clang (containing this patch). This is now fixed
    because I've added a check to see if getting the parent module returns
    null if it does then set the alignment to 0.

    Differential Revision: https://reviews.llvm.org/D55115 (detail)
    by rsingh
  1107. [PM] Port LoadStoreVectorizer to the new pass manager.

    Differential Revision: https://reviews.llvm.org/D54848 (detail)
    by markus
  1108. Fix thunks returning memptrs via sret by emitting also scalar return values directly in sret slot (PR39901)

    Thunks that return member pointers via sret are broken due to using temporary
    storage for the return value on the stack and then passing that pointer to a
    tail call, violating the rule that a tail call can't access allocas in the
    caller (see bug).

    Since r90526, we put aggregate return values directly in the sret slot, but
    this doesn't apply to member pointers which are considered scalar.

    Unless I'm missing something subtle, we should be able to always use the sret
    slot directly for indirect return values.

    Differential revision: https://reviews.llvm.org/D55371 (detail)
    by hans
  1109. [XRay] Use preallocated memory for XRay profiling

    Summary:
    This change builds upon D54989, which removes memory allocation from the
    critical path of the profiling implementation. This also changes the API
    for the profile collection service, to take ownership of the memory and
    associated data structures per-thread.

    The consolidation of the memory allocation allows us to do two things:

    - Limits the amount of memory used by the profiling implementation,
      associating preallocated buffers instead of allocating memory
      on-demand.

    - Consolidate the memory initialisation and cleanup by relying on the
      buffer queue's reference counting implementation.

    We find a number of places which also display some problematic
    behaviour, including:

    - Off-by-factor bug in the allocator implementation.

    - Unrolling semantics in cases of "memory exhausted" situations, when
      managing the state of the function call trie.

    We also add a few test cases which verify our understanding of the
    behaviour of the system, with important edge-cases (especially for
    memory-exhausted cases) in the segmented array and profile collector
    unit tests.

    Depends on D54989.

    Reviewers: mboerger

    Subscribers: dschuff, mgorny, dmgreen, jfb, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55249 (detail)
    by dberris
  1110. [LoopSimplifyCFG] Do not deal with loops with irreducible CFG inside

    The current algorithm that collects live/dead/inloop blocks relies on some invariants
    related to RPO and PO traversals. In particular, the important fact it requires is that
    the only loop's latch is the first block in PO traversal. It also relies on fact that during
    RPO we visit all prececessors of a block before we visit this block (backedges ignored).

    If a loop has irreducible non-loop cycle inside, both these assumptions may break.
    This patch adds detection for this situation and prohibits the terminator folding
    for loops with irreducible CFG.

    We can in theory support this later, for this some algorithmic changes are needed.
    Besides, irreducible CFG is not a frequent situation and we can just don't bother.

    Thanks @uabelho for finding this!

    Differential Revision: https://reviews.llvm.org/D55357
    Reviewed By: skatkov (detail)
    by mkazantsev
  1111. [PowerPC] Fix assert from machine verify pass that missing undef register flag

    Fix assert about using an undefined physical register in machine instruction verify pass.
    The reason is that register flag undef is missing when doing transformation from If Conversion Pass.

    ```
    Bad machine code: Using an undefined physical register
    - function:    func_65
    - basic block: %bb.0 entry (0x10024740738)
    - instruction: BCLR killed $cr5lt, implicit $lr8, implicit $rm, implicit undef $x3
    - operand 0:   killed $cr5lt
    LLVM ERROR: Found 1 machine code errors.
    ```

    There are also other existing testcases with same issue. So I add -verify-machineinstrs option to open verifying.

    Differential Revision: https://reviews.llvm.org/D55408 (detail)
    by wuzish
  1112. [llvm-mca] Improve test (NFC)

    Add more instructions to the test for Cortex. (detail)
    by evandro
  1113. [llvm-mca] Improve test (NFC)

    Add a label to make explicit that the branch is short for Exynos. (detail)
    by evandro
  1114. Re-land "[XRay] Move-only Allocator, FunctionCallTrie, and Array"

    This reverts commit r348455, with some additional changes:

    - Work-around deficiency of gcc-4.8 by duplicating the implementation of
      `AppendEmplace` in `Append`, but instead of using brace-init for the
      copy construction, use a placement new explicitly calling the copy
      constructor. (detail)
    by dberris
  1115. [CodeExtractor] Store outputs at the first valid insertion point

    When CodeExtractor outlines values which are used by the original
    function, it must store those values in some in-out parameter. This
    store instruction must not be inserted in between a PHI and an EH pad
    instruction, as that results in invalid IR.

    This fixes the following verifier failure seen while outlining within
    ObjC methods with live exit values:

      The unwind destination does not have an exception handling instruction!
        %call35 = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %exn.adjusted, i8* %1)
                to label %invoke.cont34 unwind label %lpad33, !dbg !4183
      The unwind destination does not have an exception handling instruction!
        invoke void @objc_exception_throw(i8* %call35) #12
                to label %invoke.cont36 unwind label %lpad33, !dbg !4184
      LandingPadInst not the first non-PHI instruction in the block.
        %3 = landingpad { i8*, i32 }
                catch i8* null, !dbg !1411

    rdar://46540815 (detail)
    by Vedant Kumar
  1116. Revert "[llvm-tapi] Don't override SequenceTraits for std::string"

    Revert r348551 since it triggered some warnings that don't appear to have a quick fix. (detail)
    by amontanez
  1117. Revert "[DemandedBits][BDCE] Support vectors of integers"

    This reverts commit r348549. Causing assertion failures during
    clang build. (detail)
    by nikic
  1118. Add test for InitListExpr (detail)
    by steveire
  1119. [DAGCombiner] use root SDLoc for all nodes created by logic fold

    If this is not a valid way to assign an SDLoc, then we get this
    wrong all over SDAG.

    I don't know enough about the SDAG to explain this. IIUC, theoretically,
    debug info is not supposed to affect codegen. But here it has clearly
    affected 3 different targets, and the x86 change is an actual improvement. (detail)
    by spatel
  1120. [llvm-tapi] Don't override SequenceTraits for std::string

    Change the ELF YAML implementation of TextAPI so NeededLibs uses flow
    sequence vector correctly instead of overriding the YAML implementation
    for std::vector<std::string>>.

    This should fix the test failure with the LLVM_LINK_LLVM_DYLIB build mentioned in D55381.

    Still passes existing tests that cover this.

    Differential Revision: https://reviews.llvm.org/D55390 (detail)
    by amontanez
  1121. [DAGCombiner] don't bother saving a SDLoc for a node that's dead; NFCI

    We shouldn't care about the debug location for a node that
    we're creating, but attaching the root of the pattern should
    be the best effort. (If this is not true, then we are doing
    it wrong all over the SDAG).

    This is no-functional-change-intended, and there are no
    regression test diffs...and that's what I expected. But
    there's a similar line above this diff, where those
    assumptions apparently do not hold. (detail)
    by spatel
  1122. [DemandedBits][BDCE] Support vectors of integers

    DemandedBits and BDCE currently only support scalar integers. This
    patch extends them to also handle vector integer operations. In this
    case bits are not tracked for individual vector elements, instead a
    bit is demanded if it is demanded for any of the elements. This matches
    the behavior of computeKnownBits in ValueTracking and
    SimplifyDemandedBits in InstCombine.

    The getDemandedBits() method can now only be called on instructions that
    have integer or vector of integer type. Previously it could be called on
    any sized instruction (even if it was not particularly useful). The size
    of the return value is now always the scalar size in bits (while
    previously it was the type size in bits).

    Differential Revision: https://reviews.llvm.org/D55297 (detail)
    by nikic
  1123. [BDCE] Add tests for BDCE applied to vector instructions; NFC

    These are baseline tests for D55297. (detail)
    by nikic
  1124. [DAGCombiner] more clean up in hoistLogicOpWithSameOpcodeHands(); NFC

    This code can still misbehave. (detail)
    by spatel
  1125. NFC: Move VisitExpr code to dumpStmt

    Summary:
    The call is duplicated in the handlers of all Expr subclasses.

    This change makes it easy to split statement handling out to
    TextNodeDumper.

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55339 (detail)
    by steveire
  1126. NFC: Move VisitStmt code to dumpStmt

    Summary: This call is duplicated in Visits of all direct subclasses of Stmt.

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55338 (detail)
    by steveire
  1127. Add more expected content to match in test (detail)
    by steveire
  1128. Use relative line offsets in test (detail)
    by steveire
  1129. [frontend][darwin] warn_stdlibcxx_not_found: supress warning for preprocessed input

    Addresses second post-commit feedback for r335081 from Nico (detail)
    by arphaman
  1130. Run `git ls-files '*.gn' '*.gni' | xargs -n 1 gn format`. (detail)
    by nico
  1131. [gn build] merge r348505. (detail)
    by nico
  1132. [X86] Directly create ADC/SBB nodes instead of using ADD/SUB with (and SETCC_CARRY, 1)

    This addresses a FIXME and avoids depending on an isel pattern match I think. I've remove the isel patterns too since he have no lit tests left that cover them. Hopefully that really means they are unused.

    I'm trying to decide if we need SETCC_CARRY. This removes one of its usages.

    Differential Revision: https://reviews.llvm.org/D55355 (detail)
    by ctopper
  1133. [DAGCombiner] don't group bswap with casts in logic hoisting fold

    This was probably organized as it was because bswap is a unary op.
    But that's where the similarity to the other opcodes ends. We should
    not limit this transform to scalars, and we should not try it if
    either input has other uses. This is another step towards trying to
    clean this whole function up to prevent it from causing infinite loops
    and memory explosions.

    Earlier commits in this series:
    rL348501
    rL348508
    rL348518 (detail)
    by spatel
  1134. [analyzer] Rely on os_consumes_this attribute to signify that the method call consumes a reference for "this"

    Differential Revision: https://reviews.llvm.org/D55158 (detail)
    by George Karpenkov
  1135. [attributes] Add an attribute os_consumes_this, with similar semantics to ns_consumes_self

    The attribute specifies that the call of the C++ method consumes a
    reference to "this".

    Differential Revision: https://reviews.llvm.org/D55155 (detail)
    by George Karpenkov
  1136. [analyzer] Fix an infinite recursion bug while checking parent methods in RetainCountChecker

    Differential Revision: https://reviews.llvm.org/D55351 (detail)
    by George Karpenkov
  1137. [x86] add test for vector bitwise-logic-of-bswaps; NFC (detail)
    by spatel
  1138. [libc++] Improve diagnostics for non-const comparators and hashers in associative containers

    Summary:
    When providing a non-const-callable comparator in a map or set, the
    warning diagnostic does not include the point of instantiation of
    the container that triggered the warning, which makes it difficult
    to track down the problem. This commit improves the diagnostic by
    placing it directly in the body of the associative container.

    The same change is applied to unordered associative containers, which
    had a similar problem.

    Finally, this commit cleans up the forward declarations of several
    map and unordered_map helpers, which are not needed anymore.

    <rdar://problem/41370747>

    Reviewers: EricWF, mclow.lists

    Subscribers: christof, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D48955 (detail)
    by Louis Dionne
  1139. [libcxx] Always convert 'use_system_cxx_lib' to an absolute path

    Otherwise, some tests would fail when a relative path was passed,
    because they'd use the relative path from a different directory
    than the current working directory. (detail)
    by Louis Dionne
  1140. [test] Add missing cmake include for building libFuzzer alone

    Include CompilerRTCompile in fuzzer tests explicitly.  Otherwise, when
    building only libFuzzer, CMake fails due to:

    CMake Error at cmake/Modules/AddCompilerRT.cmake:395 (sanitizer_test_compile):
      Unknown CMake command "sanitizer_test_compile".
    Call Stack (most recent call first):
      lib/fuzzer/tests/CMakeLists.txt:53 (generate_compiler_rt_tests)

    Differential Revision: https://reviews.llvm.org/D55378 (detail)
    by mgorny
  1141. [DAGCombiner] reduce indent; NFC
     
    Unlike some of the folds in hoistLogicOpWithSameOpcodeHands()
    above this shuffle transform, this has the expected hasOneUse()
    checks in place. (detail)
    by spatel
  1142. [DagCombiner][X86] Simplify a ConcatVectors of a scalar_to_vector with undef.

    This patch introduces a new DAGCombiner rule to simplify concat_vectors nodes:

    concat_vectors( bitcast (scalar_to_vector %A), UNDEF)
        --> bitcast (scalar_to_vector %A)

    This patch only partially addresses PR39257. In particular, it is enough to fix
    one of the two problematic cases mentioned in PR39257. However, it is not enough
    to fix the original test case posted by Craig; that particular case would
    probably require a more complicated approach (and knowledge about used bits).

    Before this patch, we used to generate the following code for function PR39257
    (-mtriple=x86_64 , -mattr=+avx):

    vmovsd  (%rdi), %xmm0           # xmm0 = mem[0],zero
    vxorps  %xmm1, %xmm1, %xmm1
    vblendps        $3, %xmm0, %xmm1, %xmm0 # xmm0 = xmm0[0,1],xmm1[2,3]
    vmovaps %ymm0, (%rsi)
    vzeroupper
    retq

    Now we generate this:

    vmovsd  (%rdi), %xmm0           # xmm0 = mem[0],zero
    vmovaps %ymm0, (%rsi)
    vzeroupper
    retq

    As a side note: that VZEROUPPER is completely redundant...

    I guess the vzeroupper insertion pass doesn't realize that the definition of
    %xmm0 from vmovsd is already zeroing the upper half of %ymm0. Note that on
    %-mcpu=btver2, we don't get that vzeroupper because pass vzeroupper insertion
    %pass is disabled.

    Differential Revision: https://reviews.llvm.org/D55274 (detail)
    by adibiagio
  1143. [libcxx] Fix incorrect XFAILs for chrono tests on old macos deployment targets

    The tests were marked to fail based on the 'availability' LIT feature.
    However, those tests should really only be failing when we run them
    against the dylibs that were deployed on macosx10.7 and macosx10.8,
    which the deployment target has nothing to do with.

    This caused the tests to unexpectedly pass when running the tests
    with deployment target macosx10.{7,8} but running with a recent dylib. (detail)
    by Louis Dionne
  1144. [DAGCombiner] don't hoist logic op if operands have other uses, part 2

    The PPC test with 2 extra uses seems clearly better by avoiding this transform.
    With 1 extra use, we also prevent an extra register move (although that might
    be an RA problem). The general rule should be to only make a change here if
    it is always profitable. The x86 diffs are all neutral. (detail)
    by spatel
  1145. Fix Wdocumentation warning. NFCI. (detail)
    by rksimon
  1146. [PowerPC] add tests for hoisting bitwise logic; NFC (detail)
    by spatel
  1147. Allow forwarding -fdebug-compilation-dir to cc1as

    The flag -fdebug-compilation-dir is useful to make generated .o files
    independent of the path of the build directory, without making the compile
    command-line dependent on the path of the build directory, like
    -fdebug-prefix-map requires. This change makes it so that the driver can
    forward the flag to -cc1as, like it already can for -cc1. We might want to
    consider making -fdebug-compilation-dir a driver flag in a follow-up.

    (Since -fdebug-compilation-dir defaults to PWD, it's already possible to get
    this effect by setting PWD, but explicit compiler flags are better than env
    vars, because e.g. ninja tracks command lines and reruns commands that change.)

    Somewhat related to PR14625.

    Differential Revision: https://reviews.llvm.org/D55377 (detail)
    by nico
  1148. Reapply "Avoid emitting redundant or unusable directories in DIFile metadata entries.""

    This reverts commit r348280 and reapplies D55085 without modifications.

    Original commit message:

        Avoid emitting redundant or unusable directories in DIFile metadata entries.

        As discussed on llvm-dev recently, Clang currently emits redundant
        directories in DIFile entries, such as

          .file      1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c"

        This patch looks at any common prefix between the compilation
        directory and the (absolute) file path and strips the redundant
        part. More importantly it leaves the compilation directory empty if
        the two paths have no common prefix.

        After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"):

          .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c"

        When building the FileCheck binary with debug info, this patch makes
        the build artifacts ~1kb smaller.

        Differential Revision: https://reviews.llvm.org/D55085 (detail)
    by Adrian Prantl
  1149. Reapply "Adapt gcov to changes in CFE."

    This reverts commit r348203 and reapplies D55085 with an additional
    GCOV bugfix to make the change NFC for relative file paths in .gcno files.

    Thanks to Ilya Biryukov for additional testing!

    Original commit message:

        Update Diagnostic handling for changes in CFE.

        The clang frontend no longer emits the current working directory for
        DIFiles containing an absolute path in the filename: and will move the
        common prefix between current working directory and the file into the
        directory: component.

        https://reviews.llvm.org/D55085 (detail)
    by Adrian Prantl
  1150. [AArch64] Fix Exynos predicate

    Fix predicate for arithmetic instructions with shift and/or extend. (detail)
    by evandro
  1151. [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, 0>.end()

    The standard section [array.zero] requires the return value of begin()
    and end() methods of a zero-sized array to be unique. Eric Fiselier
    clarifies: "That unique value cannot be null, and must be properly aligned".
    This patch adds checks for the first part of this clarification: unique
    value returned by these methods cannot be null.

    Reviewed as https://reviews.llvm.org/D55366.
    Thanks to Andrey Maksimov for the patch. (detail)
    by Louis Dionne
  1152. [DAGCombiner] don't hoist logic op if operands have other uses

    The AVX512 diffs are neutral, but the bswap test shows a clear overreach in
    hoistLogicOpWithSameOpcodeHands(). If we don't check for other uses, we can
    increase the instruction count.

    This could also fight with transforms trying to go in the opposite direction
    and possibly blow up/infinite loop. This might be enough to solve the bug
    noted here:
    http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181203/608593.html

    I did not add the hasOneUse() checks to all opcodes because I see a perf
    regression for at least one opcode. We may decide that's irrelevant in the
    face of potential compiler crashing, but I'll see if I can salvage that first. (detail)
    by spatel
  1153. [libcxx] Add XFAILs for aligned allocation tests on AppleClang 9

    Some people are still running the test suite using AppleClang 9. (detail)
    by Louis Dionne
  1154. [x86] add test for hoistLogicOpWithSameOpcodeHands with extra uses; NFC (detail)
    by spatel
  1155. [PDB] Move some code around.  NFC. (detail)
    by zturner
  1156. [CUDA] Fix nvidia-cuda-toolkit detection on Ubuntu

    This just extends D40453 (r319317) to Ubuntu.

    Reviewed By: Hahnfeld, tra

    Differential Revision: https://reviews.llvm.org/D55269 (detail)
    by jdenny
  1157. [gn build] Process .def.in files in llvm/Config and add lib/Target/BUILD.gn

    Tweak write_cmake_config.py to also handle variable references looking @FOO@
    (matching CMake's configure_file() function), and make it replace '\' 'n' in
    values with a newline literal since there's no good portable way of passing a
    real newline literal on a command line.

    Use that to process all the .def.in files in llvm/include/Config and add
    llvm/lib/Target/BUILD.gn, which (indirectly, through llvm-c/Target.h) includes
    them.

    Differential Revision: https://reviews.llvm.org/D55184 (detail)
    by nico
  1158. [DAGCombiner] refactor function that hoists bitwise logic; NFCI
     
    Added FIXME and TODO comments for lack of safety checks.
    This function is a suspect in out-of-memory errors as discussed in
    the follow-up thread to r347917:
    http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181203/608593.html (detail)
    by spatel
  1159. [Sanitizer] getmntinfo support in FreeBSD

    Reviewers: krytarowski

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55354 (detail)
    by David CARLIER
  1160. Support skewed stream arrays.

    VarStreamArray was built on the assumption that it is backed by a
    StreamRef, and offset 0 of that StreamRef is the first byte of the first
    record in the array.

    This is a logical and intuitive assumption, but unfortunately we have
    use cases where it doesn't hold. Specifically, a PDB module's symbol
    stream is prefixed by 4 bytes containing a magic value, and the first
    byte of record data in the array is actually at offset 4 of this byte
    sequence.

    Previously, we would just truncate the first 4 bytes and then construct
    the VarStreamArray with the resulting StreamRef, so that offset 0 of the
    underlying stream did correspond to the first byte of the first record,
    but this is problematic, because symbol records reference other symbol
    records by the absolute offset including that initial magic 4 bytes. So
    if another record wants to refer to the first record in the array, it
    would say "the record at offset 4".

    This led to extremely confusing hacks and semantics in loading code, and
    after spending 30 minutes trying to get some math right and failing, I
    decided to fix this in the underlying implementation of VarStreamArray.
    Now, we can say that a stream is skewed by a particular amount. This
    way, when we access a record by absolute offset, we can use the same
    values that the records themselves contain, instead of having to do
    fixups.

    Differential Revision: https://reviews.llvm.org/D55344 (detail)
    by zturner
  1161. [X86] Refactored IsSplatVector to use switch. NFCI.

    Initial step towards making the function more generic (and probably move into SelectionDAG).

    This is necessary to avoid massive codegen bloat for PR38243 (Add modulo rotate support to LowerRotate). (detail)
    by rksimon
  1162. [DEBUGINFO, NVPTX] Disable emission of ',debug' option if only debug directives are allowed.

    Summary:
    If the output of debug directives only is requested, we should drop
    emission of ',debug' option from the target directive. Required for
    supporting of nvprof profiler.

    Reviewers: echristo

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D46061 (detail)
    by abataev
  1163. [GVN] Don't perform scalar PRE on GEPs

    Partial Redundancy Elimination of GEPs prevents CodeGenPrepare from
    sinking the addressing mode computation of memory instructions back
    to its uses. The problem comes from the insertion of PHIs, which
    confuse CGP and make it bail.

    I've autogenerated the check lines of an existing test and added a
    store instruction to demonstrate the motivation behind this change.
    The store is now using the gep instead of a phi.

    Differential Revision: https://reviews.llvm.org/D55009 (detail)
    by alelab01
  1164. [DEBUGINFO, NVPTX]Emit last debugging directives.

    Summary:
    We may end up with not emitted debug directives at the end of the module
    emission. Patch fixes this problem emitting those last directives the
    end of the module emission.

    Reviewers: echristo

    Subscribers: jholewinski, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54320 (detail)
    by abataev
  1165. DAGCombiner::visitINSERT_VECTOR_ELT - pull out repeated VT.getVectorNumElements(). NFCI. (detail)
    by rksimon
  1166. [NFC][AArch64] Split out backend features

    This patch splits backend features currently
    hidden behind architecture versions.

    For example, currently the only way to activate
    complex numbers extension is targeting an v8.3
    architecture, where after the patch this extension
    can be added separately.

    This refactoring is required by the new command lines proposal:
    http://lists.llvm.org/pipermail/llvm-dev/2018-September/126346.html


    Reviewers: DavidSpickett, olista01, t.p.northover

    Subscribers: kristof.beyls, bryanpkc, javed.absar, pbarrio

    Differential revision: https://reviews.llvm.org/D54633

    --

    It was reverted in rL348249 due a build bot failure in one of the
    regression tests:
    http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/14386

    The problem seems to be that FileCheck behaves
    different in windows and linux. This new patch
    splits the test file in multiple,
    and does more exact pattern matching attempting
    to circumvent the issue. (detail)
    by dnsampaio
  1167. [OPENMP][NVPTX] Fix globalization of the mapped array sections.

    If the array section is based on pointer and this sections is mapped in
    target region + then it is used in the inner parallel region, it also
    must be globalized as the pointer itself is passed by value, not by
    reference. (detail)
    by abataev
  1168. [clangd] Remove the test that sometimes deadlocks

    Will figure out how to properly rewrite it and recommit. (detail)
    by ibiryukov
  1169. [ARM][NFC] Adding another test for armcgp (detail)
    by sam_parker
  1170. AMDGPU: Generate VALU ThreeOp Integer instructions

    Summary:
    Original patch by: Fabian Wahlster <razor@singul4rity.com>

    Change-Id: I148f692a88432541fad468963f58da9ddf79fac5

    Reviewers: arsenm, rampitec

    Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, b-sumner, llvm-commits

    Differential Revision: https://reviews.llvm.org/D51995 (detail)
    by nha
  1171. [AMDGPU] Partial revert of rL348371: Turn on the DPP combiner by default

    Turn the combiner back off as there're failures until the issue is fixed.

    Differential revision: https://reviews.llvm.org/D55314 (detail)
    by vpykhtin
  1172. Fix -Wcovered-switch-default warning. NFCI. (detail)
    by rksimon
  1173. [libcxx] Make return value of array<T, 0>.data() checked only for libc++

    The section array.zero says: "The return value of data() is unspecified".
    This patch marks all checks of the array<T, 0>.data() return value as
    libc++ specific.

    Reviewed as https://reviews.llvm.org/D55364.
    Thanks to Andrey Maksimov for the patch. (detail)
    by Louis Dionne
  1174. Revert "[LoopSimplifyCFG] Delete dead in-loop blocks"

    This reverts commit r348457.
    The original commit causes clang to crash when doing an instrumented
    build with a new pass manager. Reverting to unbreak our integrate. (detail)
    by ibiryukov
  1175. Test commit: Removed trailing space in .txt file. (detail)
    by markus
  1176. [ARM][NFC] Added extra arm-cgp test (detail)
    by sam_parker
  1177. Add new `__sanitizer_mz_default_zone()` API which returns the address of the ASan malloc zone. This API will be used for testing in future patches.

    Summary:
    The name of the function is based on `malloc_default_zone()` found
    in Darwin's `malloc/malloc.h` header file.

    Reviewers: kubamracek, george.karpenkov

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55064 (detail)
    by delcypher
  1178. [clangd] Update the test code

    I forgot to update it in the last round of code review. (detail)
    by hokein
  1179. [X86][NFC] Convert memcpy/memset tests to update_llc_test_checks. (detail)
    by courbet
  1180. [clangd] C++ API for emitting file status.

    Introduce clangd C++ API to emit the current status of file. (detail)
    by hokein
  1181. Diagnose friend function template redefinitions.

    Friend function template defined in a class template becomes available if
    the enclosing class template is instantiated. Until the function template
    is used, it does not have a body, but still is considered a definition for
    the purpose of redeclaration checks.

    This change modifies redefinition check so that it can find the friend
    function template definitions in instantiated classes.

    Differential Revision: http://reviews.llvm.org/D21508 (detail)
    by sepavloff
  1182. [ARM GlobalISel] Nothing is legal for Thumb

    ...yet!

    A lot of the current code should be shared for arm and thumb mode, but
    until we add tests and work out some of the details (e.g. checking the
    correct subtarget feature for G_SDIV) it's safer to bail out as early as
    possible for thumb targets.

    This should have arguably been part of r348347, which allowed Thumb
    functions to be handled by the IR Translator. (detail)
    by rovka
  1183. Add test for ObjC generics (detail)
    by steveire
  1184. Extend OMP test (detail)
    by steveire
  1185. Make test resistant to line numbers changing (detail)
    by steveire
  1186. [clangd] Fix a typo in TUSchedulerTests

    Reviewers: ilya-biryukov

    Reviewed By: ilya-biryukov

    Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55312 (detail)
    by hokein
  1187. [X86][NFC] Add more tests for memset. (detail)
    by courbet
  1188. [llvm-dwarfdump] - Simplify the test case.

    The test was fully rewritten for simplification.

    New test code was suggested by David Blaikie.

    Differential revision: https://reviews.llvm.org/D55261 (detail)
    by grimar
  1189. [InstCombine] foldICmpWithLowBitMaskedVal(): don't miscompile -1 vector elts

    I was finally able to quantify what i thought was missing in the fix,
    it was vector constants. If we have a scalar (and %x, -1),
    it will be instsimplified before we reach this code,
    but if it is a vector, we may still have a -1 element.

    Thus, we want to avoid the fold if *at least one* element is -1.
    Or in other words, ignoring the undef elements, no sign bits
    should be set. Thus, m_NonNegative().

    A follow-up for rL348181
    https://bugs.llvm.org/show_bug.cgi?id=39861 (detail)
    by lebedevri
  1190. [NFC][InstCombine] Add more miscompile tests for foldICmpWithLowBitMaskedVal()

    We also have to me aware of vector constants. If at least one element
    is -1, we can't transform. (detail)
    by lebedevri
  1191. [X86] Remove some leftover code for handling an i1 setcc type. NFC

    We should only need to handle i8 now. (detail)
    by ctopper
  1192. Remove unnecessary include. (detail)
    by rtrieu
  1193. Remove CodeGen dependencies on Sema.

    Move diagnostics from Sema to Frontend (or Common) so that CodeGen no longer
    needs to include the Sema diagnostic IDs. (detail)
    by rtrieu
  1194. [LoopSimplifyCFG] Delete dead in-loop blocks

    This patch teaches LoopSimplifyCFG to delete loop blocks that have
    become unreachable after terminator folding has been done.

    Differential Revision: https://reviews.llvm.org/D54023
    Reviewed By: anna (detail)
    by mkazantsev
  1195. InstCombine: Add some missing tests for scalarization (detail)
    by arsenm
  1196. Revert "[XRay] Move-only Allocator, FunctionCallTrie, and Array"

    This reverts commits r348438, r348445, and r348449 due to breakages with
    gcc-4.8 builds. (detail)
    by dberris
  1197. ARM, AArch64: support `__attribute__((__swiftcall__))`

    Support the Swift calling convention on Windows ARM and AArch64.  Both
    of these conform to the AAPCS, AAPCS64 calling convention, and LLVM has
    been adjusted to account for the register usage.  Ensure that the
    frontend passes this into the backend.  This allows the swift runtime to
    be built for Windows. (detail)
    by Saleem Abdulrasool
  1198. [XRay] Use a local lvalue as arg to AppendEmplace(...)

    This is a follow-up to D54989.

    Further work-around gcc-4.8 failing to handle brace-init with temporaries. (detail)
    by dberris
  1199. [darwin] remove version number check when enabling -fobjc-subscripting-legacy-runtime

    This subscripting feature actually works on older OS versions anyway.

    rdar://36287065 (detail)
    by arphaman
  1200. Reapply fix from r348062 to fix test on Windows. (detail)
    by dyung
  1201. [llvm-objcopy] Change --only-keep to --only-section

    I just hard core goofed when I wrote this and created a different name
    for no good reason. I'm failry aware of most "fresh" users of llvm-objcopy
    (that is, users which are not using it as a drop in replacement for GNU
    objcopy) and can say that only "-j" is being used by such people so this
    patch should strictly increase compatibility and not remove it.

    Differential Revision: https://reviews.llvm.org/D52180 (detail)
    by jakehehrlich
  1202. [XRay] Use default-constructed struct as argument to Append(...)

    This is a follow-up to D54989.

    Work-around gcc-4.8 failing to handle brace-init for structs to imply
    default-construction of an aggregate, and treats it as an initialiser
    list instead. (detail)
    by dberris
  1203. AArch64: Fix invalid CCMP emission

    The code emitting AND-subtrees used to check whether any of the operands
    was an OR in order to figure out if the result needs to be negated.
    However the OR could be hidden in further subtrees and not immediately
    visible.

    Change the code so that canEmitConjunction() determines whether the
    result of the generated subtree needs to be negated. Cleanup emission
    logic to use this. I also changed the code a bit to make all negation
    decisions early before we actually emit the subtrees.

    This fixes http://llvm.org/PR39550

    Differential Revision: https://reviews.llvm.org/D54137 (detail)
    by matze
  1204. [attributes] Add more tests for os_returns_retained (detail)
    by George Karpenkov
  1205. [Sema/Attribute] Check for noderef attribute

    This patch adds the noderef attribute in clang and checks for dereferences of
    types that have this attribute. This attribute is currently used by sparse and
    would like to be ported to clang.

    Differential Revision: https://reviews.llvm.org/D49511 (detail)
    by leonardchan
  1206. Add objc.* ARC intrinsics and codegen them to their runtime methods.

    Reviewers: erik.pilkington, ahatanak

    Differential Revision: https://reviews.llvm.org/D55233 (detail)
    by Pete Cooper
  1207. [MachineOutliner][NFC] Move yet another std::vector out of a loop

    Once again, following the wisdom of the LLVM Programmer's Manual.

    I think that's enough refactoring for today. :) (detail)
    by paquette
  1208. Re-land r348335 "[XRay] Move-only Allocator, FunctionCallTrie, and Array"

    Continuation of D54989.

    Additional changes:

      - Use `.AppendEmplace(...)` instead of `.Append(Type{...})` to appease
        GCC 4.8 with confusion on when an initializer_list is used as
        opposed to a temporary aggregate initialized object. (detail)
    by dberris
  1209. [libcxx] Mark some tests as failing on macosx 10.14 (detail)
    by Louis Dionne
  1210. [libcxx] Don't depend on availability markup to provide the streams in the dylib

    Whether an explicit instantiation declaration should be provided is not
    a matter of availability markup.

    This problem is exemplified by the fact that some tests were incorrectly
    marked as XFAIL when they should instead have been using the definition
    of streams from the headers, and hence passing, and that, regardless of
    whether visibility annotations are enabled. (detail)
    by Louis Dionne
  1211. [Sema] Push and Pop Expression Evaluation Context Records at the start and end of function definitions

    This patch creates a new context for every function definition we enter.
    Currently we do not push and pop on these, usually working off of the global
    context record added in the Sema constructor, which never gets popped.

    Differential Revision: https://reviews.llvm.org/D54014 (detail)
    by leonardchan
  1212. [MachineOutliner][NFC] Move std::vector out of loop

    See http://llvm.org/docs/ProgrammersManual.html#vector (detail)
    by paquette
  1213. [MachineOutliner][NFC] Remove IntegerInstructionMap from InstructionMapper

    Refactoring.

    This map was only used when we used a string of integers to output the outlined
    sequence. Since it's no longer used for anything, there's no reason to keep it
    around. (detail)
    by paquette
  1214. Fix title underlines being too short after r348429 (detail)
    by Pete Cooper
  1215. [GlobalISel] Introduce G_BUILD_VECTOR, G_BUILD_VECTOR_TRUNC and G_CONCAT_VECTOR opcodes.

    These opcodes are intended to subsume some of the capability of G_MERGE_VALUES,
    as it was too powerful and thus complex to add deal with throughout the GISel
    pipeline.

    G_BUILD_VECTOR creates a vector value from a sequence of uniformly typed
    scalar values. G_BUILD_VECTOR_TRUNC is a special opcode for handling scalar
    operands which are larger than the destination vector element type, and
    therefore does an implicit truncate.

    G_CONCAT_VECTOR creates a vector by concatenating smaller, uniformly typed,
    vectors together.

    These will be used in a subsequent commit. This commit just adds the initial
    infrastructure.

    Differential Revision: https://reviews.llvm.org/D53594 (detail)
    by aemerson
  1216. Update ARC docs as objc_storeStrong returns void not id (detail)
    by Pete Cooper
  1217. [MachineOutliner][NFC] Remove buildCandidateList and replace with findCandidates

    More refactoring.

    Since the pruning logic has changed, and the candidate list is gone,
    everything can be sunk into findCandidates.

    We no longer need to keep track of the length of the longest substring, so we
    can drop all of that logic as well.

    After this, we just find all of the candidates and move to outlining. (detail)
    by paquette
  1218. [MachineOutliner][NFC] Candidates don't need to be shared_ptrs anymore

    More refactoring.

    After the changes to the pruning logic, and removing CandidateList, there's
    no reason for Candiates to be shared_ptrs (or pointers at all).

    std::shared_ptr<Candidate> -> Candidate. (detail)
    by paquette
  1219. Revert r347934 "[SCEV] Guard movement of insertion point for loop-invariants"

    This change caused SEGVs in instcombine. (The r347934 change seems to me to be a
    precipitating cause, not a root cause. Details are on the llvm-commits thread
    for r347934.) (detail)
    by dlj
  1220. Fix test change from r348365 to deal with Windows paths correctly. (detail)
    by dyung
  1221. [WebAssembly] Change event section code to 13

    Summary:
    We decided to change the event section code from 12 to 13 as new
    `DataCount` section in the bulk memory operations proposal will take the
    code 12 instead.

    Reviewers: sbc100

    Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55343 (detail)
    by aheejin
  1222. [InstCombine] remove dead code from visitExtractElement

    Extracting from a splat constant is always handled by InstSimplify.
    Move the test for this from InstCombine to InstSimplify to make
    sure that stays true. (detail)
    by spatel
  1223. [MachineOutliner][NFC] Remove CandidateList, since it's now unused.

    After removing the pruning logic, there's no reason to populate a list of
    Candidates. Remove CandidateList and update comments. (detail)
    by paquette
  1224. Fix buildbot capture warning

    A bot didn't like my lambda. This ought to fix it.

    Example:

    http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/30139/steps/build%20lld/logs/stdio

    error C3493: 'AlreadyRemoved' cannot be implicitly captured because no default
    capture mode has been specified (detail)
    by paquette
  1225. [MachineOutliner][NFC] Simplify and unify pruning/outlining logic

    Since we're now performing outlining per OutlinedFunction rather than per
    Candidate, we can simply outline each candidate as it shows up.

    Instead of having a pruning phase, instead, we'll outline entire functions.
    Then we'll update the UnsignedVec we mapped to reflect the deletion. If any
    candidate is in a space that's marked dirty, then we'll drop it.

    This lets us remove the pruning logic entirely, and greatly simplifies the
    code. (detail)
    by paquette
  1226. [Hexagon] Add intrinsics for Hexagon V66 (detail)
    by kparzysz
  1227. [InstCombine] reduce duplication in visitExtractElementInst; NFC (detail)
    by spatel
  1228. [InstCombine] add/move tests for extractelement; NFC (detail)
    by spatel
  1229. ThinLTO: Do not import debug info for imported global constants

    It looks like this isn't necessary (in any tests I've done, it results
    in the global being described with no location or value in the imported
    side - while it's still fully described in the place it's imported from)
    & results in significant/pathological debug info growth to home these
    location-less global variable descriptions on the import side.

    This is a rather pressing/important issue to address - this regressed
    executable size for one example I'm looking at by 15%, object size is probably
    similar though I haven't measured it, and a 22x increase in the number of CUs
    in the cu_index in split DWARF DWP files, creating a similarly large regression
    in the time it takes llvm-symbolizer to run on such binaries.

    Reviewers: tejohnson, evgeny777

    Differential Revision: https://reviews.llvm.org/D55309 (detail)
    by dblaikie
  1230. [Hexagon] Add support for Hexagon V66 (detail)
    by kparzysz
  1231. [MachineOutliner] Outline functions by order of benefit

    Mostly NFC, only change is the order of outlined function names.

    Loop over the outlined functions instead of walking the candidate list.

    This is a bit easier to understand. It's far more natural to create a function,
    then replace all of its occurrences with calls than the other way around.

    The functions outlined after this do not change, but their names will be
    decided by their benefit. E.g, OUTLINED_FUNCTION_0 will now always be the
    most beneficial function, rather than the first one seen.

    This makes it easier to enforce an ordering on the outlined functions. So,
    this also adds a test to make sure that the ordering works as expected. (detail)
    by paquette
  1232. [Hexagon] Add intrinsics for Hexagon V66 (detail)
    by kparzysz
  1233. NFC: Extract TextNodeDumper class

    Summary:
    Start by moving some utilities to it. It will eventually house dumping
    of individual nodes (after indentation etc has already been accounted
    for).

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55189 (detail)
    by steveire
  1234. [Hexagon] Add instruction definitions for Hexagon V66 (detail)
    by kparzysz
  1235. NFC: Extract TextTreeStructure class

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55188 (detail)
    by steveire
  1236. NFC: Inline handling of DependentSizedArrayType

    Summary:
    Re-order handling of getElementType and getBracketsRange. It is
    necessary to perform all printing before any traversal to child nodes.

    This causes no change in the output of ast-dump-array.cpp due to the way
    child nodes are printed with a delay.  This new order of the code is
    also the order that produces the expected output anyway.

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55257 (detail)
    by steveire
  1237. Add dump tests for inherited default template parameters (detail)
    by steveire
  1238. [Hexagon] Foundation of support for Hexagon V66 (detail)
    by kparzysz
  1239. [GISel]: Provide standard interface to observe changes in GISel passes

    https://reviews.llvm.org/D54980

    This provides a standard API across GISel passes to observe and notify
    passes about changes (insertions/deletions/mutations) to MachineInstrs.
    This patch also removes the recordInsertion method in MachineIRBuilder
    and instead provides method to setObserver.

    Reviewed by: vkeles. (detail)
    by aditya_nandakumar
  1240. [CodeExtractor] Do not marked outlined calls which may resume EH as noreturn

    Treat terminators which resume exception propagation as returning instructions
    (at least, for the purposes of marking outlined functions `noreturn`). This is
    to avoid inserting traps after calls to outlined functions which unwind.

    rdar://46129950 (detail)
    by Vedant Kumar
  1241. [X86][SSE] Fix a copy+paste typo that was folding the sext/zext of partial vectors (detail)
    by rksimon
  1242. Revert "[RISCV] Mark unit tests as "requires: riscv-registered-target""

    This reverts commit 8908dd12e7bbfc74e264233e900206ad31e285f0. (detail)
    by mgrang
  1243. Do not check for parameters shadowing fields in function declarations.

    We would issue a false-positive diagnostic for parameters in function declarations shadowing fields; we now only issue the diagnostic on a function definition instead. (detail)
    by aaronballman
  1244. Adding tests for -ast-dump; NFC.

    This adds tests for various function and class template declarations. (detail)
    by aaronballman
  1245. [AArch64] Reword description of feature (NFC)

    Reword the description of the feature that enables custom handling of cheap
    instructions. (detail)
    by evandro
  1246. Honor -fdebug-prefix-map when creating function names for the debug info.

    This adds a callback to PrintingPolicy to allow CGDebugInfo to remap
    file paths according to -fdebug-prefix-map. Otherwise the debug info
    (particularly function names for C++ lambdas) may contain paths that
    should have been remapped in the debug info.

    <rdar://problem/46128056>

    Differential Revision: https://reviews.llvm.org/D55137 (detail)
    by Adrian Prantl
  1247. [analyzer] Attribute for RetainCountChecker for OSObject should propagate with inheritance

    rdar://46388388

    Differential Revision: https://reviews.llvm.org/D55154 (detail)
    by George Karpenkov
  1248. [llvm-mca] Simplify test (NFC) (detail)
    by evandro
  1249. Mention changes to libc++ include dir lookup in release notes.

    Summary: The change itself landed as r348365, see the comment for more details.

    Reviewers: arphaman, EricWF

    Reviewed By: arphaman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55322 (detail)
    by ibiryukov
  1250. [llvm-mca] Sort test run lines (NFC) (detail)
    by evandro
  1251. [MachineOutliner][NFC] Use getOccurrenceCount() in getNotOutlinedCost()

    Some more gardening. (detail)
    by paquette
  1252. [MachineOutliner][NFC] Make getters in MachineOutliner.h const

    Just some refactoring. A few of the getters in OutlinedFunction weren't const. (detail)
    by paquette
  1253. [MachineOutliner][NFC] Don't create outlined sequence from integer mapping

    Some gardening/refactoring.

    It's cleaner to copy the instructions into the MachineFunction using the first
    candidate instead of going to the mapper.

    Also, by doing this we can remove the Seq member from OutlinedFunction entirely. (detail)
    by paquette
  1254. [gold-plugin] allow function/data sections to be toggleable

    Summary:
    r336838 allowed these to be toggleable.
    r336858 reverted r336838.
    r336943 made the generation of these sections conditional on LDPO_REL.

    This commit brings back the toggle-ability.  You can specify:
    -plugin-opt=-function-sections
    -plugin-opt=-data-sections
    For your linker flags to disable the changes made in r336943.

    Without toggling r336943 off, arm64 linux kernels linked with gold-plugin
    see significant boot time regressions, but with r336943 outright reverted
    x86_64 linux kernels linked with gold-plugin fail to boot.

    Reviewers: pcc, void

    Reviewed By: pcc

    Subscribers: javed.absar, kristof.beyls, llvm-commits, srhines

    Differential Revision: https://reviews.llvm.org/D55291 (detail)
    by nickdesaulniers
  1255. Address a post-commit review comment on r348325. (detail)
    by epilk
  1256. [CodeComplete] Fix a crash in access checks of inner classes

    Summary: The crash was introduced in r348135.

    Reviewers: kadircet

    Reviewed By: kadircet

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55260 (detail)
    by ibiryukov
  1257. AMDGPU: Fix using old address spaces in some tests (detail)
    by arsenm
  1258. [Basic] Cleanups in IdentifierInfo following the removal of PTH

    The Entry pointer in IdentifierInfo was only null for IdentifierInfo
    created from a PTH. Now that PTH support has been removed we can remove
    some PTH specific code in IdentifierInfo::getLength and
    IdentifierInfo::getNameStart.

    Also make the constructor of IdentifierInfo private to make sure that
    they are only created by IdentifierTable, and move it to the header so
    that it can be inlined in IdentifierTable::get and IdentifierTable::getOwn.

    Differential Revision: https://reviews.llvm.org/D54866

    Reviewed By: erichkeane (detail)
    by brunoricci
  1259. [DAGCombiner] don't try to extract a fraction of a vector binop and crash (PR39893)

    Because we're potentially peeking through a bitcast in this transform,
    we need to use overall bitwidths rather than number of elements to
    determine when it's safe to proceed.

    Should fix:
    https://bugs.llvm.org/show_bug.cgi?id=39893 (detail)
    by spatel
  1260. [OpenCL] Diagnose conflicting address spaces in templates.

    Added new diagnostic when templates are instantiated with
    different address space from the one provided in its definition.

    This also prevents deducing generic address space in pointer
    type of templates to allow giving them concrete address space
    during instantiation.

    Differential Revision: https://reviews.llvm.org/D55127 (detail)
    by stulova
  1261. Allow norecurse attribute on functions that have debug infos.

    Summary: debug intrinsics might be marked norecurse to enable the caller function to be norecurse and optimized if needed. This avoids code gen optimisation differences when -g is used, as in globalOpt.cpp:processInternalGlobal checks.

    Reviewers: chandlerc, jmolloy, aprantl

    Reviewed By: aprantl

    Subscribers: aprantl, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55187 (detail)
    by chrib
  1262. [X86] Add test case to show missed opportunity to combine a concat_vector into a scalar_to_vector. NFC

    This is a test for D55274. (detail)
    by adibiagio
  1263. [NFC] Use clang-format on PrintingPolicy::PrintingPolicy() after fd5c386f743

    The white-space change was causing conflicts downstream.

    rdar://problem/46486841 (detail)
    by Jan Korous
  1264. Remove XFAIL in get_module_and_offset_for_pc.cc for NetBSD-MSan

    After updating GET_LINK_MAP_BY_DLOPEN_HANDLE() for recent NetBSD
    this test no longer fails. (detail)
    by kamil
  1265. [Sanitizer] nl_langinfo forgotten bit.

    M    lib/sanitizer_common/sanitizer_platform_interceptors.h (detail)
    by David CARLIER
  1266. [Sanitizer] expand nl_langinfo interception to FreeBSD

    Reviewers: krytarowski

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55327 (detail)
    by David CARLIER
  1267. Revert "[IR] Add NODISCARD to attribute functions"

    Revert https://reviews.llvm.org/D55217 due to warnings-turned-into-errors in
    AMGPU targets. I'll fix the warnings first, then re-commit this patch. (detail)
    by modocache
  1268. [SLH] Fix a nasty bug in SLH.

    Whenever we effectively take the address of a basic block we need to
    manually update that basic block to reflect that fact or later passes
    such as tail duplication and tail merging can break the invariants of
    the code. =/ Sadly, there doesn't appear to be any good way of
    automating this or even writing a reasonable assert to catch it early.

    The change seems trivially and obviously correct, but sadly the only
    really good test case I have is 1000s of basic blocks. I've tried
    directly writing a test case that happens to make tail duplication do
    something that crashes later on, but this appears to require an
    *amazingly* complex set of conditions that I've not yet reproduced.

    The change is technically covered by the tests because we mark the
    blocks as having their address taken, but that doesn't really count as
    properly testing the functionality. (detail)
    by chandlerc
  1269. [SLH] Regenerate tests with --no_x86_scrub_rip to restore the higher
    fidelity checking of RIP-based references to basic blocks and other
    labels.

    These labels are super important for SLH tests so we should keep them
    readable in the test cases. (detail)
    by chandlerc
  1270. [IR] Add NODISCARD to attribute functions

    Summary:
    Many functions on `llvm::AttributeList` and `llvm::AttributeSet` are
    documented with "returns a new {list,set} because attribute
    {lists,sets} are immutable." This documentation can be aided by the
    addition of an attribute, `LLVM_NODISCARD`. Adding this prevents
    unsuspecting users of the API from expecting
    `AttributeList::setAttributes` from modifying the underlying list.

    At the very least, it would have saved me a few hours of debugging, since I
    had been doing just that! I had a bug in my program where I was calling
    `setAttributes` but then passing in the unmutated `AttributeList`.
    I tried adding LLVM_NODISCARD and confirmed that it would have made my bug
    immediately obvious.

    Reviewers: rnk, javed.absar

    Reviewed By: rnk

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55217 (detail)
    by modocache
  1271. [AMDGPU]: Turn on the DPP combiner by default

    Differential revision: https://reviews.llvm.org/D55314 (detail)
    by vpykhtin
  1272. Add a new interceptor for modctl(2) from NetBSD

    Summary:
    modctl - controls loadable kernel modules.

    Skip tests as this call uses privileged operations.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55025 (detail)
    by kamil
  1273. Add a new interceptor for nl_langinfo(3) from NetBSD

    Summary:
    nl_langinfo - gets locale information.

    Add a dedicated test.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55015 (detail)
    by kamil
  1274. [Haiku] Support __float128 for x86 and x86_64

    This patch addresses a compilation error with clang when
    running in Haiku being unable to compile code using
    float128 (throws compilation error such as 'float128 is
    not supported on this target').

    Patch by kallisti5 (Alexander von Gluck IV)

    Differential Revision: https://reviews.llvm.org/D54901 (detail)
    by Kristina Brooks
  1275. [InstCombine] simplify icmps with same operands based on dominating cmp

    The tests here are based on the motivating cases from D54827.

    More background:
    1. We don't get these cases in general with SimplifyCFG because the root
       of the pattern match is an icmp, not a branch. I'm not sure how often
       we encounter this pattern vs. the seemingly more likely case with
       branches, but I don't see evidence to leave the minimal pattern
       unoptimized.

    2. This has a chance of increasing compile-time because we're using a
       ValueTracking call to handle the match. The motivating cases could be
       handled with a simpler pair of calls to isImpliedTrueByMatchingCmp/
       isImpliedFalseByMatchingCmp, but I saw that we have a more
       comprehensive wrapper around those, so we might as well use it here
       unless there's evidence that it's significantly slower.

    3. Ideally, we'd handle the fold to constants in InstSimplify, but as
       with the existing code here, we could extend this to handle cases
       where the result is not a constant, but a new combined predicate.
       That would mean splitting the logic across the 2 passes and possibly
       duplicating the pattern-matching cost.

    4. As mentioned in D54827, this seems like the kind of thing that should
       be handled in Correlated Value Propagation, but that pass is currently
       limited to dealing with instructions with constant operands, so extending
       this bit of InstCombine is the smallest/easiest way to get these patterns
       optimized. (detail)
    by spatel
  1276. [X86][SSE] Begun adding modulo rotate support to LowerRotate

    Prep work for PR38243 - mainly adding comments on where we need to add modulo support (doing so at the moment causes massive codegen regressions).

    I've also consistently added support for modulo folding for uniform constants (although at the moment we have no way to trigger this) and removed the old assertions. (detail)
    by rksimon
  1277. Move detection of libc++ include dirs to Driver on MacOS

    Summary:
    The intention is to make the tools replaying compilations from 'compile_commands.json'
    (clang-tidy, clangd, etc.) find the same standard library as the original compiler
    specified in 'compile_commands.json'.

    Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied
    on the value of resource dir as an approximation of the compiler install dir. The new logic
    uses the actual compiler install dir and is performed in the driver. This is consistent with
    the C++ standard library detection on other platforms and allows to override the resource dir
    in the tools using the compile_commands.json without altering the
    standard library detection mechanism. The tools have to override the resource dir to make sure
    they use a consistent version of the builtin headers.

    There is still logic in InitHeaderSearch that attemps to add the absolute includes for the
    the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend
    via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too,
    but it could potentially break the library detection on other systems, so we don't tackle it in this
    patch to keep its scope manageable.

    This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675.
    The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the
    driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke
    the libc++ detection in clang itself, which caused LLDB tests to break.

    The LLDB tests pass with new fix.

    Reviewers: JDevlieghere, arphaman, EricWF

    Reviewed By: arphaman

    Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54630 (detail)
    by ibiryukov
  1278. Revert: Honor -fdebug-prefix-map when creating function names for the debug info.

    This commit reverts r348060 and r348062 due to it breaking the AArch64 Full
    buildbot: https://bugs.llvm.org/show_bug.cgi?id=39892 (detail)
    by rengolin
  1279. [llvm-rc] Support not expressions.

    Patch by Jacek Caban!

    Differential Revision: https://reviews.llvm.org/D55242 (detail)
    by mstorsjo
  1280. [TargetLowering] Remove ISD::ANY_EXTEND/ANY_EXTEND_VECTOR_INREG opcodes from SimplifyDemandedVectorElts

    These have no test coverage and the KnownZero flags can't be guaranteed unlike SIGN/ZERO_EXTEND cases. (detail)
    by rksimon
  1281. [clangd] Dont provide locations for non-existent files.

    Summary:
    We were getting assertion errors when we had bad file names, instead we
    should skip those.

    Reviewers: hokein

    Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55275 (detail)
    by kadircet
  1282. [DAG] Add fshl/fshr tblgen opcodes

    Missed off from https://reviews.llvm.org/D54698 (detail)
    by rksimon
  1283. Fix compilation error when using clang 3.6.0 (detail)
    by uabelho
  1284. [test] Disable Modules/prune.m on NetBSD as it requires 'touch -a' (detail)
    by mgorny
  1285. [test] Skip ThinLTO cache tests requiring atime setting on NetBSD

    Skip the ThinLTO cache tests on NetBSD.  They require 'touch' being
    able to alter atime of files, while NetBSD inhibits atime updates
    when filesystem is mounted noatime.

    Differential Revision: https://reviews.llvm.org/D55273 (detail)
    by mgorny
  1286. [test] Split strip-preserve-time.test, and skip atime test on NetBSD

    Split timestamp preservation tests into atime and mtime test, and skip
    the former on NetBSD.  When the filesystem is mounted noatime, NetBSD
    not only inhibits implicit atime updates but also prevents setting atime
    via utime(), causing the test to fail.

    Differential Revision: https://reviews.llvm.org/D55271 (detail)
    by mgorny
  1287. [SelectionDAG] Initial support for FSHL/FSHR funnel shift opcodes (PR39467)

    This is an initial patch to add a minimum level of support for funnel shifts to the SelectionDAG and to begin wiring it up to the X86 SHLD/SHRD instructions.

    Some partial legalization code has been added to handle the case for 'SlowSHLD' where we want to expand instead and I've added a few DAG combines so we don't get regressions from the existing DAG builder expansion code.

    Differential Revision: https://reviews.llvm.org/D54698 (detail)
    by rksimon
  1288. [clang] - Simplify tools::SplitDebugName.

    This is an updated version of the D54576, which was reverted.

    Problem was that SplitDebugName calls the InputInfo::getFilename
    which asserts if InputInfo given is not of type Filename:

    const char *getFilename() const {
      assert(isFilename() && "Invalid accessor.");
      return Data.Filename;
    }
    At the same time at that point, it can be of type Nothing and
    we need to use getBaseInput(), like original code did.

    Differential revision: https://reviews.llvm.org/D55006 (detail)
    by grimar
  1289. [MC] - Fix build bot.

    Error was:
    /home/buildslave/slave_as-bldslv8/lld-perf-testsuite/llvm/lib/MC/MCFragment.cpp:241:22: error: field 'Offset' will be initialized after field 'LayoutOrder' [-Werror,-Wreorder]
          Atom(nullptr), Offset(~UINT64_C(0)), LayoutOrder(0) {

    http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/9628/steps/build-bin%2Flld/logs/stdio (detail)
    by grimar
  1290. Remove superfluous comments. NFCI.

    As requested in D54698. (detail)
    by rksimon
  1291. Recommit r348243 - "[llvm-mc] - Do not crash when referencing undefined debug sections."

    The patch triggered an unrelated msan issue: LayoutOrder variable was not initialized.
    (http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26794/steps/check-llvm%20msan/logs/stdio)
    It was fixed.

    Original commit message:
    MC has code that pre-creates few debug sections:
    https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCObjectFileInfo.cpp#L396

    If users code has a reference to such section but does not redefine it,
    MC code currently asserts, because still thinks they are normally defined.

    The patch fixes the issue.

    Differential revision: https://reviews.llvm.org/D55173
    ----
    Modified : /llvm/trunk/lib/MC/ELFObjectWriter.cpp
    Added : /llvm/trunk/test/MC/ELF/undefined-debug.s (detail)
    by grimar
  1292. [TargetLowering] SimplifyDemandedVectorElts - don't alter DemandedElts mask

    Fix potential issue with the ISD::INSERT_VECTOR_ELT case tweaking the DemandedElts mask instead of using a local copy - so later uses of the mask use the tweaked version.....

    Noticed while investigating adding zero/undef folding to SimplifyDemandedVectorElts and the altered DemandedElts mask was causing mismatches. (detail)
    by rksimon
  1293. [ARM GlobalISel] Implement call lowering for Thumb2

    The only things that are different from arm are:
    * different opcodes for calls and returns
    * Thumb calls take predicate operands (detail)
    by rovka
  1294. Revert r348335 "[XRay] Move-only Allocator, FunctionCallTrie, and Array"

    .. and also the follow-ups r348336 r348338.

    It broke stand-alone compiler-rt builds with GCC 4.8:

    In file included from /work/llvm/projects/compiler-rt/lib/xray/xray_function_call_trie.h:20:0,
                     from /work/llvm/projects/compiler-rt/lib/xray/xray_profile_collector.h:21,
                     from /work/llvm/projects/compiler-rt/lib/xray/xray_profile_collector.cc:15:
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h: In instantiation of ‘T* __xray::Array<T>::AppendEmplace(Args&& ...) [with Args = {const __xray::FunctionCallTrie::mergeInto(__xray::FunctionCallTrie&) const::NodeAndTarget&}; T = __xray::FunctionCallTrie::mergeInto(__xray::FunctionCallTrie&) const::NodeAndTarget]’:
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h:383:71:   required from ‘T* __xray::Array<T>::Append(const T&) [with T = __xray::FunctionCallTrie::mergeInto(__xray::FunctionCallTrie&) const::NodeAndTarget]’
    /work/llvm/projects/compiler-rt/lib/xray/xray_function_call_trie.h:517:54:   required from here
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h:378:5: error: could not convert ‘{std::forward<const __xray::FunctionCallTrie::mergeInto(__xray::FunctionCallTrie&) const::NodeAndTarget&>((* & args#0))}’ from ‘<brace-enclosed initializer list>’ to ‘__xray::FunctionCallTrie::mergeInto(__xray::FunctionCallTrie&) const::NodeAndTarget’
         new (AlignedOffset) T{std::forward<Args>(args)...};
         ^
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h: In instantiation of ‘T* __xray::Array<T>::AppendEmplace(Args&& ...) [with Args = {const __xray::profileCollectorService::{anonymous}::ThreadTrie&}; T = __xray::profileCollectorService::{anonymous}::ThreadTrie]’:
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h:383:71:   required from ‘T* __xray::Array<T>::Append(const T&) [with T = __xray::profileCollectorService::{anonymous}::ThreadTrie]’
    /work/llvm/projects/compiler-rt/lib/xray/xray_profile_collector.cc:98:34:   required from here
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h:378:5: error: could not convert ‘{std::forward<const __xray::profileCollectorService::{anonymous}::ThreadTrie&>((* & args#0))}’ from
    ‘<brace-enclosed initializer list>’ to ‘__xray::profileCollectorService::{anonymous}::ThreadTrie’
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h: In instantiation of ‘T* __xray::Array<T>::AppendEmplace(Args&& ...) [with Args = {const __xray::profileCollectorService::{anonymous}::ProfileBuffer&}; T = __xray::profileCollectorService::{anonymous}::ProfileBuffer]’:
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h:383:71:   required from ‘T* __xray::Array<T>::Append(const T&) [with T = __xray::profileCollectorService::{anonymous}::ProfileBuffer]

    /work/llvm/projects/compiler-rt/lib/xray/xray_profile_collector.cc:244:44:   required from here
    /work/llvm/projects/compiler-rt/lib/xray/xray_segmented_array.h:378:5: error: could not convert ‘{std::forward<const __xray::profileCollectorService::{anonymous}::ProfileBuffer&>((* & args#0))}’ from ‘<brace-enclosed initializer list>’ to ‘__xray::profileCollectorService::{anonymous}::ProfileBuffer’

    > Summary:
    > This change makes the allocator and function call trie implementations
    > move-aware and remove the FunctionCallTrie's reliance on a
    > heap-allocated set of allocators.
    >
    > The change makes it possible to always have storage associated with
    > Allocator instances, not necessarily having heap-allocated memory
    > obtainable from these allocator instances. We also use thread-local
    > uninitialised storage.
    >
    > We've also re-worked the segmented array implementation to have more
    > precondition and post-condition checks when built in debug mode. This
    > enables us to better implement some of the operations with surrounding
    > documentation as well. The `trim` algorithm now has more documentation
    > on the implementation, reducing the requirement to handle special
    > conditions, and being more rigorous on the computations involved.
    >
    > In this change we also introduce an initialisation guard, through which
    > we prevent an initialisation operation from racing with a cleanup
    > operation.
    >
    > We also ensure that the ThreadTries array is not destroyed while copies
    > into the elements are still being performed by other threads submitting
    > profiles.
    >
    > Note that this change still has an issue with accessing thread-local
    > storage from signal handlers that are instrumented with XRay. We also
    > learn that with the testing of this patch, that there will be cases
    > where calls to mmap(...) (through internal_mmap(...)) might be called in
    > signal handlers, but are not async-signal-safe. Subsequent patches will
    > address this, by re-using the `BufferQueue` type used in the FDR mode
    > implementation for pre-allocated memory segments per active, tracing
    > thread.
    >
    > We still want to land this change despite the known issues, with fixes
    > forthcoming.
    >
    > Reviewers: mboerger, jfb
    >
    > Subscribers: jfb, llvm-commits
    >
    > Differential Revision: https://reviews.llvm.org/D54989 (detail)
    by hans
  1295. [LICM] *Actually* disable ControlFlowHoisting.

    Summary:
    The remaining code paths that ControlFlowHoisting introduced that were
    not disabled, increased compile time by 3x for some benchmarks.
    The time is spent in DominatorTree updates.

    Reviewers: john.brawn, mkazantsev

    Subscribers: sanjoy, jlebar, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55313 (detail)
    by asbirlea
  1296. Revert "[clang-tidy] new check: bugprone-branch-clone"

    The patch broke on buildbot with assertion-failure. Revert until this
    is figured out. (detail)
    by jonastoth
  1297. [clang-tidy] new check: bugprone-branch-clone

    Summary:
    Implement a check for detecting if/else if/else chains where two or more
    branches are Type I clones of each other (that is, they contain identical code)
    and for detecting switch statements where two or more consecutive branches are
    Type I clones of each other.

    Patch by donat.nagy.

    Reviewers: alexfh, hokein, aaron.ballman, JonasToth

    Reviewed By: JonasToth

    Subscribers: MTC, lebedev.ri, whisperity, xazax.hun, Eugene.Zelenko, mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D54757 (detail)
    by jonastoth
  1298. HowToBuildWithPGO.rst: Fix a few details in the manual steps

    Differential revision: https://reviews.llvm.org/D55268 (detail)
    by hans
  1299. Fix a false positive in misplaced-widening-cast

    Summary:
    bugprone-misplaced-widening-cast check
    used to give a false warning to the
    following example.

    enum DaysEnum{
        MON = 0,
        TUE = 1
        };

    day = (DaysEnum)(day + 1);
    //warning: either cast from 'int' to 'DaysEnum' is ineffective...

    But i think int to enum cast is not widening neither ineffective.

    Patch by dkrupp.

    Reviewers: JonasToth, alexfh

    Reviewed By: alexfh

    Subscribers: rnkovacs, Szelethus, gamesh411, cfe-commits

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D55255 (detail)
    by jonastoth
  1300. [X86] Remove -costmodel-reduxcost=true from the experimental vector reduction intrinsic tests as it appears to be unnecessary. NFC

    I think this has something to do with matching reductions from extractelement, binops, and shuffles. But we're not matching here. (detail)
    by ctopper
  1301. [X86] Add more cost model tests for vector reductions with narrow vector types. NFC (detail)
    by ctopper
  1302. [XRay] Use uptr instead of uintptr_t

    Follow-up to D54989. (detail)
    by dberris
  1303. AArch64: support funclets in fastcall and swift_call

    Functions annotated with `__fastcall` or `__attribute__((__fastcall__))`
    or `__attribute__((__swiftcall__))` may contain SEH handlers even on
    Win64.  This matches the behaviour of cl which allows for
    `__try`/`__except` inside a `__fastcall` function.  This was detected
    while trying to self-host clang on Windows ARM64. (detail)
    by Saleem Abdulrasool
  1304. [XRay] Use deallocateBuffer instead of deallocate

    Follow-up to D54989. (detail)
    by dberris
  1305. [XRay] Move-only Allocator, FunctionCallTrie, and Array

    Summary:
    This change makes the allocator and function call trie implementations
    move-aware and remove the FunctionCallTrie's reliance on a
    heap-allocated set of allocators.

    The change makes it possible to always have storage associated with
    Allocator instances, not necessarily having heap-allocated memory
    obtainable from these allocator instances. We also use thread-local
    uninitialised storage.

    We've also re-worked the segmented array implementation to have more
    precondition and post-condition checks when built in debug mode. This
    enables us to better implement some of the operations with surrounding
    documentation as well. The `trim` algorithm now has more documentation
    on the implementation, reducing the requirement to handle special
    conditions, and being more rigorous on the computations involved.

    In this change we also introduce an initialisation guard, through which
    we prevent an initialisation operation from racing with a cleanup
    operation.

    We also ensure that the ThreadTries array is not destroyed while copies
    into the elements are still being performed by other threads submitting
    profiles.

    Note that this change still has an issue with accessing thread-local
    storage from signal handlers that are instrumented with XRay. We also
    learn that with the testing of this patch, that there will be cases
    where calls to mmap(...) (through internal_mmap(...)) might be called in
    signal handlers, but are not async-signal-safe. Subsequent patches will
    address this, by re-using the `BufferQueue` type used in the FDR mode
    implementation for pre-allocated memory segments per active, tracing
    thread.

    We still want to land this change despite the known issues, with fixes
    forthcoming.

    Reviewers: mboerger, jfb

    Subscribers: jfb, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54989 (detail)
    by dberris
  1306. [X86] Add narrow vector test cases to vector-reduce* tests. Add copies of the tests with -x86-experimental-vector-widening-legalization (detail)
    by ctopper
  1307. [NFC] Verify memoryssa in test for PR39783 (detail)
    by mkazantsev
  1308. [clang-tidy/checks] Update objc-property-declaration check to allow arbitrary acronyms and initialisms 🔧

    Summary:
    §1 Description

    This changes the objc-property-declaration check to allow arbitrary acronyms and initialisms instead of using whitelisted acronyms. In Objective-C it is relatively common to use project prefixes in property names for the purposes of disambiguation. For example, the CIColor¹ and CGColor² properties on UIColor both represent symbol prefixes being used in proeprty names outside of Apple's accepted acronyms³. The union of Apple's accepted acronyms and all symbol prefixes that might be used for disambiguation in property declarations effectively allows for any arbitrary sequence of capital alphanumeric characters to be acceptable in property declarations. This change updates the check accordingly.

    The test variants with custom configurations are deleted as part of this change because their configurations no longer impact behavior. The acronym configurations are currently preserved for backwards compatibility of check configuration.

    [1] https://developer.apple.com/documentation/uikit/uicolor/1621951-cicolor?language=objc
    [2] https://developer.apple.com/documentation/uikit/uicolor/1621954-cgcolor?language=objc
    [3] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE

    §2 Test Notes

    Changes verified by:
    • Running clang-tidy unit tests.
    • Used check_clang_tidy.py to verify expected output of processing objc-property-declaration.m

    Reviewers: benhamilton, Wizard

    Reviewed By: benhamilton

    Subscribers: jfb, cfe-commits

    Differential Revision: https://reviews.llvm.org/D51832 (detail)
    by stephanemoore
  1309. [MachineLICM][X86][AMDGPU] Fix subtle bug in the updating of PhysRegClobbers in post-RA LICM

    It looks like MCRegAliasIterator can visit the same physical register twice. When this happens in this code in LICM we end up setting the PhysRegDef and then later in the same loop visit the register again. Now we see that PhysRegDef is set from the earlier iteration so now set PhysRegClobber.

    This patch splits the loop so we have one that uses the previous value of PhysRegDef to update PhysRegClobber and second loop that updates PhysRegDef.

    The X86 atomic test is an improvement. I had to add sideeffect to the two shrink wrapping tests to prevent hoisting from occurring. I'm not sure about the AMDGPU tests. It looks like the branch instruction changed at end the of the loops. And in the branch-relaxation test I think there is now "and vcc, exec, -1" instruction that wasn't there before.

    Differential Revision: https://reviews.llvm.org/D55102 (detail)
    by ctopper
  1310. Update GET_LINK_MAP_BY_DLOPEN_HANDLE() for NetBSD x86

    NetBSD 8.99.26 changed the layout of internal structure
    returned by dlopen(3), switch to it.

    Set new values for amd64 and i386 based on the results
    of &((struct Struct_Obj_Entry*)0)->linkmap. (detail)
    by kamil
  1311. [clang-query] Continue if compilation command not found for some files

    When searching for a code pattern in an entire project with a
    compilation database it's tempting to run

    ```
    clang-query **.cpp
    ```

    And yet, that often breaks because some files are just not in the
    compilation database: tests, sample code, etc..
    clang-query should not stop when encountering such cases.

    Differential Revision: https://reviews.llvm.org/D51183 (detail)
    by George Karpenkov
  1312. [asan] Add clang flag -fsanitize-address-use-odr-indicator

    Reviewers: eugenis, m.ostapenko, ygribov

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55157 (detail)
    by Vitaly Buka
  1313. [TableGen] Preserve order of output operands in DAGISelMatcherGen

    Summary:
    This fixes support in DAGISelMatcher backend for DAG nodes with multiple
    result values. Previously the order of results in selected DAG nodes always
    matched the order of results in ISel patterns. After the change the order of
    results matches the order of operands in OutOperandList instead.

    For example, given this definition from the attached test case:

      def INSTR : Instruction {
        let OutOperandList = (outs GPR:$r1, GPR:$r0);
        let InOperandList = (ins GPR:$t0, GPR:$t1);
        let Pattern = [(set i32:$r0, i32:$r1, (udivrem i32:$t0, i32:$t1))];
      }

    the DAGISelMatcher backend currently produces a matcher that creates INSTR
    nodes with the first result `$r0` and the second result `$r1`, contrary to the
    order in the OutOperandList. The order of operands in OutOperandList does not
    matter at all, which is unexpected (and unfortunate) because the order of
    results of a DAG node does matters, perhaps a lot.

    With this change, if the order in OutOperandList does not match the order in
    Pattern, DAGISelMatcherGen emits CompleteMatch opcodes with the order of
    results taken from OutOperandList. Backend writers can use it to express
    result reorderings in TableGen.

    If the order in OutOperandList matches the order in Pattern, the result of
    DAGISelMatcherGen is unaffected.

    Patch by Eugene Sharygin

    Reviewers: andreadb, bjope, hfinkel, RKSimon, craig.topper

    Reviewed By: craig.topper

    Subscribers: nhaehnle, craig.topper, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55055 (detail)
    by ctopper
  1314. [Sema] Remove some conditions of a failing assert

    We should have been checking that this state is consistent, but its
    possible for it to be filled later, so it isn't really sound to check
    it here anyways.

    Fixes llvm.org/PR39742 (detail)
    by epilk
  1315. [SelectionDAG] Split very large token factors for loads into 64k chunks.

    There's a 64k limit on the number of SDNode operands, and some very large
    functions with 64k or more loads can cause crashes due to this limit being hit
    when a TokenFactor with this many operands is created. To fix this, create
    sub-tokenfactors if we've exceeded the limit.

    No test case as it requires a very large function.

    rdar://45196621

    Differential Revision: https://reviews.llvm.org/D55073 (detail)
    by aemerson
  1316. [ADT] Add zip_longest iterators.

    Like the already existing zip_shortest/zip_first iterators, zip_longest
    iterates over multiple iterators at once, but has as many iterations as
    the longest sequence.

    This means some iterators may reach the end before others do.
    zip_longest uses llvm::Optional's None value to mark a
    past-the-end value.

    zip_longest is not reverse-iteratable because the tuples iterated over
    would be different for different length sequences (IMHO for the same
    reason neither zip_shortest nor zip_first should be reverse-iteratable;
    one can still reverse the ranges individually if that's the expected
    behavior).

    In contrast to zip_shortest/zip_first, zip_longest tuples contain
    rvalues instead of references. This is because llvm::Optional cannot
    contain reference types and the value-initialized default does not have
    a memory location a reference could point to.

    The motivation for these iterators is to use C++ foreach to compare two
    lists of ordered attributes in D48100 (SemaOverload.cpp and
    ASTReaderDecl.cpp).

    Idea by @hfinkel.

    This re-commits r348301 which was reverted by r348303.
    The compilation error by gcc 5.4 was resolved using make_tuple in the in
    the initializer_list.
    The compileration error by msvc14 was resolved by splitting
    ZipLongestValueType (which already was a workaround for msvc15) into
    ZipLongestItemType and ZipLongestTupleType.

    Differential Revision: https://reviews.llvm.org/D48348 (detail)
    by meinersbur
  1317. LTO: Don't internalize available_externally globals.

    This breaks C and C++ semantics because it can cause the address
    of the global inside the module to differ from the address outside
    of the module.

    Differential Revision: https://reviews.llvm.org/D55237 (detail)
    by pcc
  1318. [AArch64][GlobalISel] Re-enable selection of volatile loads.

    We previously disabled this in r323371 because of a bug where we selected an
    extending load, but didn't delete the old G_LOAD, resulting in two loads being
    generated for volatile loads.

    Since we now have dedicated G_SEXTLOAD/G_ZEXTLOAD operations, and that the
    tablegen patterns should no longer be able to select (ext(load x)) patterns, it
    should be safe to re-enable it.

    The old test case should still work as expected. (detail)
    by aemerson
  1319. Remove the hash code from CVRecord.

    This is no longer used and is just taking up space in the structure.
    Heap allocation of this structure is on the critical path, so space
    actually matters. (detail)
    by zturner
  1320. [clang-tidy] Ignore namespaced and C++ member functions in google-objc-function-naming check 🙈

    Summary: The google-objc-function-naming check applies to functions that are not namespaced and should not be applied to C++ member functions. Such function declarations should be ignored by the check to avoid false positives in Objective-C++ sources.

    Reviewers: benhamilton, aaron.ballman

    Reviewed By: aaron.ballman

    Subscribers: xazax.hun, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55101 (detail)
    by stephanemoore
  1321. [asan] Split -asan-use-private-alias to -asan-use-odr-indicator

    Reviewers: eugenis, m.ostapenko, ygribov

    Subscribers: mehdi_amini, kubamracek, hiraditya, steven_wu, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55156 (detail)
    by Vitaly Buka
  1322. [asan] Remove use_odr_indicator runtime flag

    Summary:
    Flag was added for testing 3 years ago. Probably it's time
    to simplify code and usage by removing it.

    Reviewers: eugenis, m.ostapenko

    Subscribers: mehdi_amini, kubamracek, steven_wu, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55254 (detail)
    by Vitaly Buka
  1323. Fix crash if an in-class explicit function specialization has explicit
    template arguments referring to template paramaeters. (detail)
    by rsmith
  1324. [InstCombine] add tests for implied simplifications; NFC

    Ideally, we would fold all of these in InstSimplify in a
    similar way to rL347896, but this is a bit awkward when
    we're trying to simplify a compare directly because the
    ValueTracking API expects the compare as an input, but
    in InstSimplify, we just have the operands of the compare.

    Given that we can do transforms besides just simplifications,
    we might as well just extend the code in InstCombine (which
    already does simplifications with constant operands). (detail)
    by spatel
  1325. AArch64: clean up some whitespace in Windows CC (NFC)

    Drive by clean up for Windows ARM64 variadic CC (NFC). (detail)
    by Saleem Abdulrasool
  1326. Adding tests for -ast-dump; NFC.

    This adds tests for the definition data of C++ record objects as well as special member functions. (detail)
    by aaronballman
  1327. Add tests for dumping base classes; NFC. (detail)
    by aaronballman
  1328. [llvm-pdbutil] Remove the analyze subcommand.

    Nobody has used this since it was introduced, and it doesn't have
    test coverage. (detail)
    by zturner
  1329. [PDB] Emit S_UDT records in LLD.

    Previously these were dropped.  We now understand them sufficiently
    well to start emitting them.  From the debugger's perspective, this
    now enables us to have debug info about typedefs (both global and
    function-locally scoped)

    Differential Revision: https://reviews.llvm.org/D55228 (detail)
    by zturner
  1330. [AVR] Silence fallthrough warning. NFC. (detail)
    by niravd
  1331. Revert "[ADT] Add zip_longest iterators"

    This reverts commit r348301.

    Compilation fails on buildbots with older versions of gcc and msvc. (detail)
    by meinersbur
  1332. [Documentation] Make options section in Clang-tidy readability-uppercase-literal-suffix consistent with other checks. (detail)
    by eugenezelenko
  1333. [ADT] Add zip_longest iterators

    Like the already existing zip_shortest/zip_first iterators, zip_longest
    iterates over multiple iterators at once, but has as many iterations as
    the longest sequence.

    This means some iterators may reach the end before others do.
    zip_longest uses llvm::Optional's None value to mark a
    past-the-end value.

    zip_longest is not reverse-iteratable because the tuples iterated over
    would be different for different length sequences (IMHO for the same
    reason neither zip_shortest nor zip_first should be reverse-iteratable;
    one can still reverse the ranges individually if that's the expected
    behavior).

    In contrast to zip_shortest/zip_first, zip_longest tuples contain
    rvalues instead of references. This is because llvm::Optional cannot
    contain reference types and the value-initialized default does not have
    a memory location a reference could point to.

    The motivation for these iterators is to use C++ foreach to compare two
    lists of ordered attributes in D48100 (SemaOverload.cpp and
    ASTReaderDecl.cpp).

    Idea by @hfinkel.

    Differential Revision: https://reviews.llvm.org/D48348 (detail)
    by meinersbur
  1334. [PowerPC] Make no-PIC default to match GCC - CLANG

    Make -fno-PIC default on PowerPC LE.

    Differential Revision: https://reviews.llvm.org/D53384 (detail)
    by stefanp
  1335. [PowerPC] Make no-PIC default to match GCC - LLVM

    Change the default for PowerPC LE to -fno-PIC.

    Differential Revision: https://reviews.llvm.org/D53383 (detail)
    by stefanp
  1336. Fix sanitizer unit test (detail)
    by David CARLIER
  1337. [libcxx] Always enable availability in the lit test suite.

    Summary:
    Running the tests without availability enabled doesn't really make sense:
    availability annotations allow catching errors at compile-time instead
    of link-time. Running the tests without availability enabled allows
    confirming that a test breaks at link-time under some configuration,
    but it is more useful to instead check that it should fail at compile-time.

    Always enabling availability in the lit test suite will greatly simplify
    XFAILs and troubleshooting of failing tests, which is currently a giant
    pain because we have these two levels of possible failure: link-time and
    compile-time.

    Reviewers: EricWF, mclow.lists

    Subscribers: christof, jkorous, dexonsmith, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D55079 (detail)
    by Louis Dionne
  1338. Unbreak build due to style. (detail)
    by David CARLIER
  1339. [Sanitizer] intercept part of sysctl Api

    - Distringuish what FreeBSD/NetBSD can and NetBSD specifics.
    - Fixing page size value collection.

    Reviewers: krytarowski, vitalybuka

    Reviewed By: krytarowski

    Differential Revision: https://reviews.llvm.org/D55265 (detail)
    by David CARLIER
  1340. [CmpInstAnalysis] fix function signature for ICmp code to predicate; NFC

    The old function underspecified the return type, took an unused parameter,
    and had a misleading name. (detail)
    by spatel
  1341. Move llc-start-stop-instance to x86

    Avoid bot failures where the host pass
    setup might not have 2 dead-mi-elimination runs (detail)
    by arsenm
  1342. [SelectionDAG] Redefine isGAPlusOffset in terms of unwrapAddress. NFCI. (detail)
    by niravd
  1343. AMDGPU: Add f32 vectors to SGPR register classes (detail)
    by arsenm
  1344. MIR: Add method to stop after specific runs of passes

    Currently if you use -{start,stop}-{before,after}, it picks
    the first instance with the matching pass name. If you run
    the same pass multiple times, there's no way to distinguish them.

    Allow specifying a run index wih ,N to specify which you mean. (detail)
    by arsenm
  1345. [InstCombine] rearrange foldICmpWithDominatingICmp; NFC

    Move it out from under the constant check, reorder
    predicates, add comments. This makes it easier to
    extend to handle the non-constant case. (detail)
    by spatel
  1346. [dsymutil] Ensure we're comparing time stamps with the same precision.

    After TimePoint's precision was increased in LLVM we started seeing
    failures because the modification times didn't match. This adds a time
    cast to ensure that we're comparing TimePoints with the same amount of
    precision. (detail)
    by Jonas Devlieghere
  1347. [X86][SSE] Add SimplifyDemandedBitsForTargetNode handling for MOVMSK

    Moves existing SimplifyDemandedBits call out of combineMOVMSK and add SimplifyDemandedVectorElts call based on the sign bits we need. (detail)
    by rksimon
  1348. [AST] Assert that no type class is polymorphic

    Add a static_assert checking that no type class is polymorphic.
    People should use LLVM style RTTI instead.

    Differential Revision: https://reviews.llvm.org/D55225

    Reviewed By: aaron.ballman (detail)
    by brunoricci
  1349. Revert "Avoid emitting redundant or unusable directories in DIFile metadata entries."

    This reverts commit r348154 and follow-up commits r348211 and r3248213.
    Reason: the original commit broke compiler-rt tests and a follow-up fix
    (r348203) broke our integrate and was reverted. (detail)
    by ibiryukov
  1350. Revert "Adapt gcov to changes in CFE."

    This reverts commit r348203.
    Reason: this produces absolute paths in .gcno files, breaking us
    internally as we rely on them being consistent with the filenames passed
    in the command line.

    Also reverts r348157 and r348155 to account for revert of r348154 in
    clang repository. (detail)
    by ibiryukov
  1351. [AST] Assert that no statement/expression class is polymorphic

    Add a static_assert checking that no statement/expression class
    is polymorphic. People should use LLVM style RTTI instead.

    Differential Revision: https://reviews.llvm.org/D55222

    Reviewed By: aaron.ballman (detail)
    by brunoricci
  1352. [X86][SSE] Add MOVMSK demandedbits/elts tests (detail)
    by rksimon
  1353. [AST][NFC] Make ArrayTypeTraitExpr non polymorphic

    ArrayTypeTraitExpr is the only expression class which is polymorphic.
    As far as I can tell this is completely pointless.

    Differential Revision: https://reviews.llvm.org/D55221

    Reviewed By: aaron.ballman (detail)
    by brunoricci
  1354. [Hexagon] Update builtin definitions (detail)
    by kparzysz
  1355. [InstCombine] auto-generate full checks for icmp overflow tests; NFC (detail)
    by spatel
  1356. [InstCombine] add helper for icmp with dominator; NFC

    There's a potential small enhancement to this code that could
    solve the cases currently under proposal in D54827 via SimplifyCFG.

    Whether instcombine should be doing this kind of semi-non-local
    analysis in the first place is an open question, but separating
    the logic out can only help if/when we decide to move it to a
    different pass.

    AFAICT, any proposal to do this in SimplifyCFG could also be seen
    as an overreach + it would be incomplete to start the fold from a
    branch rather than an icmp.

    There's another question here about the code for processUGT_ADDCST_ADD().
    That part may be completely dead after rL234638 ? (detail)
    by spatel
  1357. [OPENMP][NVPTX]Fixed emission of the critical region.

    Critical regions in NVPTX are the constructs, which, generally speaking,
    are not supported by the NVPTX target. Instead we're using special
    technique to handle the critical regions. Currently they are supported
    only within the loop and all the threads in the loop must execute the
    same critical region.
    Inside of this special regions the regions still must be emitted as
    critical, to avoid possible data races between the teams +
    synchronization must use __kmpc_barrier functions. (detail)
    by abataev
  1358. [OPENMP][NVPTX]Mark __kmpc_barrier functions as convergent.

    __kmpc_barrier runtime functions must be marked as convergent to prevent
    some dangerous optimizations. Also, for NVPTX target all barriers must
    be emitted as simple barriers. (detail)
    by abataev
  1359. [InstCombine] auto-generate full checks for icmp dominator tests; NFC (detail)
    by spatel
  1360. [Hexagon] Remove unused checker functions from asm parser (detail)
    by kparzysz
  1361. Remove reference to recently removed PTH Documentation.

    Removed in r348266

    Change-Id: Icff0212f57c42ca84ec174ddd4366ae63a7923fa (detail)
    by erichkeane
  1362. [SimpleLoopUnswitch] Remove debug dump. (detail)
    by asbirlea
  1363. PTH-- Remove feature entirely-

    When debugging a boost build with a modified
    version of Clang, I discovered that the PTH implementation
    stores TokenKind in 8 bits. However, we currently have 368
    TokenKinds.

    The result is that the value gets truncated and the wrong token
    gets picked up when including PTH files. It seems that this will
    go wrong every time someone uses a token that uses the 9th bit.

    Upon asking on IRC, it was brought up that this was a highly
    experimental features that was considered a failure. I discovered
    via googling that BoostBuild (mostly Boost.Math) is the only user of
    this
    feature, using the CC1 flag directly. I believe that this can be
    transferred over to normal PCH with minimal effort:
    https://github.com/boostorg/build/issues/367

    Based on advice on IRC and research showing that this is a nearly
    completely unused feature, this patch removes it entirely.

    Note: I considered leaving the build-flags in place and making them
    emit an error/warning, however since I've basically identified and
    warned the only user, it seemed better to just remove them.

    Differential Revision: https://reviews.llvm.org/D54547

    Change-Id: If32744275ef1f585357bd6c1c813d96973c4d8d9 (detail)
    by erichkeane
  1364. Add common check prefix. NFCI. (detail)
    by rksimon
  1365. [yaml2obj] Move redundant statements into a separate static function

    Reviewers: jhenderson, grimar

    Reviewed By: jhenderson

    Subscribers: jakehehrlich, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55220 (detail)
    by Xing
  1366. Update MemorySSA in SimpleLoopUnswitch.

    Summary:
    Teach SimpleLoopUnswitch to preserve MemorySSA.

    Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits

    Differential Revision: https://reviews.llvm.org/D47022 (detail)
    by asbirlea
  1367. Fix "array must be initialized with a brace-enclosed initializer" build error.

    Try to fix clang-bpf-build buildbot. (detail)
    by rksimon
  1368. [SanitizerCommon] Test `CombinedAllocator::ForEachChunk()` in unit tests.

    Summary:

    Previously we weren't testing this function in the unit tests.

    Reviewers: kcc, cryptoad, dvyukov, eugenis, kubamracek

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54861 (detail)
    by delcypher
  1369. [GN][NFC] Update readme example to functional command

    `ninja -C out/gn check-lld` is not a valid command yet

    Differential revision: https://reviews.llvm.org/D54840 (detail)
    by martell
  1370. [X86][NFC] Add more constant-size memcmp tests. (detail)
    by courbet
  1371. Fix MSVC "unknown pragma" warning. NFCI. (detail)
    by rksimon
  1372. Fix -Wparentheses warning. NFCI. (detail)
    by rksimon
  1373. [X86] Remove unnecessary peekThroughEXTRACT_SUBVECTORs call.

    The GetSplatValue/IsSplatVector call will call this anyhow and the later code is just for a v2i64 type so doesn't need it. (detail)
    by rksimon
  1374. [clangd] Partition include graph on auto-index.

    Summary:
    Partitions include graphs in auto-index so that each shards contains
    only part of the include graph related to itself.

    Reviewers: ilya-biryukov

    Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55062 (detail)
    by kadircet
  1375. [TargetLowering] expandFP_TO_UINT - avoid FPE due to out of range conversion (PR17686)

    PR17686 demonstrates that for some targets FP exceptions can fire in cases where the FP_TO_UINT is expanded using a FP_TO_SINT instruction.

    The existing code converts both the inrange and outofrange cases using FP_TO_SINT and then selects the result, this patch changes this for 'strict' cases to pre-select the FP_TO_SINT input and the offset adjustment.

    The X87 cases don't need the strict flag but generates much nicer code with it....

    Differential Revision: https://reviews.llvm.org/D53794 (detail)
    by rksimon
  1376. Revert rL348121 from llvm/trunk: [NFC][AArch64] Split out backend features

    This patch splits backend features currently
    hidden behind architecture versions.

    For example, currently the only way to activate
    complex numbers extension is targeting an v8.3
    architecture, where after the patch this extension
    can be added separately.

    This refactoring is required by the new command lines proposal:
    http://lists.llvm.org/pipermail/llvm-dev/2018-September/126346.html

    Reviewers: DavidSpickett, olista01, t.p.northover

    Subscribers: kristof.beyls, bryanpkc, javed.absar, pbarrio

    Differential revision: https://reviews.llvm.org/D54633

    ........

    This has been causing buildbots failures for the past 24 hours: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/14386 (detail)
    by rksimon
  1377. Revert r348243 "[llvm-mc] - Do not crash when referencing undefined debug sections."

    It broke msan and asan bots it seems:
    http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26794/steps/check-llvm%20msan/logs/stdio
    http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20993/steps/ninja%20check%201/logs/stdio (detail)
    by grimar
  1378. [SystemZ] Do not support __float128

    As of rev. 268898, clang supports __float128 on SystemZ.  This seems to
    have been in error.  GCC has never supported __float128 on SystemZ,
    since the "long double" type on the platform is already IEEE-128. (GCC
    only supports __float128 on platforms where "long double" is some other
    data type.)

    For compatibility reasons this patch removes __float128 on SystemZ
    again.  The test case is updated accordingly. (detail)
    by uweigand
  1379. [TargetLowering] Add SimplifyDemandedVectorElts support to EXTEND opcodes

    Add support for ISD::*_EXTEND and ISD::*_EXTEND_VECTOR_INREG opcodes.

    The extra broadcast in trunc-subvector.ll will be fixed in an upcoming patch. (detail)
    by rksimon
  1380. [Analyzer] Iterator Checker - Forbid decrements past the begin() and increments past the end() of containers

    Previously, the iterator range checker only warned upon dereferencing of
    iterators outside their valid range as well as increments and decrements of
    out-of-range iterators where the result remains out-of-range. However, the C++
    standard is more strict than this: decrementing begin() or incrementing end()
    results in undefined behaviour even if the iterator is not dereferenced
    afterwards. Coming back to the range once out-of-range is also undefined.

    This patch corrects the behaviour of the iterator range checker: warnings are
    given for any operation whose result is ahead of begin() or past the end()
    (which is the past-end iterator itself, thus now we are speaking of past
    past-the-end).

    Differential Revision: https://reviews.llvm.org/D53812 (detail)
    by baloghadamsoftware
  1381. [Analyzer] Iterator Checkers - Use the region of the topmost base class for iterators stored in a region

    If an iterator is represented by a derived C++ class but its comparison operator
    is for its base the iterator checkers cannot recognize the iterators compared.
    This results in false positives in very straightforward cases (range error when
    dereferencing an iterator after disclosing that it is equal to the past-the-end
    iterator).

    To overcome this problem we always use the region of the topmost base class for
    iterators stored in a region. A new method called getMostDerivedObjectRegion()
    was added to the MemRegion class to get this region.

    Differential Revision: https://reviews.llvm.org/D54466 (detail)
    by baloghadamsoftware
  1382. [llvm-mc] - Do not crash when referencing undefined debug sections.

    MC has code that pre-creates few debug sections:
    https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCObjectFileInfo.cpp#L396

    If users code has a reference to such section but does not redefine it,
    MC code currently asserts, because still thinks they are normally defined.

    The patch fixes the issue.

    Differential revision: https://reviews.llvm.org/D55173 (detail)
    by grimar
  1383. [llvm-dwarfdump] - Dump the older versions of .eh_frame/.debug_frame correctly.

    The issue is the following.

    DWARF 2 used version 1 for .debug_frame.
    (Appendix G, p. 416 http://dwarfstd.org/doc/DWARF5.pdf)

    lib/MC now always sets version 1 for .eh_frame (and sets 1-4 versions for .debug_frame correctly):
    https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCDwarf.cpp#L1530
    https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCDwarf.cpp#L1562
    https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCDwarf.cpp#L1602

    In version 1, return_address_register was defined as ubyte, while other versions
    switched to uleb128.
    (p 62, http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf)

    Patch teaches llvm-dwarfdump about this difference.

    Differential revision: https://reviews.llvm.org/D54860 (detail)
    by grimar
  1384. Extend test for DependentSizedArrayType

    Use a using declaration to force the type to appear in the -ast-dump
    output. (detail)
    by steveire
  1385. [WIP][Sema] Improve static_assert diagnostics for type traits.

    Summary:
    In our codebase, `static_assert(std::some_type_trait<Ts...>::value, "msg")`
    (where `some_type_trait` is an std type_trait and `Ts...` is the
    appropriate template parameters) account for 11.2% of the `static_assert`s.

    In these cases, the `Ts` are typically not spelled out explicitly, e.g.
    `static_assert(std::is_same<SomeT::TypeT, typename SomeDependentT::value_type>::value, "message");`

    The diagnostic when the assert fails is typically not very useful, e.g.
    `static_assert failed due to requirement 'std::is_same<SomeT::TypeT, typename SomeDependentT::value_type>::value' "message"`

    This change makes the diagnostic spell out the types explicitly , e.g.
    `static_assert failed due to requirement 'std::is_same<int, float>::value' "message"`

    See tests for more examples.

    After this is submitted, I intend to handle
    `static_assert(!std::some_type_trait<Ts...>::value, "msg")`,
    which is another 6.6% of static_asserts.

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D54903 (detail)
    by courbet
  1386. Remove unnecessary include. (detail)
    by rtrieu
  1387. [X86] Remove custom DAG combine for SIGN_EXTEND_VECTOR_INREG/ZERO_EXTEND_VECTOR_INREG.

    We only needed this because it provided really aggressive constant folding even through constant pool entries created from build_vectors. The main case was for vXi8 MULH legalization which was happening as part of legalize DAG instead of as part of legalize vector ops. Now its part of vector op legalization and we've added special handling for build vectors of all constants there. This has removed the need for this code on the list tests we have. (detail)
    by ctopper
  1388. [compiler-rt] Use the new zx_futex_wait for Fuchsia sanitizer runtime

    This finishes the soft-transition to the new primitive that implements
    priority inheritance.

    Differential Revision: https://reviews.llvm.org/D55244 (detail)
    by phosek
  1389. [analyzer] MoveChecker: Add more common state resetting methods.

    Includes "resize" and "shrink" because they can reset the object to a known
    state in certain circumstances.

    Differential Revision: https://reviews.llvm.org/D54563 (detail)
    by dergachev
  1390. [Sema] Provide -fvisibility-global-new-delete-hidden option

    When the global new and delete operators aren't declared, Clang
    provides and implicit declaration, but this declaration currently
    always uses the default visibility. This is a problem when the
    C++ library itself is being built with non-default visibility because
    the implicit declaration will force the new and delete operators to
    have the default visibility unlike the rest of the library.

    The existing workaround is to use assembly to enforce the visiblity:
    https://fuchsia.googlesource.com/zircon/+/master/system/ulib/zxcpp/new.cpp#108
    but that solution is not always available, e.g. in the case of of
    libFuzzer which is using an internal version of libc++ that's also built
    with -fvisibility=hidden where the existing behavior is causing issues.

    This change introduces a new option -fvisibility-global-new-delete-hidden
    which makes the implicit declaration of the global new and delete
    operators hidden.

    Differential Revision: https://reviews.llvm.org/D53787 (detail)
    by phosek
  1391. Fix -Wmismatched-tags to not warn on redeclarations of structs in system
    headers.

    Previously, we would only check whether the new declaration is in a
    system header, but that requires the user to be able to correctly guess
    whether a declaration in a system header is declared as a struct or a
    class when specializing standard library traits templates.

    We now entirely ignore declarations for which the warning was disabled
    when determining whether to warn on a tag mismatch.

    Also extend the diagnostic message to clarify that
    a) code containing such a tag mismatch is in fact valid and correct,
        and
    b) the (non-coding-style) reason to emit such a warning is that the
        Microsoft C++ ABI is broken and includes the tag kind in decorated
        names,
    as it seems a lot of users are confused by our diagnostic here (either
    not understanding why we produce it, or believing that it represents an
    actual language rule). (detail)
    by rsmith
  1392. Improve the regerror(3) interceptor

    The res returned value might differ with REAL(strlen)(errbuf) + 1,
    as the buffer's value is limited with errbuf_size.

    Hot fix for D54584. (detail)
    by kamil
  1393. Reverting r348215

    Causing failures on ubsan buildbot boxes. (detail)
    by rsingh
  1394. [analyzer] MoveChecker: Improve warning and note messages.

    The warning piece traditionally describes the bug itself, i.e.
    "The bug is a _____", eg. "Attempt to delete released memory",
    "Resource leak", "Method call on a moved-from object".

    Event pieces produced by the visitor are usually in a present tense, i.e.
    "At this moment _____": "Memory is released", "File is closed",
    "Object is moved".

    Additionally, type information is added into the event pieces for STL objects
    (in order to highlight that it is in fact an STL object), and the respective
    event piece now mentions that the object is left in an unspecified state
    after it was moved, which is a vital piece of information to understand the bug.

    Differential Revision: https://reviews.llvm.org/D54560 (detail)
    by dergachev
  1395. Add interceptors for the sysctl(3) API family from NetBSD

    Summary:
    Add new interceptors for:

    - sysctl
    - sysctlbyname
    - sysctlgetmibinfo
    - sysctlnametomib
    - asysctl
    - asysctlbyname

    Cover the API with a new test file TestCases/NetBSD/sysctl.cc.

    Reviewers: joerg, vitalybuka

    Reviewed By: vitalybuka

    Subscribers: devnexen, kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54076 (detail)
    by kamil
  1396. Add interceptors for the fts(3) API family from NetBSD

    Summary:
    fts(3) is API to traverse a file hierarchy.
    Cover this interface with interceptors.

    Add a test to validate the interface reading
    the number of regular files in /etc.

    Based on original work by Yang Zheng.

    Reviewers: joerg, vitalybuka

    Reviewed By: vitalybuka

    Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54247 (detail)
    by kamil
  1397. [TableGen] Improve the formatting of the emitted predicates (NFC) (detail)
    by evandro
  1398. [TableGen] Fix typo in emitted comment (NFC) (detail)
    by evandro
  1399. Add new interceptor for regex(3) in NetBSD

    Summary:
    Add interceptors for the NetBSD style of regex(3) present inside libc:

    - regcomp
    - regexec
    - regerror
    - regfree
    - regnsub
    - regasub

    Add a dedicated test verifying the installed interceptors.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D54584 (detail)
    by kamil
  1400. [ExecutionEngine] Change NotifyObjectEmitted/NotifyObjectFreed API.

    This patch renames both methods (NotifyObjectEmitted -> notifyObjectLoaded, and
    NotifyObjectFreed -> notifyObjectFreed), adds an abstract "ObjectKey" (uint64_t)
    parameter to notifyObjectLoaded, and replaces the ObjectFile parameter for
    notifyObjectFreed with an ObjectKey. Using an ObjectKey to track identify
    events, rather than a reference to the ObjectFile, allows us to free the
    ObjectFile after notifyObjectLoaded is called, saving memory.

    https://reviews.llvm.org/D53773 (detail)
    by Lang Hames
  1401. [ARM64][Windows] Fix local stack size for funclets

    The comment was misplaced, and the code didn't do what the comment indicated,
    namely ignoring the varargs portion when computing the local stack size of a
    funclet in emitEpilogue.  This results in incorrect offset computations within
    funclets that are contained in vararg functions.

    Differential Revision: https://reviews.llvm.org/D55096 (detail)
    by ssijaric
  1402. [asan] Reduce binary size by using unnamed private aliases

    Summary:
    --asan-use-private-alias increases binary sizes by 10% or more.
    Most of this space was long names of aliases and new symbols.
    These symbols are not needed for the ODC check at all.

    Reviewers: eugenis

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55146 (detail)
    by Vitaly Buka
  1403. [MachineOutliner] Move stack instr check logic to getOutliningCandidateInfo

    This moves the stack check logic into a lambda within getOutliningCandidateInfo.

    This allows us to be less conservative with stack checks. Whether or not a
    stack instruction is safe to outline is dependent on the frame variant and call
    variant of the outlined function; only in cases where we modify the stack can
    these be unsafe.

    So, if we move that logic later, when we're looking at an individual candidate,
    we can make better decisions here.

    This gives some code size savings as a result. (detail)
    by paquette
  1404. [MachineOutliner][AArch64][NFC] Add early exit to candidate discarding logic

    If we dropped too many candidates to be beneficial when dropping candidates
    that modify the stack, there's no reason to check for other cost model
    qualities. (detail)
    by paquette
  1405. NFC: Make this test kinder on downstream forks

    Downstream forks that have their own attributes often run into this
    test failing when a new attribute is added to clang because the
    number of supported attributes no longer match. This is redundant
    information for this test, so we can get by without it.

    rdar://46288577 (detail)
    by epilk
  1406. [projects] Use directory name for add_llvm_external_projects

    add_llvm_external_projects expects the directory name instead of the
    full path, otherwise the check for an in-tree subproject will fail and
    the project won't be configured. (detail)
    by smeenai
  1407. [ThinLTO] Look through aliases when computing hash keys

    Without this, we don't consider types used by aliasees in our cache key.
    This caused issues when using the same cache for thin-linking the same
    TU with different sets of virtual call candidates for a virtual call
    inside of a constructor. That's sort of a mouthful. :)

    Differential Revision: https://reviews.llvm.org/D55060 (detail)
    by George Burgess IV
  1408. [IR] Don't assume all functions are 4 byte aligned

    In some cases different alignments for function might be used to save
    space e.g. thumb mode with -Oz will try to use 2 byte function
    alignment. Similar patch that fixed this in other areas exists here
    https://reviews.llvm.org/D46110

    Differential Revision: https://reviews.llvm.org/D55115 (detail)
    by rsingh
  1409. [Hexagon] Fix intrinsic test (detail)
    by kparzysz
  1410. Relax test even more for Windows (detail)
    by Adrian Prantl
  1411. Remove unused empty arm64 directory (detail)
    by kongyi
  1412. Relax tests to also work on Windows (detail)
    by Adrian Prantl
  1413. [analyzer] MoveChecker: Restrict to locals and std:: objects.

    In general case there use-after-move is not a bug. It depends on how the
    move-constructor or move-assignment is implemented.

    In STL, the convention that applies to most classes is that the move-constructor
    (-assignment) leaves an object in a "valid but unspecified" state. Using such
    object without resetting it to a known state first is likely a bug. Objects

    Local value-type variables are special because due to their automatic lifetime
    there is no intention to reuse space. If you want a fresh object, you might
    as well make a new variable, no need to move from a variable and than re-use it.
    Therefore, it is not always a bug, but it is obviously easy to suppress when it
    isn't, and in most cases it indeed is - as there's no valid intention behind
    the intentional use of a local after move.

    This applies not only to local variables but also to parameter variables,
    not only of value type but also of rvalue reference type (but not to lvalue
    references).

    Differential Revision: https://reviews.llvm.org/D54557 (detail)
    by dergachev
  1414. NFC: Add .vscode to .gitignore (detail)
    by gornishanov
  1415. [analyzer] MoveChecker: NFC: Remove the workaround for the "zombie symbols" bug.

    The checker had extra code to clean up memory regions that were sticking around
    in the checker without ever being cleaned up due to the bug that was fixed in
    r347953. Because of that, if a region was moved from, then became dead,
    and then reincarnated, there were false positives.

    Why regions are even allowed to reincarnate is a separate story. Luckily, this
    only happens for local regions that don't produce symbols when loaded from.

    No functional change intended. The newly added test demonstrates that even
    though no cleanup is necessary upon destructor calls, the early return
    cannot be removed. It was not failing before the patch.

    Differential Revision: https://reviews.llvm.org/D54372 (detail)
    by dergachev
  1416. [Hexagon] Switch to auto-generated intrinsic definitions and patterns (detail)
    by kparzysz
  1417. [CodeExtractor] Split PHI nodes with incoming values from outlined region (PR39433)

    If a PHI node out of extracted region has multiple incoming values from it,
    split this PHI on two parts. First PHI has incomings only from region and
    extracts with it (they are placed to the separate basic block that added to the
    list of outlined), and incoming values in original PHI are replaced by first
    PHI. Similar solution is already used in CodeExtractor for PHIs in entry block
    (severSplitPHINodes method). It covers PR39433 bug.

    Patch by Sergei Kachkov!

    Differential Revision: https://reviews.llvm.org/D55018 (detail)
    by Vedant Kumar
  1418. Adapt gcov to changes in CFE.

    The clang frontend no longer emits the current working directory for
    DIFiles containing an absolute path in the filename: and will move the
    common prefix between current working directory and the file into the
    directory: component.

    This fixes the GCOV tests in compiler-rt that were broken by the Clang
    change. (detail)
    by Adrian Prantl
  1419. [Documentation] Fix formatting and wrap up to 80 characters in Clang-tidy readability-uppercase-literal-suffix documentation. (detail)
    by eugenezelenko
  1420. [analyzer] Rename MisusedMovedObjectChecker to MoveChecker

    This follows the Static Analyzer's tradition to name checkers after
    things in which they find bugs, not after bugs they find.

    Differential Revision: https://reviews.llvm.org/D54556 (detail)
    by dergachev
  1421. [analyzer] Dump stable identifiers for objects under construction.

    This continues the work that was started in r342313, which now gets applied to
    object-under-construction tracking in C++. Makes it possible to debug
    temporaries by dumping exploded graphs again.

    Differential Revision: https://reviews.llvm.org/D54459 (detail)
    by dergachev
  1422. [AST] [analyzer] NFC: Reuse code in stable ID dumping methods.

    Use the new fancy method introduced in r348197 to simplify some code.

    Differential Revision: https://reviews.llvm.org/D54488 (detail)
    by dergachev
  1423. [AST] Generate unique identifiers for CXXCtorInitializer objects.

    This continues the work started in r342309 and r342315 to provide identifiers
    to AST objects that are shorter and easier to read and remember than pointers.

    Differential Revision: https://reviews.llvm.org/D54457 (detail)
    by dergachev
  1424. BumpPtrAllocator: Add a couple of convenient wrappers around identifyObject().

    This allows obtaining smaller, more readable identifiers
    in a more comfortable way.

    Differential Revision: https://reviews.llvm.org/D54486 (detail)
    by dergachev
  1425. [Hexagon] Extract operand decoders into a separate file, NFC

    These decoders are automatically generated. Keeping them separated makes
    updating architectures easier. (detail)
    by kparzysz
  1426. [DAGCombiner] narrow truncated vector binops when legal
     
    This is the smallest vector enhancement I could find to D54640.
    Here, we're allowing narrowing to only legal vector ops because we'll see
    regressions without that. All of the test diffs are wins from what I can tell.
    With AVX/AVX512, we can shrink ymm/zmm ops to xmm.

    x86 vector multiplies are the problem case that we're avoiding due to the
    patchwork ISA, and it's not clear to me if we can dance around those
    regressions using TLI hooks or if we need preliminary patches to plug those
    holes.

    Differential Revision: https://reviews.llvm.org/D55126 (detail)
    by spatel
  1427. [mips] Fix TestDWARF32Version5Addr8AllForms test failure on MIPS hosts

    The `DIEExpr` is used in debug information entries for either TLS variables
    or call sites. For now the last case is unsupported for targets with delay
    slots, for MIPS in particular.

    The `DIEExpr::EmitValue` method calls a virtual `EmitDebugThreadLocal`
    routine which, in case of MIPS, always emits either `.dtprelword` or
    `.dtpreldword` directives. That is okay for "main" code, but in unit
    tests `DIEExpr` instances can be created not for TLS variables only even
    on MIPS hosts. That is a reason of the `TestDWARF32Version5Addr8AllForms`
    failure because handling of the `R_MIPS_TLS_DTPREL` relocation writes
    incorrect value into dwarf structures. And anyway unconditional emitting
    of `.dtprelword` directives will be incorrect when/if debug information
    entries for call sites become supported on MIPS.

    The patch solves the problem by wrapping expression created in the
    `MipsTargetObjectFile::getDebugThreadLocalSymbol` method in to the
    `MipsMCExpr` expression with a new `MEK_DTPREL` tag. This tag is
    recognized in the `MipsAsmPrinter::EmitDebugThreadLocal` method and
    `.dtprelword` directives created in this case only. In other cases the
    expression saved as a regular data.

    Differential Revision: http://reviews.llvm.org/D54937 (detail)
    by atanasyan
  1428. [Hexagon] Remove unused encodings, NFC (detail)
    by kparzysz
  1429. Typo correction; NFC. (detail)
    by aaronballman
  1430. [InstCombine] fix undef propagation bug with shuffle+binop

    When we have a shuffle that extends a source vector with undefs
    and then do some binop on that, we must make sure that the extra
    elements remain undef with that binop if we reverse the order of
    the binop and shuffle.

    'or' is probably the easiest example to show the bug because
    'or C, undef --> -1' (not undef). But there are other
    opcode/constant combinations where this is true as shown by
    the 'shl' test. (detail)
    by spatel
  1431. [gn build] Use print_function in write_cmake_config.py

    No behavior change, just makes the script match the other scripts in
    llvm/utils/gn/build.

    Differential Revision: https://reviews.llvm.org/D55183 (detail)
    by nico
  1432. NFC: Simplify dumpStmt child handling

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55068 (detail)
    by steveire
  1433. Re-apply r347954 "[analyzer] Nullability: Don't detect post factum violation..."

    Buildbot failures were caused by an unrelated UB that was introduced in r347943
    and fixed in r347970.

    Also the revision was incorrectly specified as r344580 during revert.

    Differential Revision: https://reviews.llvm.org/D54017 (detail)
    by dergachev
  1434. [gcov/Darwin] Ensure external symbols are exported when using an export list

    Make sure that symbols needed to implement runtime support for gcov are
    exported when using an export list on Darwin.

    Without the clang driver exporting these symbols, the linker hides them,
    resulting in tapi verification failures.

    rdar://45944768

    Differential Revision: https://reviews.llvm.org/D55151 (detail)
    by Vedant Kumar
  1435. [WebAssembly] Enforce assembler emits to streamer in order.

    Summary:
    The assembler processes directives and instructions in whatever order
    they are in the file, then directly emits them to the streamer. This
    could cause badly written (or generated) .s files to produce
    incorrect binaries.

    It now has state that tracks what it has most recently seen, to
    enforce they are emitted in a given order that always produces
    correct wasm binaries.

    Also added a new test that compares obj2yaml output from llc (the
    backend) to that going via .s and the assembler to ensure both paths
    generate the same binaries.

    The features this test covers could be extended.

    Passes all wasm Lit tests.

    Fixes: https://bugs.llvm.org/show_bug.cgi?id=39557

    Reviewers: sbc100, dschuff, aheejin

    Subscribers: jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55149 (detail)
    by aardappel
  1436. Portable Python script across Python version

    Workaround naming and hierarchy changes in BaseHTTPServer and SimpleHTTPServer module.

    Differential Revision: https://reviews.llvm.org/D55203 (detail)
    by serge_sans_paille
  1437. [Hexagon] Update timing classes (detail)
    by kparzysz
  1438. Portable Python script across Python version

    Python2 supports both backticks and `repr` to access the __repr__ slot. Python3 only supports `repr`.

    Differential Revision: https://reviews.llvm.org/D55201 (detail)
    by serge_sans_paille
  1439. [InstCombine] foldICmpWithLowBitMaskedVal(): disable 2 faulty folds.

    These two folds are invalid for this non-constant pattern
    when the mask ends up being all-ones:
    https://rise4fun.com/Alive/9au
    https://rise4fun.com/Alive/UcQM

    Fixes https://bugs.llvm.org/show_bug.cgi?id=39861 (detail)
    by lebedevri
  1440. [cmake] Clean up add_llvm_subdirectory

    I found the pattern of setting the project_BUILD variable to OFF after
    processing the project to be pretty confusing. Using global properties
    to explicitly keep track of whether a project has been processed or not
    seems much more straightforward, and it also allows us to convert the
    macro into a function (which is required for the early return).

    Factor the project+type+name combination out into a variable while I'm
    here, since it's used a whole bunch of times.

    I don't believe this should result in any functional changes.

    Differential Revision: https://reviews.llvm.org/D55104 (detail)
    by smeenai
  1441. [TextAPI] Remove a superfluous semicolon, fixing GCC warnings. NFC. (detail)
    by mstorsjo
  1442. [COFF] Remove an outdated/incorrect comment. NFC.

    Making the section writable doesn't affect how windows does
    base relocs in case a DLL can't be loaded at the intended base
    address.

    This comment dates back to SVN r79346.

    Differential Revision: (detail)
    by mstorsjo
  1443. [COFF] Don't mark mingw .eh_frame sections writable

    This improves compatibility with GCC produced object files, where
    the .eh_frame sections are read only. With mixed flags for the
    involved .eh_frame sections, LLD creates two separate .eh_frame
    sections in the output binary, one for each flag combination,
    while ld.bfd probably merges them.

    The previous setup of flags can be traced back to SVN r79346.

    Differential Revision: https://reviews.llvm.org/D55209 (detail)
    by mstorsjo
  1444. Fix compilation failure on Windows.

    This was introduced earlier but apparently used an incorrect
    class name so it doesn't compile on Windows. (detail)
    by zturner
  1445. [InstCombine] rearrange shuffle+binop fold; NFC

    This code has a bug dealing with undefs, so we need
    to add another escape hatch, so doing some cleanup
    ahead of that. (detail)
    by spatel
  1446. [llvm-objcopy] Add --build-id-link-dir flag

    This flag does not exist in GNU objcopy but has a major use case.
    Debugging tools support the .build-id directory structure to find
    debug binaries. There is no easy way to build this structure up
    however. One way to do it is by using llvm-readelf and some crazy
    shell magic. This implements the feature directly. It is most often
    the case that you'll want to strip a file and send the original to
    the .build-id directory but if you just want to send a file to the
    .build-id directory you can copy to /dev/null instead.

    Differential Revision: https://reviews.llvm.org/D54384 (detail)
    by jakehehrlich
  1447. [InstCombine] add tests for shuffle+binop fold; NFC (detail)
    by spatel
  1448. [clang-tidy] Fix unordered_map failure with specializing std::hash<> and remove previous wrong attempt at doing so (detail)
    by jonastoth
  1449. [Hexagon] Change instruction type field in TSFlags to 7 bits (detail)
    by kparzysz
  1450. [llvm-tapi] initial commit, supports ELF text stubs

    http://lists.llvm.org/pipermail/llvm-dev/2018-September/126472.html

    TextAPI is a library and accompanying tool that allows conversion between binary shared object stubs and textual counterparts. The motivations and uses cases for this are explained thoroughly in the llvm-dev proposal [1]. This initial commit proposes a potential structure for the TAPI library, also including support for reading/writing text-based ELF stubs (.tbe) in addition to preliminary support for reading binary ELF files. The goal for this patch is to ensure the project architecture appropriately welcomes integration of Mach-O stubbing from Apple's TAPI [2].

    Added:

    - TextAPI library
    - .tbe read support
    - .tbe write (to raw_ostream) support

    [1] http://lists.llvm.org/pipermail/llvm-dev/2018-September/126472.html
    [2] https://github.com/ributzka/tapi

    Differential Revision: https://reviews.llvm.org/D53051 (detail)
    by amontanez
  1451. [clang-tidy] Recommit: Add the abseil-duration-comparison check

    Summary:
    This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration.  See documentation for examples.

    This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks.
    Compilation is unbroken, because the hash-function is now directly
    specified for std::unordered_map, as 'enum class' does not compile as
    key (seamingly only on some compilers).

    Patch by hwright.

    Reviewers: aaron.ballman, JonasToth, alexfh, hokein

    Reviewed By: JonasToth

    Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D54737 (detail)
    by jonastoth
  1452. [MachineOutliner] Drop candidates that require fixups if it's beneficial

    If it's a bigger code size win to drop candidates that require stack fixups
    than to demote every candidate to that variant, the outliner should do that.

    This happens if the number of bytes taken by calls to functions that don't
    require fixups, plus the number of bytes that'd be left is less than the
    number of bytes that it'd take to emit a save + restore for all candidates.

    Also add tests for each possible new behaviour.

    - machine-outliner-compatible-candidates shows that when we have candidates
    that don't use the stack, we can use the default call variant along with the
    no save/regsave variant.

    - machine-outliner-all-stack shows that when it's better to fix up the stack,
    we still will demote all candidates to that case

    - machine-outliner-drop-stack shows that we can discard candidates that
    require stack fixups when it would be beneficial to do so. (detail)
    by paquette
  1453. [Hexagon] Add HasV5 predicate for compatibility with auto-generated files (detail)
    by kparzysz
  1454. Fix issue with Tpi Stream hash map.

    Part of the patch to not build the hash map eagerly was omitted
    due to a merge conflict.  Add it back, which should fix the failing
    tests. (detail)
    by zturner
  1455. Revert "[clang-tidy] Add the abseil-duration-comparison check"

    This commit broke buildbots and needs adjustments. (detail)
    by jonastoth
  1456. [X86] Fix bad formatting. NFC (detail)
    by ctopper
  1457. [Hexagon] Remove unused operand definitions, NFC (detail)
    by kparzysz
  1458. [Hexagon] Some formatting changes, NFC (detail)
    by kparzysz
  1459. [clang-tidy] Add the abseil-duration-comparison check

    Summary:
    This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration.  See documentation for examples.

    This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks.

    Patch by hwright.

    Reviewers: aaron.ballman, JonasToth, alexfh, hokein

    Reviewed By: JonasToth

    Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D54737 (detail)
    by jonastoth
  1460. Don't build the Tpi Hash map by default.

    This is very slow and should be done for specific cases where
    lookups will need to happen. (detail)
    by zturner
  1461. [X86] Teach LowerMUL/LowerMULH for vXi8 to unpack constant RHS.

    Summary:
    We need to unpackl and unpackh the operands to use two vXi16 multiplies. Previously it looks like the low unpack would get constant folded at least in the 128-bit case after shuffle lowering turned the unpackl into ZERO_EXTEND_VECTOR_INREG and X86 custom DAG combined it. The same doesn't happen for the high half. So we'd load a constant and then shuffle it. But the low half would just be loaded and used by the multiply directly.

    After this patch we now end up with a constant pool entry for the low and high unpacks separately with no shuffle operations.

    This is a step towards removing custom constant folding for ZERO_EXTEND_VECTOR_INREG/SIGN_EXTEND_VECTOR_INREG in the X86 backend.

    Reviewers: RKSimon, spatel

    Reviewed By: RKSimon

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55165 (detail)
    by ctopper
  1462. [X86] Add DAG combine to combine a v8i32->v8i16 truncate with a packuswb that truncates v8i16->v8i8.

    Summary:
    Under -x86-experimental-vector-widening-legalization, fp_to_uint/fp_to_sint with a smaller than 128 bit vector type results are custom type legalized by promoting the result to a 128 bit vector by promoting the elements, inserting an assertzext/assertsext, then truncating back to original type. The truncate will be further legalizdd to a pack shuffle. In the case of a v8i8 result type, we'll end up with a v8i16 fp_to_sint. This will need to be further legalized during vector op legalization by promoting to v8i32 and then truncating again. Under avx2 this produces good code with two pack instructions, but Under avx512 this will result in a truncate instruction and a packuswb instruction. But we should be able to get away with a single truncate instruction.

    The other option is to promote all the way to vXi32 result type during the first type legalization. But in some experimentation that seemed to require more work to produce good code for other configurations.

    Reviewers: RKSimon, spatel

    Reviewed By: RKSimon

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54836 (detail)
    by ctopper
  1463. Fix non-modular build. (detail)
    by Adrian Prantl
  1464. Adding tests for -ast-dump; NFC.

    This adds tests for struct and union declarations in C++. (detail)
    by aaronballman
  1465. Update Diagnostic handling for changes in CFE.

    The clang frontend no longer emits the current working directory for
    DIFiles containing an absolute path in the filename: and will move the
    common prefix between current working directory and the file into the
    directory: component.

    https://reviews.llvm.org/D55085 (detail)
    by Adrian Prantl
  1466. Avoid emitting redundant or unusable directories in DIFile metadata entries.

    As discussed on llvm-dev recently, Clang currently emits redundant
    directories in DIFile entries, such as

      .file      1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c"

    This patch looks at any common prefix between the compilation
    directory and the (absolute) file path and strips the redundant
    part. More importantly it leaves the compilation directory empty if
    the two paths have no common prefix.

    After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"):

      .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c"

    When building the FileCheck binary with debug info, this patch makes
    the build artifacts ~1kb smaller.

    Differential Revision: https://reviews.llvm.org/D55085 (detail)
    by Adrian Prantl
  1467. [SimplifyCFG] add tests for cross block compare folding; NFC

    These are the baseline tests for D54827.
    Patch based on code originally written by: @yinyuefengyi (luo xionghu)

    Differential Revision: https://reviews.llvm.org/D54994 (detail)
    by spatel
  1468. [Serialization][NFC] Remove pointless "+ 0" in ASTReader

    Remove the pointless "+ 0" which I added for some reason when
    modifying these statement/expression classes since it looks
    like this is a typo. Following the suggestion of aaron.ballman
    in D54902. NFC. (detail)
    by brunoricci
  1469. [CmpInstAnalysis] fix formatting; NFC

    There are potential improvements to the structure of this API
    raised by D54994, but remove some cosmetic blemishes before
    making any functional changes. (detail)
    by spatel
  1470. [clangd] Avoid memory-mapping files on Windows

    Summary:
    Memory-mapping files on Windows leads to them being locked and prevents
    editors from saving changes to those files on disk. This is fine for the
    compiler, but not acceptable for an interactive tool like clangd.
    Therefore, we choose to avoid using memory-mapped files on Windows.

    Reviewers: hokein, kadircet

    Reviewed By: kadircet

    Subscribers: yvvan, zturner, nik, malaperle, mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55139 (detail)
    by ibiryukov
  1471. Fix line endings. NFCI. (detail)
    by rksimon
  1472. [AST][Sema] Remove CallExpr::setNumArgs

    CallExpr::setNumArgs is the only thing that prevents storing the arguments
    in a trailing array. There is only 3 places in Sema where setNumArgs is called.
    D54900 dealt with one of them.

    This patch remove the other two calls to setNumArgs in ConvertArgumentsForCall.
    To do this we do the following changes:

    1.) Replace the first call to setNumArgs by an assertion since we are moving the
    responsability to allocate enough space for the arguments from
    Sema::ConvertArgumentsForCall to its callers
    (which are Sema::BuildCallToMemberFunction, and Sema::BuildResolvedCallExpr).

    2.) Add a new member function CallExpr::shrinkNumArgs, which can only be used
    to drop arguments and then replace the second call to setNumArgs by
    shrinkNumArgs.

    3.) Add a new defaulted parameter MinNumArgs to CallExpr and its derived
    classes which specifies a minimum number of argument slots to allocate.
    The actual number of arguments slots allocated will be
    max(number of args, MinNumArgs) with the extra args nulled. Note that
    after the creation of the call expression all of the arguments will be
    non-null. It is just during the creation of the call expression that some of
    the last arguments can be temporarily null, until filled by default arguments.

    4.) Update Sema::BuildCallToMemberFunction by passing the number of parameters
    in the function prototype to the constructor of CXXMemberCallExpr. Here the
    change is pretty straightforward.

    5.) Update Sema::BuildResolvedCallExpr. Here the change is more complicated
    since the type-checking for the function type was done after the creation of
    the call expression. We need to move this before the creation of the call
    expression, and then pass the number of parameters in the function prototype
    (if any) to the constructor of the call expression.

    6.) Update the deserialization of CallExpr and its derived classes.

    Differential Revision: https://reviews.llvm.org/D54902

    Reviewed By: aaron.ballman (detail)
    by brunoricci
  1473. Fixing -print-module-scope for legacy SCC passes

    It appears that print-module-scope was not implemented for legacy SCC passes.
    Fixed to print a whole module instead of just current SCC.

    Reviewed By: mkazantsev
    Differential Revision: https://reviews.llvm.org/D54793 (detail)
    by fedor.sergeev
  1474. [AArch64] Add command-line option for SSBS

    Summary:
    SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
    onwards but is optional from Armv8.0-A. This patch adds testing for
    the ssbs command line option, added to allow enabling the feature
    in previous Armv8-A architectures to 8.5.

    Reviewers: olista01, samparker, aemerson

    Reviewed By: samparker

    Subscribers: javed.absar, kristof.beyls, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54961 (detail)
    by pabbar01
  1475. [SystemZ::TTI]  Return zero cost for ICmp that becomes Load And Test.

    A loaded value with multiple users compared with 0 will become a load and
    test single instruction. The load is not folded in this case (multiple
    users), but the compare instruction is eliminated.

    This patch returns 0 cost for the icmp in these cases.

    Review: Ulrich Weigand
    https://reviews.llvm.org/D55111 (detail)
    by jonpa
  1476. [SanitizerCommon] Remove RenameFile

    This function seems to be no longer used by compiler-rt
    libraries

    Differential revision: https://reviews.llvm.org/D55123 (detail)
    by evgeny777
  1477. [OpenCL][Sema] Improving formatting

    Reformat comment added in r348120 following
    review https://reviews.llvm.org/D55136. (detail)
    by mantognini
  1478. [libcxx] Implement P0318: unwrap_ref_decay and unwrap_reference

    Summary:
    This was voted into C++20 in San Diego. Note that there was a revision
    D0318R2 which did include unwrap_reference_t, but we mistakingly voted
    P0318R1 into the C++20 Working Draft (which does not include
    unwrap_reference_t). This patch implements D0318R2, which is what
    we'll end up with in the Working Draft once this mistake has been
    fixed.

    Reviewers: EricWF, mclow.lists

    Subscribers: christof, dexonsmith, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54485 (detail)
    by Louis Dionne
  1479. [AArch64] Add command-line option for SSBS

    Summary:
    SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
    onwards but is optional from Armv8.0-A. This patch adds a command
    line option to enable SSBS, as it was previously only possible to
    enable by selecting -march=armv8.5-a.

    Similar patch upstream in GNU binutils:
    https://sourceware.org/ml/binutils/2018-09/msg00274.html

    Reviewers: olista01, samparker, aemerson

    Reviewed By: samparker

    Subscribers: javed.absar, kristof.beyls, kristina, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54629 (detail)
    by pabbar01
  1480. [CodeComplete] Cleanup access checking in code completion

    Summary: Also fixes a crash (see the added 'accessibility-crash.cpp' test).

    Reviewers: ioeric, kadircet

    Reviewed By: kadircet

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55124 (detail)
    by ibiryukov
  1481. [Sema] Avoid CallExpr::setNumArgs in Sema::BuildCallToObjectOfClassType

    CallExpr::setNumArgs is the only thing that prevents storing the arguments
    of a call expression in a trailing array since it might resize the argument
    array. setNumArgs is only called in 3 places in Sema, and for all of them it
    is possible to avoid it.

    This deals with the call to setNumArgs in BuildCallToObjectOfClassType.
    Instead of constructing the CXXOperatorCallExpr first and later calling
    setNumArgs if we have default arguments, we first construct a large
    enough SmallVector, do the promotion/check of the arguments, and
    then construct the CXXOperatorCallExpr.

    Incidentally this also avoid reallocating the arguments when the
    call operator has default arguments but this is not the primary goal.

    Differential Revision: https://reviews.llvm.org/D54900

    Reviewed By: aaron.ballman (detail)
    by brunoricci
  1482. [clangd] Fix a stale comment, NFC. (detail)
    by hokein
  1483. [AMDGPU] Add sdwa support for ADD|SUB U64 decomposed Pseudos

    The introduction of S_{ADD|SUB}_U64_PSEUDO instructions which are decomposed
    into VOP3 instruction pairs for S_ADD_U64_PSEUDO:
      V_ADD_I32_e64
      V_ADDC_U32_e64
    and for S_SUB_U64_PSEUDO
      V_SUB_I32_e64
      V_SUBB_U32_e64
    preclude the use of SDWA to encode a constant.
    SDWA: Sub-Dword addressing is supported on VOP1 and VOP2 instructions,
    but not on VOP3 instructions.

    We desire to fold the bit-and operand into the instruction encoding
    for the V_ADD_I32 instruction. This requires that we transform the
    VOP3 into a VOP2 form of the instruction (_e32).
      %19:vgpr_32 = V_AND_B32_e32 255,
          killed %16:vgpr_32, implicit $exec
      %47:vgpr_32, %49:sreg_64_xexec = V_ADD_I32_e64
          %26.sub0:vreg_64, %19:vgpr_32, implicit $exec
    %48:vgpr_32, dead %50:sreg_64_xexec = V_ADDC_U32_e64
          %26.sub1:vreg_64, %54:vgpr_32, killed %49:sreg_64_xexec, implicit $exec

    which then allows the SDWA encoding and becomes
      %47:vgpr_32 = V_ADD_I32_sdwa
          0, %26.sub0:vreg_64, 0, killed %16:vgpr_32, 0, 6, 0, 6, 0,
          implicit-def $vcc, implicit $exec
      %48:vgpr_32 = V_ADDC_U32_e32
          0, %26.sub1:vreg_64, implicit-def $vcc, implicit $vcc, implicit $exec


    Differential Revision: https://reviews.llvm.org/D54882 (detail)
    by ronlieb
  1484. [AST] Fix an uninitialized bug in the bits of FunctionDecl

    FunctionDeclBits.IsCopyDeductionCandidate was not initialized.
    This caused a warning with valgrind. (detail)
    by brunoricci
  1485. [clangd] Get rid of AST matchers in CodeComplete, NFC

    Summary:
    The isIndexedForCodeCompletion is called in the code patch of
    SymbolCollector.

    Reviewers: kadircet

    Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55206 (detail)
    by hokein
  1486. Portable Python script across Python version

    Python3 does not support type destructuring in function parameters.

    Differential Revision: https://reviews.llvm.org/D55198 (detail)
    by serge_sans_paille
  1487. [AST][NFC] Pack CXXDeleteExpr

    Use the newly available space in the bit-fields of Stmt.
    This saves 8 bytes per CXXDeleteExpr. NFC. (detail)
    by brunoricci
  1488. Portable Python script across version

    Have all classes derive from object: that's implicitly the default in Python3,
    it needs to be done explicilty in Python2.

    Differential Revision: https://reviews.llvm.org/D55121 (detail)
    by serge_sans_paille
  1489. Portable Python script across Python version

    Python2 supports the two following equivalent construct

    raise ExceptionType, exception_value
    and
    raise ExceptionType(exception_value)

    Only the later is supported by Python3.

    Differential Revision: https://reviews.llvm.org/D55195 (detail)
    by serge_sans_paille
  1490. [Analyzer] Actually check for -model-path being a directory

    The original patch (r348038) clearly contained a typo and checked
    for '-ctu-dir' twice. (detail)
    by ibiryukov
  1491. [Analysis] Properly prepare test env in test/Analysis/undef-call.c

    The test expectes the '%T/ctudir' to be present, but does not create it. (detail)
    by ibiryukov
  1492. [clang] Do not read from 'test/SemaCXX/Inputs' inside 'test/AST'

    Our integrate relies on test inputs being taken from the same diretory as the
    test itself. (detail)
    by ibiryukov
  1493. ARM: use target-specific SUBS node when combining cmp with cmov.

    This has two positive effects. First, using a custom node prevents
    recombination leading to an infinite loop since the output DAG is notionally a
    little more complex than the input one. Using a flag-setting instruction also
    allows the subtraction to be folded with the related comparison more easily.

    https://reviews.llvm.org/D53190 (detail)
    by Tim Northover
  1494. [NFC][AArch64] Split out backend features

    This patch splits backend features currently
    hidden behind architecture versions.

    For example, currently the only way to activate
    complex numbers extension is targeting an v8.3
    architecture, where after the patch this extension
    can be added separately.

    This refactoring is required by the new command lines proposal:
    http://lists.llvm.org/pipermail/llvm-dev/2018-September/126346.html

    Reviewers: DavidSpickett, olista01, t.p.northover

    Subscribers: kristof.beyls, bryanpkc, javed.absar, pbarrio

    Differential revision: https://reviews.llvm.org/D54633 (detail)
    by dnsampaio
  1495. [OpenCL][Sema] Improve BuildResolvedCallExpr handling of builtins

    Summary:
    This is a follow-up on https://reviews.llvm.org/D52879, addressing a few issues.

    This:
    - adds a FIXME for later improvement for specific builtins: I previously have only checked OpenCL ones and ensured tests cover those.
    - fixed the CallExpr type.



    Reviewers: riccibruno

    Reviewed By: riccibruno

    Subscribers: yaxunl, Anastasia, kristina, svenvh, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55136 (detail)
    by mantognini
  1496. [CMake] Add LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR for custom dSYM target directory on Darwin

    Summary: When using `LLVM_EXTERNALIZE_DEBUGINFO` in LLDB, the default dSYM location for the shared library in LLDB.framework is inside the framework bundle. With `LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR` we can easily fix that. I consider it a useful feature to be able to set a global output directory for external debug info (rather then having a target-specific one). Only implemented for Darwin so far.

    Reviewers: beanz, aprantl

    Reviewed By: aprantl

    Subscribers: mgorny, aprantl, #lldb, lldb-commits, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55114 (detail)
    by stefan.graenitz
  1497. [RISCV] Fix test/MC/Disassembler/RISCV/invalid-instruction.txt after rL347988

    The test for [0x00 0x00] failed due to the introduction of c.unimp.

    This particular test is unnecessary now that c.unimp was defined (and is
    tested in test/MC/RISCV/rv32c-valid.s). (detail)
    by asb
  1498. [CMake] Store path to vendor-specific headers in clang-headers target property

    Summary:
    LLDB.framework wants a copy these headers. With this change LLDB can easily glob for the list of files:
    ```
    get_target_property(clang_include_dir clang-headers RUNTIME_OUTPUT_DIRECTORY)
    file(GLOB_RECURSE clang_vendor_headers RELATIVE ${clang_include_dir} "${clang_include_dir}/*")
    ```

    By default `RUNTIME_OUTPUT_DIRECTORY` is unset for custom targets like `clang-headers`.

    Reviewers: aprantl, JDevlieghere, davide, friss, dexonsmith

    Reviewed By: JDevlieghere

    Subscribers: mgorny, #lldb, cfe-commits, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55128 (detail)
    by stefan.graenitz
  1499. [llvm-dwarfdump] - Stop printing the bogus empty section name on invalid dwarf.

    When there is no .debug_addr section for some reason,
    llvm-dwarfdump would print the bogus empty section name when dumping ranges
    in .debug_info:

    DW_AT_ranges [DW_FORM_rnglistx]   (indexed (0x0) rangelist = 0x00000004
        [0x0000000000000000, 0x0000000000000001) ""
        [0x0000000000000000, 0x0000000000000002) "")

    That happens because of the code which uses 0 (zero) as a section index as a default value.
    The code should use -1ULL instead because technically 0 is a valid zero section index
    in ELF and -1ULL is a special constant used that means "no section available".

    This is mostly a fix for the overall correctness/safety of the code,
    but a test case is provided too.

    Differential revision: https://reviews.llvm.org/D55113 (detail)
    by grimar
  1500. [ARM][MC] Move information about variadic register defs into tablegen

    Currently, variadic operands on an MCInst are assumed to be uses,
    because they come after the defs. However, this is not always the case,
    for example the Arm/Thumb LDM instructions write to a variable number of
    registers.

    This adds a property of instruction definitions which can be used to
    mark variadic operands as defs. This only affects MCInst, because
    MachineInstruction already tracks use/def per operand in each instance
    of the instruction, so can already represent this.

    This property can then be checked in MCInstrDesc, allowing us to remove
    some special cases in ARMAsmParser::isITBlockTerminator.

    Differential revision: https://reviews.llvm.org/D54853 (detail)
    by olista01
  1501. [ARM][Asm] Debug trace for the processInstruction loop

    In the Arm assembly parser, we first match an instruction, then call
    processInstruction to possibly change it to a different encoding, to
    match rules in the architecture manual which can't be expressed by the
    table-generated matcher.

    This adds debug printing so that this process is visible when using the
    -debug option.

    To support this, I've added a new overload of MCInst::dump_pretty which
    takes the opcode name as a StringRef, since we don't have an InstPrinter
    instance in the assembly parser. Instead, we can get the same
    information directly from the MCInstrInfo.

    Differential revision: https://reviews.llvm.org/D54852 (detail)
    by olista01
  1502. [KMSAN] Enable -msan-handle-asm-conservative by default

    This change enables conservative assembly instrumentation in KMSAN builds
    by default.
    It's still possible to disable it with -msan-handle-asm-conservative=0
    if something breaks. It's now impossible to enable conservative
    instrumentation for userspace builds, but it's not used anyway. (detail)
    by glider
  1503. [GlobalISel] Fix test irtranslator-stackprotect-check.ll

    Fix for commit r347862. Use correct AArch64 triple in test
    CodeGen/AArch64/GlobalISel/irtranslator-stackprotect-check.ll. (detail)
    by petr.pavlu
  1504. [ARM] FP16: support vld1.16 for vector loads with post-increment

    Differential Revision: https://reviews.llvm.org/D55112 (detail)
    by sjoerdmeijer
  1505. [PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction

    Summary:
    There are 4 instructions which have Inconsistent ImmMustBeMultipleOf in the
    function PPCInstrInfo::instrHasImmForm, they are LFS, LFD, STFS, STFD.
    These four instructions should set the ImmMustBeMultipleOf to 1 instead of 4.

    Reviewed By: steven.zhang

    Differential Revision: https://reviews.llvm.org/D54738 (detail)
    by zhangkang
  1506. [NFC] [PowerPC] add an routine in PPCTargetLowering to determine if a global is accessed as got-indirect or not.

    In theory, we should let the PPC target to determine how to lower the TOC Entry for globals.
    And the PPCTargetLowering requires this query to do some optimization for TOC_Entry.

    Differential Revision: https://reviews.llvm.org/D54925 (detail)
    by qshanz
  1507. [gn build] Fix cosmetic bug in write_cmake_config.py

    Before, #cmakedefine FOO resulted in #define FOO  with a trailing space if FOO
    was set to something truthy. Make it so that it's just #define FOO without a
    trailing space.

    No functional difference.

    Differential Revision: https://reviews.llvm.org/D55172 (detail)
    by nico
  1508. [gn build] Slightly simplify write_cmake_config.

    Before, the script had a bunch of special cases for #cmakedefine and
    #cmakedefine01 and then did general variable substitution. Now, the script
    always does general variable substitution for all lines and handles the special
    cases afterwards.

    This has no observable effect for the inputs we use, but is easier to explain
    and slightly easier to implement.

    Also mention to link to CMake's configure_file() in the docstring.

    (The new behavior doesn't quite match CMake on lines like #cmakedefine ${FOO},
    but nobody does that.)

    Differential Revision: https://reviews.llvm.org/D55171 (detail)
    by nico
  1509. [gn build] Add build files for llvm/lib/Analysis and llvm/lib/ProfileData

    Differential Revision: https://reviews.llvm.org/D55166 (detail)
    by nico
  1510. [X86] Add a DAG combine to turn stores of vXi1 on pre-avx512 targets into a bitcast and a store of a iX scalar. (detail)
    by ctopper
  1511. [X86] Fix bad comment. NFC (detail)
    by ctopper
  1512. Add myself to netbsd buildbot mails (detail)
    by mgorny
  1513. Replace FullComment member being visited with parameter

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55070 (detail)
    by steveire
  1514. Extend the CommentVisitor with parameter types

    Summary:
    This has precedent in the StmtVisitor.  This change will make it
    possible to clean up the comment handling in ASTDumper.

    Reviewers: aaron.ballman

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55069 (detail)
    by steveire
  1515. Remove unecessary methods

    The base class calls VisitExpr (detail)
    by steveire
  1516. lldb-amd64-ninja-netbsd8: Enable running tests (detail)
    by mgorny
  1517. [test] Fix use of 'sort -b' in SimpleLoopUnswitch on NetBSD

    Add '-k 1' to 'sort -b' calls in SimpleLoopUnswitch tests, as required
    for sort implementation on NetBSD.  The '-b' modifier is ineffective
    if specified without any key.  Per the manpage:

      Note that the -b option has no effect unless key fields are specified.

    Differential Revision: https://reviews.llvm.org/D55168 (detail)
    by mgorny
  1518. [test] Fix ScalarEvolution test to allow __func__ with prototype

    Fix ScalarEvolution/solve-quadratic.ll test to account for __func__
    output listing the complete function prototype rather than just its
    name, as it does on NetBSD.

    Example Linux output:

      GetQuadraticEquation: addrec coeff bw: 4
      GetQuadraticEquation: equation -2x^2 + -2x + -4, coeff bw: 5, multiplied by 2

    Example NetBSD output:

      llvm::Optional<std::tuple<llvm::APInt, llvm::APInt, llvm::APInt, llvm::APInt, unsigned int> > GetQuadraticEquation(const llvm::SCEVAddRecExpr*): addrec coeff bw: 4
      llvm::Optional<std::tuple<llvm::APInt, llvm::APInt, llvm::APInt, llvm::APInt, unsigned int> > GetQuadraticEquation(const llvm::SCEVAddRecExpr*): equation -2x^2 + -2x + -4, coeff bw: 5, multiplied by 2

    Differential Revision: https://reviews.llvm.org/D55162 (detail)
    by mgorny
  1519. [test] Fix BugPoint/compile-custom.ll to use detected python exec

    Spawn the custom compile command in BugPoint/compile-custom.ll via
    %python rather than relying on implicit 'env python' shebang, in order
    to fix it on systems that don't have 'python' executable such as NetBSD.

    Differential Revision: https://reviews.llvm.org/D55161 (detail)
    by mgorny
  1520. Fix whitespace (detail)
    by steveire
  1521. Add dump tests for ArrayInitLoopExpr and ArrayInitIndexExpr (detail)
    by steveire
  1522. [ValueTracking] Support funnel shifts in computeKnownBits()

    If the shift amount is known, we can determine the known bits of the
    output based on the known bits of two inputs.

    This is essentially the same functionality as implemented in D54869,
    but for ValueTracking rather than InstCombine SimplifyDemandedBits.

    Differential Revision: https://reviews.llvm.org/D55140 (detail)
    by nikic
  1523. [SelectionDAG] fold constant with undef vector per element

    This makes the SDAG behavior consistent with the way we do this in IR.
    It's possible that we were getting the wrong answer before. For example,
    'xor undef, undef --> 0' but 'xor undef, C' --> undef.

    But the most practical improvement is likely as shown in the tests here -
    for FP, we were overconstraining undef lanes to NaN, and that can prevent
    vector simplifications/narrowing (see D51553). (detail)
    by spatel
  1524. [DAGCombiner] guard against an oversized shift crash

    This change prevents the crash noted in the post-commit comments
    for rL347478 :
    http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181119/605166.html

    We can't guarantee that an oversized shift amount is folded away,
    so we have to check for it.

    Note that I committed an incomplete fix for that crash with:
    rL347502

    But as discussed here:
    http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181126/605679.html
    ...we have to try harder.

    So I'm not sure how to expose the bug now (and apparently no fuzzers have found
    a way yet either).

    On the plus side, we have discovered that we're missing real optimizations by
    not simplifying nodes sooner, so the earlier fix still has value, and there's
    likely more value in extending that so we can simplify more opcodes and simplify
    when doing RAUW and/or putting nodes on the combiner worklist.

    Differential Revision: https://reviews.llvm.org/D54954 (detail)
    by spatel
  1525. [ValueTracking] add helper function for testing implied condition; NFCI

    We were duplicating code around the existing isImpliedCondition() that
    checks for a predecessor block/dominating condition, so make that a
    wrapper call. (detail)
    by spatel
  1526. [X86] Simplify LowerBITCAST code for v2i32/v4i16/v8i8/i64->mmx/i64/f64 bitcast.

    Previously this code generated its own extracts and build_vector. But we can use a simpler concat_vectors or scalar_to_vector operation and let type legalization do additional legalization of those operations. (detail)
    by ctopper
  1527. [X86] Add custom type legalization for v2i32/v4i16/v8i8->mmx bitcasts to avoid a store/load to/from the stack.

    Widen the input to a 128 bit vector by padding with undef elements. Then use a movdq2q to convert from xmm register to mmx register. (detail)
    by ctopper
  1528. [X86] Custom type legalize v2i32/v4i16/v8i8->i64 bitcasts in 64-bit mode similar to what's done when the destination is f64.

    The generic legalizer will fall back to a stack spill that uses a truncating store. That store will get expanded into a shuffle and non-truncating store on pre-avx512 targets. Once that happens the stack store/load pair will be combined away leaving behind the shuffle and bitcasts. On avx512 targets the truncating store is legal so doesn't get folded away.

    By custom legalizing it we can avoid this churn and maybe produce better code. (detail)
    by ctopper
  1529. OpenCL: Improve vector printf warnings

    The vector modifier is considered separate, so
    don't treat it as a conversion specifier.

    This is still not warning on some cases, like
    using a type that isn't a valid vector element.

    Fixes bug 39652 (detail)
    by arsenm
  1530. OpenCL: Extend argument promotion rules to vector types

    The spec is ambiguous on whether vector types are allowed to be
    implicitly converted. The only legal context I think this can
    be used for OpenCL is printf, where it seems necessary. (detail)
    by arsenm
  1531. [X86] Add vXi8 division/remainder by non-splat constant test cases to prepare for an upcoming patch. (detail)
    by ctopper
  1532. [MachineOutliner][AArch64] Improve checks for stack instructions

    If we know that we'll definitely save LR to a register, there's no reason to
    pre-check whether or not a stack instruction is unsafe to fix up.

    This makes it so that we check for that condition before mapping instructions.

    This allows us to outline more, since we don't pessimise as many instructions.

    Also update some tests, since we outline more. (detail)
    by paquette
  1533. Replace w16/w17 in machine-outliner.mir with w11/w12

    These registers should not be used here, since they are interprocedural
    scratch registers in AArch64. (detail)
    by paquette
  1534. [X86] Don't use zero_extend_vector_inreg for mulhu lowering with sse 4.1

    Summary: With sse4.1 we use two zero_extend_vector_inreg and a pshufd to expand the v16i8 input into two v8i16 vectors for the multiply. That's 3 shuffles to extend one operand. The other operand is usually constant as this is mostly used by division by constant optimization. Pre sse4.1 we use a punpckhbw and a punpcklbw with a zero vector. That's two shuffles and an xor and a copy due to tied register constraints. That seems maybe better than the 3 shuffles. With AVX we avoid the copy so that's obviously better.

    Reviewers: spatel, RKSimon

    Reviewed By: RKSimon

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55138 (detail)
    by ctopper
  1535. Introduce a way to allow the ASan dylib on Darwin platforms to be loaded via `dlopen()`.

    Summary:

    The purpose of this option is provide a way for the ASan dylib
    to be loaded via `dlopen()` without triggering most initialization
    steps (e.g. shadow memory set up) that normally occur when the
    ASan dylib is loaded.

    This new functionality is exposed by

    - A `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` macro which indicates if the
      feature is supported. This only true for Darwin currently.
    - A `HandleDlopenInit()` function which should return true if the library
      is being loaded via `dlopen()` and
      `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` is supported. Platforms that
      support this may perform any initialization they wish inside this
      function.

    Although disabling initialization is something that could potentially
    apply to other sanitizers it appears to be unnecessary for other
    sanitizers so this patch only makes the change for ASan.

    rdar://problem/45284065

    Reviewers: kubamracek, george.karpenkov, kcc, eugenis, krytarowski

    Subscribers: #sanitizers, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54469 (detail)
    by delcypher
  1536. [TTI] Reduction costs only need to include a single extract element cost (REAPPLIED)

    We were adding the entire scalarization extraction cost for reductions, which returns the total cost of extracting every element of a vector type.

    For reductions we don't need to do this - we just need to extract the 0'th element after the reduction pattern has completed.

    Fixes PR37731

    Rebased and reapplied after being reverted in rL347541 due to PR39774 - which was fixed by D54955/rL347759 and D55017/rL347997

    Differential Revision: https://reviews.llvm.org/D54585 (detail)
    by rksimon
  1537. [AMDGPU] Split 64-Bit XNOR to 64-Bit NOT/XOR

    The identity ~(x ^ y) == (~x ^ y) == (x ^ ~y) allows XNOR (XOR/NOT) to turn into NOT/XOR. Handling this case with its own split means we can make the NOT remain in the scalar unit. Previously, we split 64-bit XNOR into two 32-bit XNOR, then lowered. Now, we get three instructions (s_not, v_xor, v_xor) rather than four in the case where either of the sources is a scalar 64-bit.

    Add test cases to xnor.ll to attempt XNOR Vx, Sy and XNOR Sx, Vy. Also adding test that uses the opposite identity such that (~x ^ y) on the scalar unit (or vector for gfx906) can generate XNOR. This already worked, but I didn't see a test for it.

    Differential: https://reviews.llvm.org/D55071 (detail)
    by gsellers
  1538. [llvm-readobj] Improve dynamic section iteration NFC. (detail)
    by Xing
  1539. [SelectionDAG] Improve SimplifyDemandedBits to SimplifyDemandedVectorElts simplification

    D52935 introduced the ability for SimplifyDemandedBits to call SimplifyDemandedVectorElts through BITCASTs if the demanded bit mask entirely covered the sub element.

    This patch relaxes this to demanding an element if we need any bit from it.

    Differential Revision: https://reviews.llvm.org/D54761 (detail)
    by rksimon
  1540. [InstCombine] Support ssub.sat canonicalization for non-splats

    Extend ssub.sat(X, C) -> sadd.sat(X, -C) canonicalization to also
    support non-splat vector constants. This is done by generalizing
    the implementation of the isNotMinSignedValue() helper to return
    true for constants that are non-splat, but don't contain any
    signed min elements.

    Differential Revision: https://reviews.llvm.org/D55011 (detail)
    by nikic
  1541. Correct indentation. (detail)
    by void
  1542. Specify constant context in constant emitter

    The constant emitter may need to evaluate the expression in a constant context.
    For exasmple, global initializer lists. (detail)
    by void
  1543. [X86] Remove stale FIXME from test case. NFC

    This was fixed in r346581. I just forgot to remove it. (detail)
    by ctopper
  1544. [ThinLTO] Allow importing of functions with var args

    Summary:
    Follow up to D54270, which allowed importing of var args functions
    unless they called va_start. As pointed out in the post-commit comments
    on that patch, the inliner can handle functions that call va_start in
    certain situations as well. Go ahead and enable importing of all var
    args functions. Measurements on a large binary show that this increases
    imports and binary size by an insignificant amount.

    Reviewers: davidxl

    Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54607 (detail)
    by tejohnson
  1545. [RISCV] Remove RV64I SLLW/SRLW/SRAW patterns and add new test cases

    As noted by Eli Friedman <https://reviews.llvm.org/D52977?id=168629#1315291>,
    the RV64I shift patterns for SLLW/SRLW/SRAW make some incorrect assumptions.
    SRAW assumed that (sext_inreg foo, i32) could only be produced when
    sign-extended an i32. However, it can be produced by input such as:

    define i64 @tricky_ashr(i64 %a, i64 %b) {
      %1 = shl i64 %a, 32
      %2 = ashr i64 %1, 32
      %3 = ashr i64 %2, %b
      ret i64 %3
    }

    It's important not to select sraw in the above case, because sraw only uses
    bits lower 5 bits from the shift, while a shift of 32-63 would be valid.

    Similarly, the patterns for srlw assumed (and foo, 0xffffffff) would only be
    produced when zero-extending a value that was originally i32 in LLVM IR. This
    is obviously incorrect.

    This patch removes the SLLW/SRLW/SRAW shift patterns for the time being and
    adds test cases that would demonstrate a miscompile if the incorrect patterns
    were re-added. (detail)
    by asb
  1546. [clangd] Recommit the "AnyScope" changes in requests.json by rCTE347753 (reverted by rCTE347792)

    This fixes IndexBenchmark tests. (detail)
    by maskray
  1547. [Basic] Move DiagnosticsEngine::dump from .h to .cpp

    The two LLVM_DUMP_METHOD methods have a undefined reference on clang::DiagnosticsEngine::DiagStateMap::dump.

    tools/clang/tools/extra/clangd/benchmarks/IndexBenchmark links in
    clangDaemon but does not link in clangBasic explicitly, which causes a
    linker error "undefined symbol" in !NDEBUG + -DBUILD_SHARED_LIBS=on builds.

    Move LLVM_DUMP_METHOD methods to .cpp to fix IndexBenchmark. They should
    be unconditionally defined as they are also used by non-dump-method #pragma clang __debug diag_mapping (detail)
    by maskray
  1548. [projects] Use add_llvm_external_project for implicit projects

    This allows disabling implicit projects via the LLVM_TOOL_*_BUILD
    variables, similar to how implicit tools can be disabled. They'll still
    be enabled by default, since add_llvm_external_project defaults the
    LLVM_TOOL_*_BUILD variables to ON for in-tree implciit projects.

    Differential Revision: https://reviews.llvm.org/D55105 (detail)
    by smeenai
  1549. [X86][LoopVectorize] Replace -mcpu=skylake-avx512 with -mattr=avx512f in some tests that failed when experimenting with defaulting to -mprefer-vector-width=256 for skylake-avx512. (detail)
    by ctopper
  1550. Relax test to also work on Windows. (detail)
    by Adrian Prantl
  1551. [compiler-rt] Use "ColumnLimit: 0" instead of "clang-format off" in tests

    Reviewers: eugenis, jfb

    Subscribers: kubamracek, dberris, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55152 (detail)
    by Vitaly Buka
  1552. Honor -fdebug-prefix-map when creating function names for the debug info.

    This adds a callback to PrintingPolicy to allow CGDebugInfo to remap
    file paths according to -fdebug-prefix-map. Otherwise the debug info
    (particularly function names for C++ lambdas) may contain paths that
    should have been remapped in the debug info.

    <rdar://problem/46128056>

    Differential Revision: https://reviews.llvm.org/D55137 (detail)
    by Adrian Prantl
  1553. Use RequireNullTerminator=false in identify_magic.

    identify_magic does not need the file to be null terminated.  Passing
    true here causes the file reading code to decide not to use mmap in
    some rare cases (which happen to be true 100% of the time in PDB files)
    which can lead to very large files failing to load.  Since it was
    probably just an accident that we were passing true here (since it is
    the default function parameter), this should be strictly an improvement. (detail)
    by zturner
  1554. [lit] Add a generic build script with a lit substitution.

    This adds a script called build.py as well as a lit substitution
    called %build that we can use to invoke it.  The idea is that
    this allows a lit test to build test inferiors without having
    to worry about architecture / platform specific differences,
    command line syntax, finding / configurationg a proper toolchain,
    and other issues.  They can simply write something like:

    %build --arch=32 -o %t.exe %p/Inputs/foo.cpp

    and it will just work.  This paves the way for being able to
    run lit tests with multiple configurations, platforms, and
    compilers with a single test.

    Differential Revision: https://reviews.llvm.org/D54914 (detail)
    by zturner
  1555. [NVPTX] Add lowering of i128 numbers as struct fields

    Addition to D34555 - override VTs computation with ComputePTXValueVTs
    for struct fields.

    Author: Denys Zariaiev<denys.zariaiev@gmail.com>

    Differential Revision: https://reviews.llvm.org/D55144 (detail)
    by tra
  1556. [X86] Replace '-mcpu=skx' with -mattr=avx512f or -mattr=avx512bw in interleave/strided load/store cost model tests. (detail)
    by ctopper
  1557. [gn build] Add action to generate VCSRevision.h and use it to add llvm/lib/Object/BUILD.gn

    Differential Revision: https://reviews.llvm.org/D55090 (detail)
    by nico
  1558. Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""

    It seems the two failing tests can be simply fixed after r348037

    Fix 3 cases in Analysis/builtin-functions.cpp
    Delete the bad CodeGen/builtin-constant-p.c for now (detail)
    by maskray
  1559. [codeview] Remove dead macros for codeview record serialization, NFC

    These weren't needed when we went to the yaml IO style of serialization,
    which has "mapOptional". (detail)
    by rnk
  1560. LegacyDivergenceAnalysis: fix uninitialized value

    Change-Id: I014502e431a68f7beddf169f6a3d19dac5dd2c26 (detail)
    by nha
  1561. AMDGPU: Divergence-driven selection of scalar buffer load intrinsics

    Summary:
    Moving SMRD to VMEM in SIFixSGPRCopies is rather bad for performance if
    the load is really uniform. So select the scalar load intrinsics directly
    to either VMEM or SMRD buffer loads based on divergence analysis.

    If an offset happens to end up in a VGPR -- either because a floating
    point calculation was involved, or due to other remaining deficiencies
    in SIFixSGPRCopies -- we use v_readfirstlane.

    There is some unrelated churn in tests since we now select MUBUF offsets
    in a unified way with non-scalar buffer loads.

    Change-Id: I170e6816323beb1348677b358c9d380865cd1a19

    Reviewers: arsenm, alex-t, rampitec, tpr

    Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, llvm-commits

    Differential Revision: https://reviews.llvm.org/D53283 (detail)
    by nha
  1562. AMDGPU: Fix various issues around the VirtReg2Value mapping

    Summary:
    The VirtReg2Value mapping is crucial for getting consistently
    reliable divergence information into the SelectionDAG. This
    patch fixes a bunch of issues that lead to incorrect divergence
    info and introduces tight assertions to ensure we don't regress:

    1. VirtReg2Value is generated lazily; there were some cases where
       a lookup was performed before all relevant virtual registers were
       created, leading to an out-of-sync mapping. Those cases were:

      - Complex code to lower formal arguments that generated CopyFromReg
        nodes from live-in registers (fixed by never querying the mapping
        for live-in registers).

      - Code that generates CopyToReg for formal arguments that are used
        outside the entry basic block (fixed by never querying the
        mapping for Register nodes, which don't need the divergence info
        anyway).

    2. For complex values that are lowered to a sequence of registers,
       all registers must be reflected in the VirtReg2Value mapping.

    I am not adding any new tests, since I'm not actually aware of any
    bugs that these problems are causing with trunk as-is. However,
    I recently added a test case (in r346423) which fails when D53283 is
    applied without this change. Also, the new assertions should provide
    most of the effective test coverage.

    There is one test change in sdwa-peephole.ll. The underlying issue
    is that since the divergence info is now correct, the DAGISel will
    select V_OR_B32 directly instead of S_OR_B32. This leads to an extra
    COPY which affects the behavior of MachineLICM in a way that ends up
    with the S_MOV_B32 with the constant in a different basic block than
    the V_OR_B32, which is presumably what defeats the peephole.

    Reviewers: alex-t, arsenm, rampitec

    Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54340 (detail)
    by nha
  1563. [DA] GPUDivergenceAnalysis for unstructured GPU kernels

    Summary:
    This is patch #3 of the new DivergenceAnalysis

      <https://lists.llvm.org/pipermail/llvm-dev/2018-May/123606.html>

    The GPUDivergenceAnalysis is intended to eventually supersede the existing
    LegacyDivergenceAnalysis. The existing LegacyDivergenceAnalysis produces
    incorrect results on unstructured Control-Flow Graphs:

      <https://bugs.llvm.org/show_bug.cgi?id=37185>

    This patch adds the option -use-gpu-divergence-analysis to the
    LegacyDivergenceAnalysis to turn it into a transparent wrapper for the
    GPUDivergenceAnalysis.

    Reviewers: nhaehnle

    Reviewed By: nhaehnle

    Subscribers: jholewinski, jvesely, jfb, llvm-commits, alex-t, sameerds, arsenm, nhaehnle

    Differential Revision: https://reviews.llvm.org/D53493 (detail)
    by nha
  1564. [x86] add tests for undef + partial undef constant folding; NFC

    Keep this file sync'd with the instsimplify version (rL348045). (detail)
    by spatel
  1565. [X86] Split skylake-avx512 run lines in SLP vectorizer tests to cover -mprefer=vector-width=256 and -mprefer-vector-width=512.

    This will make these tests immune if we ever change the default behavior of -march=skylake-avx512 to prefer 256 bit vectors. (detail)
    by ctopper
  1566. [InstSimplify] add tests for undef + partial undef constant folding; NFC

    These tests should probably go under a separate test file because they
    should fold with just -constprop, but they're similar to the scalar
    tests already in here. (detail)
    by spatel
  1567. [analyzer] Deleting unnecessary test file

    That I really should've done in rC348031. (detail)
    by szelethus
  1568. [ValueTracking] Make unit tests easier to write; NFC

    Generalize the existing MatchSelectPatternTest class to also work
    with other types of tests. This reduces the amount of boilerplate
    necessary to write ValueTracking tests in general, and computeKnownBits
    tests in particular.

    The inherited convention is that the function must be @test and the
    tested instruction %A.

    Differential Revision: https://reviews.llvm.org/D55141 (detail)
    by nikic
  1569. Support: use std::is_trivially_copyable on MSVC

    MSVC 2015 and newer have std::is_trivially_copyable available for use.
    We should prefer that over the std::is_class to get this check be
    correct. (detail)
    by Saleem Abdulrasool
  1570. Add myself as code owner for OpenBSD driver (detail)
    by brad
  1571. Revert r347417 "Re-Reinstate 347294 with a fix for the failures."

    Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp
    while we are investigating why the following snippet fails:

      extern char extern_var;
      struct { int a; } a = {__builtin_constant_p(extern_var)}; (detail)
    by maskray
  1572. [analyzer] Emit an error for invalid -analyzer-config inputs

    Differential Revision: https://reviews.llvm.org/D53280 (detail)
    by szelethus
  1573. [ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417)

    Summary:
    Reinstate the original behavior (Success(false, E)) before D54355 when this branch is
    taken. This fixes spurious error of the following snippet:

      extern char extern_var;
      struct { int a; } a = {__builtin_constant_p(extern_var)}; (detail)
    by maskray
  1574. [MachineOutliner] Outline both register save calls + no LR save calls together

    Instead of treating the outlined functions for these as distinct frames, they
    should be combined into one case. Neither allows for stack fixups, and both
    generate the same frame. Thus, they ought to be considered one case.

    This makes the code far easier to understand, for one thing. It also offers
    some small code size improvements. It's fairly rare to see a class of outlined
    functions that doesn't fall entirely into one variant (on CTMark anyway). It
    does happen from time to time though.

    This mostly offers some serious simplification.

    Also update the test to show the added functionality. (detail)
    by paquette
  1575. AArch64: Don't emit CFI for SCS register in nounwind functions.

    All that you can legitimately do with the CFI for a nounwind function
    is get a backtrace, and adjusting the SCS register is not (currently)
    required for this purpose.

    Differential Revision: https://reviews.llvm.org/D54988 (detail)
    by pcc
  1576. [TableGen] Fix negation of simple predicates

    Simple predicates, such as those defined by `CheckRegOperandSimple` or
    `CheckImmOperandSimple`, were not being negated when used with `CheckNot`.

    This change fixes this issue by defining the previously declared methods to
    handle simple predicates.

    Differential revision: https://reviews.llvm.org/D55089 (detail)
    by evandro
  1577. Adding tests for -ast-dump; NFC.

    This adds tests for struct and union declarations in C. It also points out a bug when dumping anonymous record types -- they are sometimes reported as being contained by something of the wrong tag type. e.g., an anonymous struct inside of a union named X reports the anonymous struct as being inside of 'struct X' rather than 'union X'. (detail)
    by aaronballman
  1578. Revert r348029. I was git-ing and jumped the gun. (detail)
    by void
  1579. [analyzer] Evaluate all non-checker config options before analysis

    In earlier patches regarding AnalyzerOptions, a lot of effort went into
    gathering all config options, and changing the interface so that potential
    misuse can be eliminited.

    Up until this point, AnalyzerOptions only evaluated an option when it was
    querried. For example, if we had a "-no-false-positives" flag, AnalyzerOptions
    would store an Optional field for it that would be None up until somewhere in
    the code until the flag's getter function is called.

    However, now that we're confident that we've gathered all configs, we can
    evaluate off of them before analysis, so we can emit a error on invalid input
    even if that prticular flag will not matter in that particular run of the
    analyzer. Another very big benefit of this is that debug.ConfigDumper will now
    show the value of all configs every single time.

    Also, almost all options related class have a similar interface, so uniformity
    is also a benefit.

    The implementation for errors on invalid input will be commited shorty.

    Differential Revision: https://reviews.llvm.org/D53692 (detail)
    by szelethus
  1580. Revert "Reverting r347949-r347951 because they broke the test bots."

    This reverts commit 5bad6129c012fbf186eb055be49344e790448ecc.

    Hopefully fixing the issue which was breaking the bots. (detail)
    by George Karpenkov
  1581. We're in a constant context in the ConstantEmitter. (detail)
    by void
  1582. Expect mixed path separators in FileManagerTest when resolving paths on Win32 (detail)
    by ormris
  1583. Add a new interceptor for getvfsstat(2) from NetBSD

    Summary:
    getvfsstat - gets list of all mounted file systems.

    Add a dedicated test.

    Reviewers: vitalybuka, joerg

    Reviewed By: vitalybuka

    Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers

    Tags: #sanitizers

    Differential Revision: https://reviews.llvm.org/D55014 (detail)
    by kamil
  1584. Revert an inadvertent change from r348020. (detail)
    by aaronballman
  1585. [analyzer][PlistMacroExpansion] Part 5.: Support for # and ##

    From what I can see, this should be the last patch needed to replicate macro
    argument expansions.

    Differential Revision: https://reviews.llvm.org/D52988 (detail)
    by szelethus
  1586. [Mem2Reg] Fix nondeterministic corner case

    Summary:
    When mem2reg inserts phi nodes in blocks with unreachable predecessors,
    it adds undef operands for those incoming edges.  When there are
    multiple such predecessors, the order is currently based on the address
    of the BasicBlocks.  This change fixes that by using the BBNumbers in
    the sort/search predicates, as is done elsewhere in mem2reg to ensure
    determinism.

    Also adds a testcase with a bunch of unreachable preds, which
    (nodeterministically) fails without the fix.


    Reviewers: majnemer

    Reviewed By: majnemer

    Subscribers: mgrang, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55077 (detail)
    by josepht
  1587. Updating this test, which changed after the reverts from r348020. (detail)
    by aaronballman
  1588. [DWARFv5] Verify all-or-nothing constraint on DIFile source

    Update IR verifier to check the constraint that DIFile source is present on all
    files or no files.

    Differential Revision: https://reviews.llvm.org/D54953 (detail)
    by scott.linder
  1589. [dsymutil] Gather global and local symbol addresses in the main executable.

    Usually local symbols will have their address described in the debug
    map. Global symbols have to have their address looked up in the symbol
    table of the main executable. By playing with 'ld -r' and export lists,
    you can get a symbol described as global by the debug map while actually
    being a local symbol as far as the link in concerned. By gathering the
    address of local symbols, we fix this issue.

    Also, we prefer a global symbol in case of a name collision to preserve
    the previous behavior.

    Note that using the 'ld -r' tricks, people can actually cause symbol
    names collisions that dsymutil has no way to figure out. This fixes the
    simple case where there is only one symbol of a given name.

    rdar://problem/32826621

    Differential revision: https://reviews.llvm.org/D54922 (detail)
    by Jonas Devlieghere
  1590. Reverting r347949-r347951 because they broke the test bots.

    http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/440/steps/ninja%20check%202/logs/FAIL%3A%20Clang%3A%3Aosobject-retain-release.cpp (detail)
    by aaronballman
  1591. [X86] Change vXi8 MULHU lowering to unpack high and low half of lanes instead of extracting and concating low and high half registers.

    This reduces the number of shuffle operations that need to be done. The splitting strategy requires the shuffle unit for the extraction and the extension. With the unpack strategy the unpacks accomplish a splitting and extending in one operation. (detail)
    by ctopper
  1592. [X86] Prefer lowerVectorShuffleAsBitMask over using a avx512 masked operation when avx512bw/avx512vl is enabled.

    This does require a constant pool load instead of loading an immediate into a gpr, moving to a k register and masking. But its less instructions and more consistent with previous ISAs. It probably opens up more combine opportunities as one of the test cases demonstrates. (detail)
    by ctopper
  1593. Move AST tests into their own test directory; NFC.

    This moves everything primarily testing the functionality of -ast-dump and -ast-print into their own directory, rather than leaving the tests spread around the testing directory. (detail)
    by aaronballman
  1594. [SelectionDAG] fold FP binops with 2 undef operands to undef (detail)
    by spatel
  1595. [clang] Fix rL348006 for windows (detail)
    by kadircet
  1596. [AMDGPU] Disable SReg Global LD/ST, perf regression

    Differential Revision: https://reviews.llvm.org/D55093 (detail)
    by ronlieb
  1597. Adding tests for -ast-dump; NFC.

    This adds tests for GenericSelectionExpr; note that it points out a minor whitespace bug for selection expression cases. (detail)
    by aaronballman
  1598. [llvm-mca] Speedup the default resource selection strategy.

    This patch removes a (potentially) slow while loop in
    DefaultResourceStrategy::select(). A better (and faster) approach is to do some
    bit manipulation in order to shrink the range of candidate resources.
    On a release build, this change gives an average speedup of ~10%. (detail)
    by adibiagio
  1599. [clang] Fill RealPathName for virtual files.

    Summary:
    Absolute path information for virtual files were missing even if we
    have already stat'd the files. This patch puts that information for virtual
    files that can succesffully be stat'd.

    Reviewers: ilya-biryukov

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D55054 (detail)
    by kadircet
  1600. [clangd] Populate include graph during static indexing action.

    Summary:
    This is the second part for introducing include hierarchy into index
    files produced by clangd. You can see the base patch that introduces structures
    and discusses the future of the patches in D54817

    Reviewers: ilya-biryukov

    Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54999 (detail)
    by kadircet
  1601. Revert "[BTF] Add BTF DebugInfo"

    This reverts commit 9c6b970db8bc63b28ce58a129bb1580a6a3c6caf. (detail)
    by yhs
  1602. [x86] add tests for fake vector FP ops; NFC (detail)
    by spatel
  1603. [BTF] Add BTF DebugInfo

    This patch adds BPF Debug Format (BTF) as a standalone
    LLVM debuginfo. The BTF related sections are directly
    generated from IR. The BTF debuginfo is generated
    only when the compilation target is BPF.

    What is BTF?
    ============

    First, the BPF is a linux kernel virtual machine
    and widely used for tracing, networking and security.
      https://www.kernel.org/doc/Documentation/networking/filter.txt
      https://cilium.readthedocs.io/en/v1.2/bpf/

    BTF is the debug info format for BPF, introduced in the below
    linux patch
      https://github.com/torvalds/linux/commit/69b693f0aefa0ed521e8bd02260523b5ae446ad7#diff-06fb1c8825f653d7e539058b72c83332
    in the patch set mentioned in the below lwn article.
      https://lwn.net/Articles/752047/

    The BTF format is specified in the above github commit.
    In summary, its layout looks like
      struct btf_header
      type subsection (a list of types)
      string subsection (a list of strings)

    With such information, the kernel and the user space is able to
    pretty print a particular bpf map key/value. One possible example below:
      Withtout BTF:
        key: [ 0x01, 0x01, 0x00, 0x00 ]
      With BTF:
        key: struct t { a : 1; b : 1; c : 0}
      where struct is defined as
        struct t { char a; char b; short c; };

    How BTF is generated?
    =====================

    Currently, the BTF is generated through pahole.
      https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?id=68645f7facc2eb69d0aeb2dd7d2f0cac0feb4d69
    and available in pahole v1.12
      https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?id=4a21c5c8db0fcd2a279d067ecfb731596de822d4

    Basically, the bpf program needs to be compiled with -g with
    dwarf sections generated. The pahole is enhanced such that
    a .BTF section can be generated based on dwarf. This format
    of the .BTF section matches the format expected by
    the kernel, so a bpf loader can just take the .BTF section
    and load it into the kernel.
      https://github.com/torvalds/linux/commit/8a138aed4a807ceb143882fb23a423d524dcdb35

    The .BTF section layout is also specified in this patch:
    with file include/llvm/BinaryFormat/BTF.h.

    What use cases this patch tries to address?
    ===========================================

    Currently, only the bpf instruction stream is required to
    pass to the kernel. The kernel verifies it, jits it if configured
    to do so, attaches it to a particular kernel attachment point,
    and later executes when a particular event happens.

    This patch tries to expand BTF to support two more use cases below:
      (1). BPF supports subroutine calls.
           During performance analysis, it would be good to
           differentiate which call is hot instead of just
           providing a virtual address. This would require to
           pass a unique identifier for each subroutine to
           the kernel, the subroutine name is a natual choice.
      (2). If a particular jitted instruction is hot, we want
           user to know which source line this jitted instruction
           belongs to. This would require the source information
           is available to various profiling tools.

    Note that in a single ELF file,
      . there may be multiple loadable bpf programs,
      . for a particular to-be-loaded bpf instruction stream,
        its instructions may come from multiple PROGBITS sections,
        the bpf loader needs to merge them together to a single
        consecutive insn stream before loading to the kernel.
    For example:
      section .text: subroutines funcFoo
      section _progA: calling funcFoo
      section _progB: calling funcFoo
    The bpf loader could construct two loadable bpf instruction
    streams and load them into the kernel:
      . _progA funcFoo
      . _progB funcFoo
    So per ELF section function offset and instruction offset
    will need to be adjusted before passing to the kernel, and
    the kernel essentially expect only one code section regardless
    of how many in the ELF file.

    What do we propose and Why?
    ===========================

    To support the above two use cases, we propose to
    add an additional section, .BTF.ext, to the ELF file
    which is the input of the bpf loader. A different section
    is preferred since loader may need to manipulate it before
    loading part of its data to the kernel.

    The .BTF.ext section has a similar header to the .BTF section
    and it contains two subsections for func_info and line_info.
      . the func_info maps the func insn byte offset to a func
        type in the .BTF type subsection.
      . the line_info maps the insn byte offset to a line info.
      . both func_info and line_info subsections are organized
        by ELF PROGBITS AX sections.

    pahole is not a good place to implement .BTF.ext as
    pahole is mostly for structure hole information and more
    importantly, we want to pass the actual code to the kernel.
      . bpf program typically is small so storage overhead
        should be small.
      . in bpf land, it is totally possible that
        an application loads the bpf program into the
        kernel and then that application quits, so
        holding debug info by the user space application
        is not practical as you may not even know who
        loads this bpf program.
      . having source codes directly kept by kernel
        would ease deployment since the original source
        code does not need ship on every hosts and
        kernel-devel package does not need to be
        deployed even if kernel headers are used.

    LLVM is a good place to implement.
      . The only reliable time to get the source code is
        during compilation time. This will result in both more
        accurate information and easier deployment as
        stated in the above.
      . Another consideration is for JIT. The project like bcc
        (https://github.com/iovisor/bcc)
        use MCJIT to compile a C program into bpf insns and
        load them to the kernel. The llvm generated BTF sections
        will be readily available for such cases as well.

    Design and implementation of emiting .BTF/.BTF.ext sections
    ===========================================================

    The BTF debuginfo format is defined. Both .BTF and .BTF.ext
    sections are generated directly from IR when both
    "-target bpf" and "-g" are specified. Note that
    dwarf sections are still generated as dwarf is used
    by user space tools like llvm-objdump etc. for BPF target.

    This patch also contains tests to verify generated
    .BTF and .BTF.ext sections for all supported types, func_info
    and line_info subsections. The patch is also tested
    against linux kernel bpf sample tests and selftests.

    Signed-off-by: Yonghong Song <yhs@fb.com>

    Differential Revision: https://reviews.llvm.org/D53736 (detail)
    by yhs
  1604. [CodeGen] Prefer static frame index for STATEPOINT liveness args

    Summary:
    If a given liveness arg of STATEPOINT is at a fixed frame index
    (e.g. a function argument passed on stack), prefer to use this
    fixed location even the address is also in a register. If we use
    the register it will generate a spill, which is not necessary
    since the fixed frame index can be directly recorded in the stack
    map.

    Patch by Cherry Zhang <cherryyz@google.com>.

    Reviewers: thanm, niravd, reames

    Reviewed By: reames

    Subscribers: cherryyz, reames, anna, arphaman, llvm-commits

    Differential Revision: https://reviews.llvm.org/D53889 (detail)
    by thanm
  1605. [SLP]PR39774: Update references of the replaced external instructions.

    Summary:
    An additional fix for PR39774. Need to update the references for the
    RedcutionRoot instruction when it is replaced during the vectorization
    phase to avoid compiler crash on reduction vectorization.

    Reviewers: RKSimon, spatel

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55017 (detail)
    by abataev
  1606. Adding tests for -ast-dump; NFC.

    This adds tests for DeclStmt and demonstrates that we don't create such an AST node for global declarations currently. (detail)
    by aaronballman
  1607. [gn build] Add build files for llvm/lib/Bitcode/Reader and llvm/lib/MC/MCParser.

    Differential Revision: https://reviews.llvm.org/D55087 (detail)
    by nico
  1608. Adding tests for -ast-dump; NFC.

    This adds tests for the majority of the functionality around FunctionDecl and CXXMethodDecl. (detail)
    by aaronballman
  1609. [AMDGPU] Combine DPP mov with use instructions (VOP1/2/3)

    Introduces DPP pseudo instructions and the pass that combines DPP mov with subsequent uses.

    Differential revision: https://reviews.llvm.org/D53762 (detail)
    by vpykhtin
  1610. TableGen/ISel: Allow PatFrag predicate code to access captured operands

    Summary:
    This simplifies writing predicates for pattern fragments that are
    automatically re-associated or commuted.

    For example, a followup patch adds patterns for fragments of the form
    (add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are
    automatically commuted to (add $z, (shl $x, $y)), which makes it basically
    impossible to refer to $x, $y, and $z generically in the PredicateCode.

    With this change, the PredicateCode can refer to $x, $y, and $z simply
    as `Operands[i]`.

    Test confirmed that there are no changes to any of the generated files
    when building all (non-experimental) targets.

    Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c

    Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand

    Subscribers: wdng, tpr, llvm-commits

    Differential Revision: https://reviews.llvm.org/D51994 (detail)
    by nha
  1611. [RISCV] Add additional CSR instruction aliases (imm. operands)

    This patch adds CSR instructions aliases for the cases where the instruction
    takes an immediate operand but the alias doesn't have the i suffix. This is
    necessary for gas/gcc compatibility.

    gas doesn't do a similar conversion for fsflags or fsrm, so this should be
    complete.

    Differential Revision: https://reviews.llvm.org/D55008
    Patch by Luís Marques. (detail)
    by asb
  1612. Fix parenthesis warning in IVDescriptors (detail)
    by rengolin
  1613. Add a new reduction pattern match

    Adding a new reduction pattern match for vectorizing code similar
    to TSVC s3111:

    for (int i = 0; i < N; i++)
      if (a[i] > b)
        sum += a[i];

    This patch adds support for fadd, fsub and fmull, as well as multiple
    branches and different (but compatible) instructions (ex. add+sub) in
    different branches.

    The difference from the previous patch(https://reviews.llvm.org/D49168)
    is as follows:
    - Added check of fast-math property of fp-instruction to the
       previous patch
    - Fix/add some pattern for if-reduction.ll


    Differential Revision: https://reviews.llvm.org/D54464

    Patch by Takahiro Miyoshi <takahiro.miyoshi@linaro.org>
         and Masakazu Ueno <masakazu.ueno@linaro.org> (detail)
    by rengolin
  1614. [RISCV] Add UNIMP instruction (32- and 16-bit forms)

    This patch adds support for UNIMP in both 32- and 16-bit forms. The 32-bit
    form can be seen as a variant of the ECALL/EBREAK/etc. family of instructions.
    The 16-bit form is just all zeroes, which isn't a valid RISC-V instruction,
    but still follows the 16-bit instruction form (i.e. bits 0-1 != 11).

    Until recently unimp was undocumented and supported just by binutils, which
    printed unimp for either the 16 or 32-bit form. Both forms are now documented
    <https://github.com/riscv/riscv-asm-manual/pull/20> and binutils now supports
    c.unimp <https://sourceware.org/ml/binutils-cvs/2018-11/msg00179.html>.

    Differential Revision: https://reviews.llvm.org/D54316
    Patch by Luís Marques. (detail)
    by asb
  1615. Fix warning about unused variable [NFC] (detail)
    by uabelho
  1616. [SelectionDAG] Support result type promotion for FLT_ROUNDS_

    For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
    LegalizeIntegerTypes must promote the result of ISD::FLT_ROUNDS_.

    Differential Revision: https://reviews.llvm.org/D53820 (detail)
    by asb
  1617. [llvm-mca] Simplify code in class Scheduler. NFCI (detail)
    by adibiagio
  1618. [clangd] Penalize destructor and overloaded operators in code completion.

    Reviewers: hokein

    Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55061 (detail)
    by ioeric
  1619. [clangd] Drop injected class name when class scope is not explicitly specified.

    Summary: E.g. allow injected "A::A" in `using A::A^` but not in "A^".

    Reviewers: kadircet

    Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55065 (detail)
    by ioeric
  1620. lyzer] [HOTFIX!] SValBuilder crash when `aggressive-binary-operation-simplification` enabled

    During the review of D41938 a condition check with an early exit accidentally
    slipped into a branch, leaving the other branch unprotected. This may result in
    an assertion later on. This hotfix moves this contition check outside of the
    branch.

    Differential Revision: https://reviews.llvm.org/D55051 (detail)
    by baloghadamsoftware
  1621. [SelectionDAG] Support promotion of PREFETCH operands

    For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
    LegalizeIntegerTypes must promote the operands of ISD::PREFETCH.

    Differential Revision: https://reviews.llvm.org/D53281 (detail)
    by asb
  1622. [LoopSimplifyCFG] Update MemorySSA in terminator folding. PR39783

    Terminator folding transform lacks MemorySSA update for memory Phis,
    while they exist within MemorySSA analysis. They need exactly the same
    type of updates as regular Phis. Failing to update them properly ends up
    with inconsistent MemorySSA and manifests in various assertion failures.

    This patch adds Memory Phi updates to this transform.

    Thanks to @jonpa for finding this!

    Differential Revision: https://reviews.llvm.org/D55050
    Reviewed By: asbirlea (detail)
    by mkazantsev
  1623. [SelectionDAG] Support promotion of FRAMEADDR/RETURNADDR operands

    For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
    LegalizeIntegerTypes must promote the operand.

    Differential Revision: https://reviews.llvm.org/D53279 (detail)
    by asb
  1624. [TargetLowering][RISCV] Introduce isSExtCheaperThanZExt hook and implement for RISC-V

    DAGTypeLegalizer::PromoteSetCCOperands currently prefers to zero-extend
    operands when it is able to do so. For some targets this is more expensive
    than a sign-extension, which is also a valid choice. Introduce the
    isSExtCheaperThanZExt hook and use it in the new SExtOrZExtPromotedInteger
    helper. On RISC-V, we prefer sign-extension for FromTy == MVT::i32 and ToTy ==
    MVT::i64, as it can be performed using a single instruction.

    Differential Revision: https://reviews.llvm.org/D52978 (detail)
    by asb
  1625. [NFC] Simplify and reduce tests for PR39783 (detail)
    by mkazantsev
  1626. [RISCV] Introduce codegen patterns for instructions introduced in RV64I

    As discussed in the RFC
    <http://lists.llvm.org/pipermail/llvm-dev/2018-October/126690.html>, 64-bit
    RISC-V has i64 as the only legal integer type.  This patch introduces patterns
    to support codegen of the new instructions
    introduced in RV64I: addiw, addiw, subw, sllw, slliw, srlw, srliw, sraw,
    sraiw, ld, sd.

    Custom selection code is needed for srliw as SimplifyDemandedBits will remove
    lower bits from the mask, meaning the obvious pattern won't work:

    def : Pat<(sext_inreg (srl (and GPR:$rs1, 0xffffffff), uimm5:$shamt), i32),
              (SRLIW GPR:$rs1, uimm5:$shamt)>;
    This is sufficient to compile and execute all of the GCC torture suite for
    RV64I other than those files using frameaddr or returnaddr intrinsics
    (LegalizeDAG doesn't know how to promote the operands - a future patch
    addresses this).

    When promoting i32 sltu/sltiu operands, it would be more efficient to use
    sign-extension rather than zero-extension for RV64. A future patch adds a hook
    to allow this.

    Differential Revision: https://reviews.llvm.org/D52977 (detail)
    by asb
  1627. [docs][AtomicExpandPass] Document the alternate lowering strategy for part-word atomicrmw/cmpxchg

    D47882, D48130 and D48131 introduce a new lowering strategy for part-word
    atomicrmw/cmpxchg and uses it to lower these operations for the RISC-V target.
    Rather than having AtomicExpandPass produce the LL/SC loop in the IR level, it
    instead calculates the necessary mask values and inserts a target-specific
    intrinsic, which is lowered at a much later stage (after register allocation).
    This ensures that architecture-specific restrictions for forward-progress in
    LL/SC loops can be guaranteed.

    This patch documents this new AtomicExpandPass functionality. See the previous
    llvm-dev RFC for more info
    <http://lists.llvm.org/pipermail/llvm-dev/2018-June/123993.html>.

    Differential Revision: https://reviews.llvm.org/D52234 (detail)
    by asb
  1628. Fix a use-after-scope bug. (detail)
    by hokein
  1629. [clangd] Bump vscode-clangd v0.0.8 (detail)
    by hokein
  1630. [clangd] Fix junk output in clangd vscode plugin

    Summary:
    When using the vscode clangd plugin, lots and lots of junk output is printed to the output window, which constantly reopens itself.
    Example output:

    I[11:13:17.733] <-- textDocument/codeAction(4)
    I[11:13:17.733] --> reply:textDocument/codeAction(4) 0 ms
    I[11:13:17.937] <-- textDocument/codeAction(5)
    I[11:13:17.937] --> reply:textDocument/codeAction(5) 0 ms
    I[11:13:18.557] <-- textDocument/hover(6)
    I[11:13:18.606] --> reply:textDocument/hover(6) 48 ms

    This should prevent that from happening.

    Patch by James Findley!

    Reviewers: ioeric, ilya-biryukov, hokein

    Reviewed By: ioeric

    Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Tags: #clang-tools-extra

    Differential Revision: https://reviews.llvm.org/D55052 (detail)
    by hokein
  1631. [X86] Emit PACKUS directly from the v16i8 LowerMULH code instead of using a shuffle. (detail)
    by ctopper
  1632. [X86] Change the pre-sse4.1 code in the v16i8 MULHU lowering to be what we get after DAG combine cleans it up.

    Previously we emitted a punpcklbw/punpckhbw to move the byte elements into the upper half of 16 bit elements then shifted right by 8 to zero the upper bits. After DAG combine we end up with punpcklbw/punpckhbw into the lower bits with zeros in the uppers bits and no shifts. So just emit that directly. (detail)
    by ctopper
  1633. [ARM] Don't expand sdiv when optimising for minsize

    Don't expand SDIV with an immediate that is a power of 2 if we optimise for
    minimum code size. For example:

    sdiv %1, i32 4

    gets expanded to a sequence of 3 instructions, but this is suboptimal for
    minimum code size so instead we just generate a MOV and a SDIV if integer
    division is supported.

    Differential Revision: https://reviews.llvm.org/D54546 (detail)
    by sjoerdmeijer
  1634. [CodeGen] Fix bugs in BranchFolderPass when debug labels are generated.

    Skip DBG_VALUE and DBG_LABEL in branch folding algorithms.

    The bug is reported in
    https://bugs.chromium.org/p/chromium/issues/detail?id=898160.

    Differential Revision: https://reviews.llvm.org/D54199 (detail)
    by hsiangkai
  1635. [NFC] Refine doxygen format.

    Differential Revision: https://reviews.llvm.org/D54568 (detail)
    by hsiangkai
  1636. [SystemZ::TTI] i8/i16 operands extension costs revisited

    Three minor changes to these extra costs:

    * For ICmp instructions, instead of adding 2 all the time for extending each
      operand, this is only done if that operand is neither a load or an
      immediate.

    * The operands extension costs for divides removed, because we now use a high
      cost already for the divide (20).

    * The costs for lhsr/ashr extra costs removed as this did not seem useful.

    Review: Ulrich Weigand
    https://reviews.llvm.org/D55053 (detail)
    by jonpa
  1637. [X86] Fix a couple types in SimplifyDemandedVectorEltsForTargetNode. NFCI

    We had a EVT variable capturing the result of getSimpleValueType which returns an MVT. Another place using EVT that could have been MVT. And an 'int' that should be 'unsigned'. (detail)
    by ctopper
  1638. [llvm-objcopy] Move elf-specific tests into subfolder

    In this diff the elf-specific tests are moved into the subfolder llvm-objcopy/ELF
    (the change was discussed in the comments on https://reviews.llvm.org/D54674).
    A separate code reivew wasn't sent for this change
    since Phabricator is failing to create such a large diff.

    Test plan:
    make check-all
    make check-llvm-tools
    make check-llvm-tools-llvm-objcopy (detail)
    by alexshap
  1639. Revert r344580 "[analyzer] Nullability: Don't detect post factum violation..."

    Fails under ASan! (detail)
    by dergachev
  1640. [analyzer] MallocChecker: Avoid redundant transitions.

    Don't generate a checker-tagged node unconditionally on the first
    checkDeadSymbols callback when no pointers are tracked.

    This is a tiny performance optimization; it may change the behavior slightly
    by making Static Analyzer bail out on max-nodes one node later (which is good)
    but any test would either break for no good reason or become useless
    every time someone sneezes.

    Differential Revision: https://reviews.llvm.org/D54013 (detail)
    by dergachev
  1641. [analyzer] Nullability: Don't detect post factum violation on concrete values.

    The checker suppresses warnings on paths on which a nonnull value is assumed
    to be nullable. This probably deserves a warning, but it's a separate story.

    Now, because dead symbol collection fires in pretty random moments,
    there sometimes was a situation when dead symbol collection fired after
    computing a parameter but before actually evaluating call enter into the
    function, which triggered the suppression when the argument was null
    in the first place earlier than the obvious warning for null-to-nonnull
    was emitted, causing false negatives.

    Only trigger the suppression for symbols, not for concrete values.

    It is impossible to constrain a concrete value post-factum because
    it is impossible to constrain a concrete value at all.

    This covers all the necessary cases because by the time we reach the call,
    symbolic values should be either not constrained to null, or already collapsed
    into concrete null values. Which in turn happens because they are passed through
    the Store, and the respective collapse is implemented as part of getSVal(),
    which is also weird.

    Differential Revision: https://reviews.llvm.org/D54017 (detail)
    by dergachev
  1642. [analyzer] Fix the "Zombie Symbols" bug.

    It's an old bug that consists in stale references to symbols remaining in the
    GDM if they disappear from other program state sections as a result of any
    operation that isn't the actual dead symbol collection. The most common example
    here is:

       FILE *fp = fopen("myfile.txt", "w");
       fp = 0; // leak of file descriptor

    In this example the leak were not detected previously because the symbol
    disappears from the public part of the program state due to evaluating
    the assignment. For that reason the checker never receives a notification
    that the symbol is dead, and never reports a leak.

    This patch not only causes leak false negatives, but also a number of other
    problems, including false positives on some checkers.

    What's worse, even though the program state contains a finite number of symbols,
    the set of symbols that dies is potentially infinite. This means that is
    impossible to compute the set of all dead symbols to pass off to the checkers
    for cleaning up their part of the GDM.

    No longer compute the dead set at all. Disallow iterating over dead symbols.
    Disallow querying if any symbols are dead. Remove the API for marking symbols
    as dead, as it is no longer necessary. Update checkers accordingly.

    Differential Revision: https://reviews.llvm.org/D18860 (detail)
    by dergachev
  1643. [analyzer] Fixes after rebase. (detail)
    by George Karpenkov
  1644. [analyzer] RetainCountChecker for OSObject model the "free" call

    The "free" call frees the object immediately, ignoring the reference count.
    Sadly, it is actually used in a few places, so we need to model it.

    Differential Revision: https://reviews.llvm.org/D55092 (detail)
    by George Karpenkov
  1645. [analyzer] RetainCountChecker: recognize that OSObject can be created directly using an operator "new"

    Differential Revision: https://reviews.llvm.org/D55076 (detail)
    by George Karpenkov
  1646. [analyzer] Switch retain count checker for OSObject to use OS_* attributes

    Instead of generalized reference counting annotations.

    Differential Revision: https://reviews.llvm.org/D55041 (detail)
    by George Karpenkov
  1647. [attributes] Add a family of OS_CONSUMED, OS_RETURNS and OS_RETURNS_RETAINED attributes

    The addition adds three attributes for communicating ownership,
    analogous to existing NS_ and CF_ attributes.
    The attributes are meant to be used for communicating ownership of all
    objects in XNU (Darwin kernel) and all of the kernel modules.
    The ownership model there is very similar, but still different from the
    Foundation model, so we think that introducing a new family of
    attributes is appropriate.

    The addition required a sizeable refactoring of the existing code for
    CF_ and NS_ ownership attributes, due to tight coupling and the fact
    that differentiating between the types was previously done using a
    boolean.

    Differential Revision: https://reviews.llvm.org/D54912 (detail)
    by George Karpenkov
  1648. [analyzer] [NFC] Minor refactoring of RetainCountDiagnostics

    Move visitors to the implementation file, move a complicated logic into
    a function.

    Differential Revision: https://reviews.llvm.org/D55036 (detail)
    by George Karpenkov
  1649. [analyzer] For OSObject, trust that functions starting with Get

    (uppercase) are also getters.

    Differential Revision: https://reviews.llvm.org/D55035 (detail)
    by George Karpenkov
  1650. [analyzer] Print a fully qualified name for functions in RetainCountChecker diagnostics

    Attempt to get a fully qualified name from AST if an SVal corresponding
    to the object is not available.

    Differential Revision: https://reviews.llvm.org/D55034 (detail)
    by George Karpenkov
  1651. [analyzer] Add the type of the leaked object to the diagnostic message

    If the object is a temporary, and there is no variable it binds to,
    let's at least print out the object name in order to help differentiate
    it from other temporaries.

    rdar://45175098

    Differential Revision: https://reviews.llvm.org/D55033 (detail)
    by George Karpenkov
  1652. [analyzer] Reference leaked object by name, even if it was created in an inlined function.

    rdar://45532181

    Differential Revision: https://reviews.llvm.org/D54973 (detail)
    by George Karpenkov
  1653. [analyzer] [NFC] Test dumping trimmed graph

    Differential Revision: https://reviews.llvm.org/D54972 (detail)
    by George Karpenkov
  1654. [analyzer] [NFC] Some miscellaneous clean ups and documentation fixes.

    Differential Revision: https://reviews.llvm.org/D54971 (detail)
    by George Karpenkov
  1655. Fix build warnings introduced in rL347938

    Summary:
    Suppressed warnings in release builds due to variable used
    only in assert statement.

    Subscribers: llvm-commits, eraman, mgorny

    Differential Revision: https://reviews.llvm.org/D55100 (detail)
    by mtrofin
  1656. Revert "Revert r347596 "Support for inserting profile-directed cache prefetches""

    Summary:
    This reverts commit d8517b96dfbd42e6a8db33c50d1fa1e58e63fbb9.

    Fix: correct  the use of DenseMap.

    Reviewers: davidxl, hans, wmi

    Reviewed By: wmi

    Subscribers: mgorny, eraman, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55088 (detail)
    by mtrofin
  1657. [CMake] build correctly if build path contains whitespace

    The add_llvm_symbol_exports function in AddLLVM.cmake creates command
    line link flags with paths containing CMAKE_CURRENT_BINARY_DIR, but that
    will break if CMAKE_CURRENT_BINARY_DIR contains whitespace. This patch
    adds quotes to those paths.

    Fixes PR39843.

    Patch by John Garvin.

    Differential Revision: https://reviews.llvm.org/D55081 (detail)
    by smeenai
  1658. [SCEV] Guard movement of insertion point for loop-invariants

    r320789 suppressed moving the insertion point of SCEV expressions with
    dev/rem operations to the loop header in non-loop-invariant situations.
    This, and similar, hoisting is also unsafe in the loop-invariant case,
    since there may be a guard against a zero denominator. This is an
    adjustment to the fix of r320789 to suppress the movement even in the
    loop-invariant case.

    This fixes PR30806.

    Differential Revision: https://reviews.llvm.org/D54713 (detail)
    by wristow
  1659. Revert r346560 "[winasan] Unpoison the stack in NtTerminateThread"

    This reverts r343606 again. The NtTerminateThread interceptor is causing
    problems in NaCl:
    https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/CrWinAsan/1839

    I reproduced the problem locally and tried my best to debug them, but
    it's beyond me. (detail)
    by rnk
  1660. First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (second try) (detail)
    by marshall
  1661. [gn build] merge r346978 and r347741. (detail)
    by nico
  1662. [gn build] Set +x bit on .py files in llvm/utils/gn/build.

    Also add a shebang line to write_cmake_config.py. (detail)
    by nico
  1663. [gn build] Add template for running llvm-tblgen and use it to add build file for llvm/lib/IR.

    Also adds a boring build file for llvm/lib/BinaryFormat (needed by llvm/lib/IR).

    lib/IR marks Attributes and IntrinsicsEnum as public_deps (because IR's public
    headers include the generated .inc files), so projects depending on lib/IR will
    implicitly depend on them being generated. As a consequence, most targets won't
    have to explicitly list a dependency on these tablegen steps (contrast with
    intrinsics_gen in the cmake build).

    This doesn't yet have the optimization where tablegen's output is only updated
    if it's changed.

    Differential Revision: https://reviews.llvm.org/D55028#inline-486755 (detail)
    by nico
  1664. [-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.

    This patch passes -fdebug-prefix-map (a feature for renaming source
    paths in the debug info) through to the per-module codegen options and
    adds the debug prefix map to the module hash.

    <rdar://problem/46045865>

    Differential Revision: https://reviews.llvm.org/D55037 (detail)
    by Adrian Prantl
  1665. [gn build] Add a script checking if sources in BUILD.gn and CMakeLists.txt files match.

    Also fix a missing file in lib/Support/BUILD.gn found by the script.

    The script is very stupid and assumes that CMakeLists.txt follow the standard
    LLVM CMakeLists.txt formatting with one cpp source file per line. Despite its
    simplicity, it works well in practice.

    It would be nice if it also checked deps and maybe automatically applied its
    suggestions.

    Differential Revision: https://reviews.llvm.org/D54930 (detail)
    by nico
  1666. [WebAssembly] Expand unavailable integer operations for vectors

    Summary:
    Expands for vector types all of the integer operations that are
    expanded for scalars because they are not supported at all by
    WebAssembly.

    This CL has no tests because such tests would really be testing the
    target-independent expansion, but I'm happy to add tests if reviewers
    think it would be helpful.

    Reviewers: aheejin, dschuff

    Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55010 (detail)
    by tlively
  1667. Produce an error on non-encodable offsets for darwin ARM scattered relocations.

    Scattered ARM relocations for Mach-O's only have 24 bits available to
    encode the offset. This is not checked but just truncated and can result
    in corrupt binaries after linking because the relocations are applied to
    the wrong offset. This patch will check and error out in those
    situations instead of emitting a wrong relocation.

    Patch by: Sander Bogaert (dzn)

    Differential revision: https://reviews.llvm.org/D54776 (detail)
    by Jonas Devlieghere
  1668. [libcxx] Make UNSUPPORTED for std::async test more fine grained

    The test was previously marked as unsupported on all Apple platforms, when
    we really just want to mark it as unsupported for previously shipped dylibs
    on macosx. (detail)
    by Louis Dionne
  1669. [OPENMP][NVPTX]Call get __kmpc_global_thread_num in worker after
    initialization.

    Function __kmpc_global_thread_num  should be called only after
    initialization, not earlier. (detail)
    by abataev
  1670. Comment tweak requested in code review. NFC

    I forgot to do this before committing D54755. (detail)
    by probinson
  1671. [DAGCombiner] narrow truncated binops

    The motivating case for this is shown in:
    https://bugs.llvm.org/show_bug.cgi?id=32023
    and the corresponding rot16.ll regression tests.

    Because x86 scalar shift amounts are i8 values, we can end up with trunc-binop-trunc
    sequences that don't get folded in IR.

    As the TODO comments suggest, there will be regressions if we extend this (for x86,
    we mostly seem to be missing LEA opportunities, but there are likely vector folds
    missing too). I think those should be considered existing bugs because this is the
    same transform that we do as an IR canonicalization in instcombine. We just need
    more tests to make those visible independent of this patch.

    Differential Revision: https://reviews.llvm.org/D54640 (detail)
    by spatel
  1672. [obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping executables

    yaml2obj writes the yaml value as is to the output file.

    Differential Revision: https://reviews.llvm.org/D54965 (detail)
    by mstorsjo
  1673. [OpenMP] Add a new version of the SPMD deinit kernel function

    Summary: This patch adds a new runtime for the SPMD deinit kernel function which replaces the previous function. The new function takes as argument the flag which signals whether the runtime is required or not. This enables the compiler to optimize out the part of the deinit function which are not needed.

    Reviewers: ABataev, caomhin

    Reviewed By: ABataev

    Subscribers: jholewinski, guansong, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54970 (detail)
    by gbercea
  1674. [RISCV] Implement codegen for cmpxchg on RV32IA

    Utilise a similar ('late') lowering strategy to D47882. The changes to
    AtomicExpandPass allow this strategy to be utilised by other targets which
    implement shouldExpandAtomicCmpXchgInIR.

    All cmpxchg are lowered as 'strong' currently and failure ordering is ignored.
    This is conservative but correct.

    Differential Revision: https://reviews.llvm.org/D48131 (detail)
    by asb
  1675. Adding .vscode to svn:ignore (detail)
    by lemo
  1676. [X86] Change the pre-type legalization DAG combine added in r347898 into a custom type legalization operation instead.

    This seems to produce the same results on the tests we have. (detail)
    by ctopper
  1677. Revert r347871 "Fix: Add support for TFE/LWE in image intrinsic"

    Also revert fix r347876

    One of the buildbots was reporting a failure in some relevant tests that I can't
    repro or explain at present, so reverting until I can isolate. (detail)
    by dstuttard
  1678. Introduce MaxUsesToExplore argument to capture tracking

    Currently CaptureTracker gives up if it encounters a value with more than 20
    uses. The motivation for this cap is to keep it relatively cheap for
    BasicAliasAnalysis use case, where the results can't be cached. Although, other
    clients of CaptureTracker might be ok with higher cost. This patch introduces an
    argument for PointerMayBeCaptured functions to specify the max number of uses to
    explore. The motivation for this change is a downstream user of CaptureTracker,
    but I believe upstream clients of CaptureTracker might also benefit from more
    fine grained cap.

    Reviewed By: hfinkel

    Differential Revision: https://reviews.llvm.org/D55042 (detail)
    by apilipenko
  1679. Revert commit r347904 because it broke older compilers (detail)
    by marshall
  1680. [MachineScheduler] Order FI-based memops based on stack direction

    It makes more sense to order FI-based memops in descending order when
    the stack goes down. This allows offsets to stay "consecutive" and allow
    easier pattern matching. (detail)
    by thegameg
  1681. Revert "NFC: Fix case of CommentVisitor::Visit methods"

    This reverts commit 0859c80137ac5fb3c86e7802cb8c5ef56f921cce. (detail)
    by steveire
  1682. First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (detail)
    by marshall
  1683. [libcxx] Remove bad_array_length

    Summary:
    std::bad_array_length was added by n3467, but this never made it into C++.
    This commit removes the definition of std::bad_array_length from the headers
    AND from the shared library. See the comments in the ABI changelog for details
    about the ABI implications of this change.

    Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

    Subscribers: christof, jkorous, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54804 (detail)
    by Louis Dionne
  1684. [SelectionDAG][AArch64][X86] Move legalization of vector MULHS/MULHU from LegalizeDAG to LegalizeVectorOps

    I believe we should be legalizing these with the rest of vector binary operations. If any custom lowering is required for these nodes, this will give the DAG combine between LegalizeVectorOps and LegalizeDAG to run on the custom code before constant build_vectors are lowered in LegalizeDAG.

    I've moved MULHU/MULHS handling in AArch64 from Lowering to isel. Moving the lowering earlier caused build_vector+extract_subvector simplifications to kick in which made the generated code worse.

    Differential Revision: https://reviews.llvm.org/D54276 (detail)
    by ctopper
  1685. NFC: Fix case of CommentVisitor::Visit methods

    This difference is very visible because it is used with other Visitor
    classes together. (detail)
    by steveire
  1686. NFC: Move ColorScope to global scope (detail)
    by steveire
  1687. NFC: Constify ShowColors (detail)
    by steveire
  1688. [X86] Add a DAG combine pre type legalization to widen division by constant splat on narrow vectors to avoid scalarization

    This is another patch for -x86-experimental-vector-widening. This pre widens narrow division by constants so that we can get pass the legal type check in the generic DAG combiner. Otherwise we end up scalarizing.

    I've restricted this to splats for now because it was easy to just call DAG.getConstant. Not sure what we should do for non-splat? Increase the element size?Widen the constant vector by padding with 1?

    Differential Revision: https://reviews.llvm.org/D54919 (detail)
    by ctopper
  1689. set default max-page-size to 4KB in lld for Android Aarch64

    Summary:
    This patch passes an option '-z max-page-size=4096' to lld through clang driver.

    This is for Android on Aarch64 target.

    The lld default page size is too large for Aarch64, which produces larger .so files and images for arm64 device targets.
    In this patch we set default page size to 4KB for Android Aarch64 targets instead.

    Reviewers: srhines, danalbert, ruiu, chh, peter.smith

    Reviewed By: srhines

    Subscribers: javed.absar, kristof.beyls, cfe-commits, george.burgess.iv, llozano

    Differential Revision: https://reviews.llvm.org/D55029 (detail)
    by zhizhouy
  1690. [InstSimplify] fold select with implied condition

    This is an almost direct move of the functionality from InstCombine to
    InstSimplify. There's no reason not to do this in InstSimplify because
    we never create a new value with this transform.

    (There's a question of whether any dominance-based transform belongs in
    either of these passes, but that's a separate issue.)

    I've changed 1 of the conditions for the fold (1 of the blocks for the
    branch must be the block we started with) into an assert because I'm not
    sure how that could ever be false.

    We need 1 extra check to make sure that the instruction itself is in a
    basic block because passes other than InstCombine may be using InstSimplify
    as an analysis on values that are not wired up yet.

    The 3-way compare changes show that InstCombine has some kind of
    phase-ordering hole. Otherwise, we would have already gotten the intended
    final result that we now show here. (detail)
    by spatel
  1691. Simplify the __builtin_constant_p test that was used to catch rC347417 failure

    Reviewers: rsmith, void, shafik

    Reviewed By: void

    Subscribers: kristina, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54964 (detail)
    by maskray
  1692. [TableGen] Examine entire subreg compositions to detect ambiguity

    When tablegen detects that there exist two subregister compositions that
    result in the same value for some register, it will emit a warning. This
    kind of an overlap in compositions should only happen when it is caused
    by a user-defined composition. It can happen, however, that the user-
    defined composition is not identically equal to another one, but it does
    produce the same value for one or more registers. In such cases suppress
    the warning.
    This patch is to silence the warning when building the System Z backend
    after D50725.

    Differential Revision: https://reviews.llvm.org/D50977 (detail)
    by kparzysz
  1693. [GlobalISel] LegalizationArtifactCombiner: Combine aext([asz]ext x) -> [asz]ext x

    Summary:
    Replace `aext([asz]ext x)` with `aext/sext/zext x` in order to
    reduce the number of instructions generated to clean up some
    legalization artifacts.

    Reviewers: aditya_nandakumar, dsanders, aemerson, bogner

    Reviewed By: aemerson

    Subscribers: rovka, kristof.beyls, javed.absar, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54174 (detail)
    by volkan
  1694. Add missing REQUIRES to new test

    Test added in r347887 requires an x86 target. (detail)
    by tejohnson
  1695. [llvm-objcopy] Delete redundant !Config.xx.empty() when followed by positive is_contained() check

    Summary: The original intention of !Config.xx.empty() was probably to emphasize the thing that is currently considered, but I feel the simplified form is actually easier to understand and it is also consistent with the call sites in other llvm components.

    Reviewers: alexshap, rupprecht, jakehehrlich, jhenderson, espindola

    Reviewed By: alexshap, rupprecht

    Subscribers: emaste, arichardson, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55040 (detail)
    by maskray
  1696. Avoid redundant reference to isPodLike in SmallVect/Optional implementation

    NFC, preparatory work for isPodLike cleaning.

    Differential Revision: https://reviews.llvm.org/D55005 (detail)
    by serge_sans_paille
  1697. [LICM] Reapply r347776 "Make LICM able to hoist phis" with fix

    This commit caused a large compile-time slowdown in some cases when NDEBUG is
    off due to the dominator tree verification it added. Fix this by only doing
    dominator tree and loop info verification when something has been hoisted.

    Differential Revision: https://reviews.llvm.org/D52827 (detail)
    by john.brawn
  1698. [analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__

    Differential Revision: https://reviews.llvm.org/D52986 (detail)
    by szelethus
  1699. [ThinLTO] Allow importing of multiple symbols with same GUID

    Summary:
    The is the clang side of the fix in D55047, to handle the case where
    two different modules have local variables with the same GUID because
    they had the same source file name at compilation time. Allow multiple
    symbols with the same GUID to be imported, and test that this case works
    with the distributed backend path.

    Depends on D55047.

    Reviewers: evgeny777

    Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits

    Differential Revision: https://reviews.llvm.org/D55048 (detail)
    by tejohnson
  1700. [ThinLTO] Import local variables from the same module as caller

    Summary:
    We can sometimes end up with multiple copies of a local variable that
    have the same GUID in the index. This happens when there are local
    variables with the same name that are in different source files having the
    same name/path at compile time (but compiled into different bitcode objects).

    In this case make sure we import the copy in the caller's module.
    This enables importing both of the variables having the same GUID
    (but which will have different promoted names since the module paths,
    and therefore the module hashes, will be distinct).

    Importing the wrong copy is particularly problematic for read only
    variables, since we must import them as a local copy whenever
    referenced. Otherwise we get undefs at link time.

    Note that the llvm-lto.cpp and ThinLTOCodeGenerator changes are needed
    for testing the distributed index case via clang, which will be sent as
    a separate clang-side patch shortly. We were previously not doing the
    dead code/read only computation before computing imports when testing
    distributed index generation (like it was for testing importing and
    other ThinLTO mechanisms alone).

    Reviewers: evgeny777

    Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, dang, llvm-commits

    Differential Revision: https://reviews.llvm.org/D55047 (detail)
    by tejohnson
  1701. git-llvm: Fix incremental population of svn tree.

    "svn update --depth=..." is, annoyingly, not a specification of the
    desired depth, but rather a _limit_ added on top of the "sticky" depth
    in the working-directory. However, if the directory doesn't exist yet,
    then it sets the sticky depth of the new directory entries.

    Unfortunately, the svn command-line has no way of expanding the depth
    of a directory from "empty" to "files", without also removing any
    already-expanded subdirectories. The way you're supposed to increase
    the depth of an existing directory is via --set-depth, but
    --set-depth=files will also remove any subdirs which were already
    requested.

    This change avoids getting into the state of ever needing to increase
    the depth of an existing directory from "empty" to "files" in the
    first place, by:

    1. Use svn update --depth=files, not --depth=immediates.

    The latter has the effect of checking out the subdirectories and
    marking them as depth=empty. The former excludes sub-directories from
    the list of entries, which avoids the problem.

    2. Explicitly populate missing parent directories.

    Using --parents seemed nice and easy, but it marks the parent dirs as
    depth=empty. Instead, check out parents explicitly if they're missing. (detail)
    by jyknight
  1702. [SimplifyCFG] auto-generate complete checks; NFC (detail)
    by spatel
  1703. [InstCombine] auto-generate complete checks; NFC (detail)
    by spatel
  1704. [AMDGPU] Add and update scalar instructions

    This patch adds support for S_ANDN2, S_ORN2 32-bit and 64-bit instructions and adds splits to move them to the vector unit (for which there is no equivalent instruction). It modifies the way that the more complex scalar instructions are lowered to vector instructions by first breaking them down to sequences of simpler scalar instructions which are then lowered through the existing code paths. The pattern for S_XNOR has also been updated to apply inversion to one input rather than the output of the XOR as the result is equivalent and may allow leaving the NOT instruction on the scalar unit.

    A new tests for NAND, NOR, ANDN2 and ORN2 have been added, and existing tests now hit the new instructions (and have been modified accordingly).

    Differential: https://reviews.llvm.org/D54714 (detail)
    by gsellers
  1705. Fix: Add support for TFE/LWE in image intrinsic

    My change svn-id: 347871 caused a buildbot failure due to an unused
    variable def (used in an assert).

    Change-Id: Ia882d18bb6fa79b4d7bbfda422b9ea5d23eab336 (detail)
    by dstuttard
  1706. [libcxx] More fixes to XFAILs for aligned allocation tests for macosx 10.13

    Those tests are a real pain to tweak. (detail)
    by Louis Dionne
  1707. Revert r347823 "[TextAPI] Switch back to a custom Platform enum."

    It broke the Windows buildbots, e.g.
    http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21829/steps/test/logs/stdio

    This also reverts the follow-ups: r347824, r347827, and r347836. (detail)
    by hans
  1708. Mark __builtin_shufflevector as using custom type checking

    The custom handling seems to all be implemented already.
    This avoids regressions in a future patch when float vectors
    are ordinarily promoted to double vectors in variadic calls. (detail)
    by arsenm
  1709. [CallSiteSplitting] Report edge deletion to DomTreeUpdater

    Summary:
    When splitting musttail calls, the split blocks' original terminators
    get removed; inform the DTU when this happens.

    Also add a testcase that fails an assertion in the DTU without this fix.


    Reviewers: fhahn, junbuml

    Reviewed By: fhahn

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D55027 (detail)
    by josepht
  1710. Add support for TFE/LWE in image intrinsics

    TFE and LWE support requires extra result registers that are written in the
    event of a failure in order to detect that failure case.
    The specific use-case that initiated these changes is sparse texture support.

    This means that if image intrinsics are used with either option turned on, the
    programmer must ensure that the return type can contain all of the expected
    results. This can result in redundant registers since the vector size must be a
    power-of-2.

    This change takes roughly 6 parts:
    1. Modify the instruction defs in tablegen to add new instruction variants that
    can accomodate the extra return values.
    2. Updates to lowerImage in SIISelLowering.cpp to accomodate setting TFE or LWE
    (where the bulk of the work for these instruction types is now done)
    3. Extra verification code to catch cases where intrinsics have been used but
    insufficient return registers are used.
    4. Modification to the adjustWritemask optimisation to account for TFE/LWE being
    enabled (requires extra registers to be maintained for error return value).
    5. An extra pass to zero initialize the error value return - this is because if
    the error does not occur, the register is not written and thus must be zeroed
    before use. Also added a new (on by default) option to ensure ALL return values
    are zero-initialized that is required for sparse texture support.
    6. Disable the inst_combine optimization in the presence of tfe/lwe (later TODO
    for this to re-enable and handle correctly).

    There's an additional fix now to avoid a dmask=0

    For an image intrinsic with tfe where all result channels except tfe
    were unused, I was getting an image instruction with dmask=0 and only a
    single vgpr result for tfe. That is incorrect because the hardware
    assumes there is at least one vgpr result, plus the one for tfe.

    Fixed by forcing dmask to 1, which gives the desired two vgpr result
    with tfe in the second one.

    The TFE or LWE result is returned from the intrinsics using an aggregate
    type. Look in the test code provided to see how this works, but in essence IR
    code to invoke the intrinsic looks as follows:

    %v = call {<4 x float>,i32} @llvm.amdgcn.image.load.1d.v4f32i32.i32(i32 15,
                                          i32 %s, <8 x i32> %rsrc, i32 1, i32 0)
    %v.vec = extractvalue {<4 x float>, i32} %v, 0
    %v.err = extractvalue {<4 x float>, i32} %v, 1

    Differential revision: https://reviews.llvm.org/D48826

    Change-Id: If222bc03642e76cf98059a6bef5d5bffeda38dda (detail)
    by dstuttard
  1711. inhereit LLVM_ENABLE_LIBXML2

    Summary: When building in an LLVM context, we should respect its LLVM_ENABLE_LIBXML2 option.

    Reviewers: vitalybuka, mspertus, modocache

    Reviewed By: modocache

    Subscribers: mgorny, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53212 (detail)
    by david2050
  1712. [CVP] tidy processCmp(); NFC

    1. The variables were confusing: 'C' typically refers to a constant, but here it was the Cmp.
    2. Formatting violations.
    3. Simplify code to return true/false constant. (detail)
    by spatel
  1713. Revert "[LICM] Enable control flow hoisting by default" and "[LICM] Reapply r347190 "Make LICM able to hoist phis" with fix"

    This reverts commits r347776 and r347778.

    The first one, r347776, caused significant compile time regressions
    for certain input files, see PR39836 for details. (detail)
    by mstorsjo
  1714. [CVP] auto-generate complete test checks; NFC (detail)
    by spatel
  1715. [OpenCL] Improve diags for addr spaces in templates

    Fix ICEs on template instantiations that were leading to
    the creation of invalid code patterns with address spaces.

    Incorrect cases are now diagnosed properly.

    Differential Revision: https://reviews.llvm.org/D54858 (detail)
    by stulova
  1716. Revert r347596 "Support for inserting profile-directed cache prefetches"

    It causes asserts building BoringSSL. See https://crbug.com/91009#c3 for
    repro.

    This also reverts the follow-ups:
    Revert r347724 "Do not insert prefetches with unsupported memory operands."
    Revert r347606 "[X86] Add dependency from X86 to ProfileData after rL347596"
    Revert r347607 "Add new passes to X86 pipeline tests" (detail)
    by hans
  1717. Set MustBuildLookupTable on PrimaryContext in ExternalASTMerger

    Summary:
    `MustBuildLookupTable` must always be called on a primary context as we otherwise
    trigger an assert, but we don't ensure that this will always happen in our code right now.

    This patch explicitly requests the primary context when doing this call as this shouldn't break
    anything (as calling `getPrimaryContext` on a context which is its own primary context is a no-op)
    but will catch these rare cases where we somehow operate on a declaration context that is
    not its own primary context.

    See also D54863.

    Reviewers: martong, a.sidorin, shafik

    Reviewed By: martong

    Subscribers: davide, rnkovacs, cfe-commits

    Tags: #lldb

    Differential Revision: https://reviews.llvm.org/D54898 (detail)
    by Raphael Isemann
  1718. [GlobalISel] Fix insertion of stack-protector epilogue

    * Tell the StackProtector pass to generate the epilogue instrumentation
      when GlobalISel is enabled because GISel currently does not implement
      the same deferred epilogue insertion as SelectionDAG.
    * Update StackProtector::InsertStackProtectors() to find a stack guard
      slot by searching for the llvm.stackprotector intrinsic when the
      prologue was not created by StackProtector itself but the pass still
      needs to generate the epilogue instrumentation. This fixes a problem
      when the pass would abort because the stack guard AllocInst pointer
      was null when generating the epilogue -- test
      CodeGen/AArch64/GlobalISel/arm64-irtranslator-stackprotect.ll.

    Differential Revision: https://reviews.llvm.org/D54518 (detail)
    by petr.pavlu
  1719. [GlobalISel] Make EnableGlobalISel always set when GISel is enabled

    Change meaning of TargetOptions::EnableGlobalISel. The flag was
    previously set only when a target switched on GlobalISel but it is now
    always set when the GlobalISel pipeline is enabled. This makes the flag
    consistent with TargetOptions::EnableFastISel and allows its use in
    other parts of the compiler to determine when GlobalISel is enabled.

    The EnableGlobalISel flag had previouly only one use in
    TargetPassConfig::isGlobalISelAbortEnabled(). The method used its value
    to determine if GlobalISel was enabled by a target and returned false in
    such a case. To preserve the current behaviour, a new flag
    TargetOptions::GlobalISelAbort is introduced to separately record the
    abort behaviour.

    Differential Revision: https://reviews.llvm.org/D54518 (detail)
    by petr.pavlu
  1720. Adding a FIXME test to document an area for improvement with the cert-err58-cpp check; NFC. (detail)
    by aaronballman
  1721. [llvm-rc] Support EXSTYLE statement.

    Patch by Jacek Caban!

    Differential Revision: https://reviews.llvm.org/D55020 (detail)
    by mstorsjo
  1722. [llvm-mca][MC] Add the ability to declare which processor resources model load/store queues (PR36666).

    This patch adds the ability to specify via tablegen which processor resources
    are load/store queue resources.

    A new tablegen class named MemoryQueue can be optionally used to mark resources
    that model load/store queues.  Information about the load/store queue is
    collected at 'CodeGenSchedule' stage, and analyzed by the 'SubtargetEmitter' to
    initialize two new fields in struct MCExtraProcessorInfo named `LoadQueueID` and
    `StoreQueueID`.  Those two fields are identifiers for buffered resources used to
    describe the load queue and the store queue.
    Field `BufferSize` is interpreted as the number of entries in the queue, while
    the number of units is a throughput indicator (i.e. number of available pickers
    for loads/stores).

    At construction time, LSUnit in llvm-mca checks for the presence of extra
    processor information (i.e. MCExtraProcessorInfo) in the scheduling model.  If
    that information is available, and fields LoadQueueID and StoreQueueID are set
    to a value different than zero (i.e. the invalid processor resource index), then
    LSUnit initializes its LoadQueue/StoreQueue based on the BufferSize value
    declared by the two processor resources.

    With this patch, we more accurately track dynamic dispatch stalls caused by the
    lack of LS tokens (i.e. load/store queue full). This is also shown by the
    differences in two BdVer2 tests. Stalls that were previously classified as
    generic SCHEDULER FULL stalls, are not correctly classified either as "load
    queue full" or "store queue full".

    About the differences in the -scheduler-stats view: those differences are
    expected, because entries in the load/store queue are not released at
    instruction issue stage. Instead, those are released at instruction executed
    stage.  This is the main reason why for the modified tests, the load/store
    queues gets full before PdEx is full.

    Differential Revision: https://reviews.llvm.org/D54957 (detail)
    by adibiagio
  1723. AMDGPU/InsertWaitcnts: Remove the dependence on MachineLoopInfo

    Summary:
    MachineLoopInfo cannot be relied on for correctness, because it cannot
    properly recognize loops in irreducible control flow which can be
    introduced by late machine basic block optimization passes. See the new
    test case for the reduced form of an example that occurred in practice.

    Use a simple fixpoint iteration instead.

    In order to facilitate this change, refactor WaitcntBrackets so that it
    only tracks pending events and registers, rather than also maintaining
    state that is relevant for the high-level algorithm. Various accessor
    methods can be removed or made private as a consequence.

    Affects (in radv):
    - dEQP-VK.glsl.loops.special.{for,while}_uniform_iterations.select_iteration_count_{fragment,vertex}

    Fixes: r345719 ("AMDGPU: Rewrite SILowerI1Copies to always stay on SALU")

    Reviewers: msearles, rampitec, scott.linder, kanarayan

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam

    Differential Revision: https://reviews.llvm.org/D54231 (detail)
    by nha
  1724. AMDGPU/InsertWaitcnt: Consistently use uint32_t for scores / time points

    Summary:
    There is one obsolete reference to using -1 as an indication of "unknown",
    but this isn't actually used anywhere.

    Using unsigned makes robust wrapping checks easier.

    Reviewers: msearles, rampitec, scott.linder, kanarayan

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, llvm-commits, tpr, t-tye, hakzsam

    Differential Revision: https://reviews.llvm.org/D54230 (detail)
    by nha
  1725. AMDGPU/InsertWaitcnt: Remove unused WaitAtBeginning

    Reviewers: msearles, rampitec, scott.linder, kanarayan

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam

    Differential Revision: https://reviews.llvm.org/D54229 (detail)
    by nha
  1726. AMDGPU/InsertWaitcnts: Simplify pending events tracking

    Summary:
    Instead of storing the "score" (last time point) of the various relevant
    events, only store whether an event is pending or not.

    This is sufficient, because whenever only one event of a count type is
    pending, its last time point is naturally the upper bound of all time
    points of this count type, and when multiple event types are pending,
    the count type has gone out of order and an s_waitcnt to 0 is required
    to clear any pending event type (and will then clear all pending event
    types for that count type).

    This also removes the special handling of GDS_GPR_LOCK and EXP_GPR_LOCK.
    I do not understand what this special handling ever attempted to achieve.
    It has existed ever since the original port from an internal code base,
    so my best guess is that it solved a problem related to EXEC handling in
    that internal code base.

    Reviewers: msearles, rampitec, scott.linder, kanarayan

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam

    Differential Revision: https://reviews.llvm.org/D54228 (detail)
    by nha
  1727. AMDGPU/InsertWaitcnts: Use foreach loops for inst and wait event types

    Summary:
    It hides the type casting ugliness, and I happened to have to add a new
    such loop (in a later patch).

    Reviewers: msearles, rampitec, scott.linder, kanarayan

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam

    Differential Revision: https://reviews.llvm.org/D54227 (detail)
    by nha
  1728. AMDGPU/InsertWaitcnts: Untangle some semi-global state

    Summary:
    Reduce the statefulness of the algorithm in two ways:

    1. More clearly split generateWaitcntInstBefore into two phases: the
       first one which determines the required wait, if any, without changing
       the ScoreBrackets, and the second one which actually inserts the wait
       and updates the brackets.

    2. Communicate pre-existing s_waitcnt instructions using an argument to
       generateWaitcntInstBefore instead of through the ScoreBrackets.

    To simplify these changes, a Waitcnt structure is introduced which carries
    the counts of an s_waitcnt instruction in decoded form.

    There are some functional changes:

    1. The FIXME for the VCCZ bug workaround was implemented: we only wait for
       SMEM instructions as required instead of waiting on all counters.

    2. We now properly track pre-existing waitcnt's in all cases, which leads
       to less conservative waitcnts being emitted in some cases.

         s_load_dword ...
         s_waitcnt lgkmcnt(0)    <-- pre-existing wait count
         ds_read_b32 v0, ...
         ds_read_b32 v1, ...
         s_waitcnt lgkmcnt(0)    <-- this is too conservative
         use(v0)
         more code
         use(v1)

       This increases code size a bit, but the reduced latency should still be a
       win in basically all cases. The worst code size regressions in my shader-db
       are:

    WORST REGRESSIONS - Code Size
    Before After     Delta Percentage
       1724  1736        12    0.70 %   shaders/private/f1-2015/1334.shader_test [0]
       2276  2284         8    0.35 %   shaders/private/f1-2015/1306.shader_test [0]
       4632  4640         8    0.17 %   shaders/private/ue4_elemental/62.shader_test [0]
       2376  2384         8    0.34 %   shaders/private/f1-2015/1308.shader_test [0]
       3284  3292         8    0.24 %   shaders/private/talos_principle/1955.shader_test [0]

    Reviewers: msearles, rampitec, scott.linder, kanarayan

    Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam

    Differential Revision: https://reviews.llvm.org/D54226 (detail)
    by nha
  1729. [CODE_OWNERS] Add myself as code owner for MinGW (detail)
    by mstorsjo
  1730. [NFC] Add two XFAIL tests from PR39783 (detail)
    by mkazantsev
  1731. Disable TermFolding in LoopSimplifyCFG until PR39783 is fixed (detail)
    by mkazantsev
  1732. [LoopStrengthReduce] ComplexityLimit as an option

    Convert ComplexityLimit into a command line value.

    Differential Revision: https://reviews.llvm.org/D54899 (detail)
    by sam_parker
  1733. [Inliner] Modify the merging of min-legal-vector-width attribute to better handle when the caller or callee don't have the attribute.

    Lack of an attribute means that the function hasn't been checked for what vector width it requires. So if the caller or the callee doesn't have the attribute we should make sure the combined function after inlining does not have the attribute.

    If the caller already doesn't have the attribute we can just avoid adding it. Otherwise if the callee doesn't have the attribute just remove the caller's attribute. (detail)
    by ctopper
  1734. [Inliner] Add test for merging of min-legal-vector-width function attribute.

    This should have been added in r337844, but apparently was I failed to 'git add' the file. (detail)
    by ctopper
  1735. [CGP] Improve compile time for complex addressing mode

    This is a fix for PR39625 with improvement the compile time
    by reducing the number of intermediate Phi nodes created.

    Reviewers: john.brawn, reames
    Reviewed By: john.brawn
    Subscribers: llvm-commits
    Differential Revision: https://reviews.llvm.org/D54932 (detail)
    by skatkov
  1736. Revert "[TextAPI] Fix a memory leak in the TBD reader." (detail)
    by Juergen Ributzka
  1737. [TextAPI] Fix a memory leak in the TBD reader.

    This fixes an issue where we were leaking the YAML document if there was a
    parsing error. (detail)
    by Juergen Ributzka
  1738. [TextAPI] Switch back to a custom Platform enum.

    Moving to PlatformType from BinaryFormat had some UB fallout when handing
    unknown platforms or malformed input files.

    This should fix the sanitizer bots. (detail)
    by Juergen Ributzka
  1739. [X86] Correct comment. NFC (detail)
    by ctopper
  1740. Add Hurd target to Clang driver (2/2)

    This adds Hurd toolchain support to Clang's driver in addition
    to handling translating the triple from Hurd-compatible form to
    the actual triple registered in LLVM.

    (Phabricator was stripping the empty files from the patch so I
    manually created them)

    Patch by sthibaul (Samuel Thibault)

    Differential Revision: https://reviews.llvm.org/D54379 (detail)
    by Kristina Brooks
  1741. Add Hurd target to LLVMSupport (1/2)

    Add the required target triples to LLVMSupport to support Hurd
    in LLVM (formally `pc-hurd-gnu`).

    Patch by sthibaul (Samuel Thibault)

    Differential Revision: https://reviews.llvm.org/D54378 (detail)
    by Kristina Brooks
  1742. [PowerPC] Fix a conversion is not considered when the ISD::BR_CC node making the instruction selection

    Summary:
    A signed comparison of i1 values produces the opposite result to an unsigned one if the condition code
    includes less-than or greater-than. This is so because 1 is the most negative signed i1 number and the
    most positive unsigned i1 number. The CR-logical operations used for such comparisons are non-commutative
    so for signed comparisons vs. unsigned ones, the input operands just need to be swapped.

    Reviewed By: steven.zhang

    Differential Revision: https://reviews.llvm.org/D54825 (detail)
    by helijia
  1743. [PowerPC] [NFC] Add test cases to the ISD::BR_CC node in the instruction selection
    Add the following test case for the ISD::BR_CC node in the instruction selection
    define i64 @testi64slt(i64 %c1, i64 %c2, i64 %c3, i64 %c4, i64 %a1, i64 %a2) #0 {
    entry:
      %cmp1 = icmp eq i64 %c3, %c4
      %cmp3tmp = icmp eq i64 %c1, %c2
      %cmp3 = icmp slt i1 %cmp3tmp, %cmp1
      br i1 %cmp3, label %iftrue, label %iffalse
    iftrue:
      ret i64 %a1
    iffalse:
      ret i64 %a2
    }
    The data type i64 can be replaced by i32, i64, float, double

    And condition codes can be replaced by: SETEQ, SETEN, SELT, SETLE, SETGT, SETGE,SETULT, SETULE, SSETGT, and SETUGE

    Reviewed By: steven.zhang

    Differential Revision: https://reviews.llvm.org/D54824 (detail)
    by helijia
  1744. [TextAPI] TBD Reader/Writer (bot fixes: take 2)

    Replace the tuple with a struct to work around an explicit constructor bug. (detail)
    by Juergen Ributzka
  1745. NFC. Use unsigned type for uses counter in CaptureTracking (detail)
    by apilipenko
  1746. [Documentation] Try to fix build failure in cppcoreguidelines-narrowing-conversions documentation (detail)
    by eugenezelenko
  1747. [TextAPI] TBD Reader/Writer (bot fixes)

    Trying if switching from a vector to an array will appeas the bots. (detail)
    by Juergen Ributzka
  1748. [TextAPI] TBD Reader/Writer

    Add basic infrastructure for reading and writting TBD files (version 1 - 3).

    The TextAPI library is not used by anything yet (besides the unit tests). Tool
    support will be added in a separate commit.

    The TBD format is currently documented in the implementation file (TextStub.cpp).

    https://reviews.llvm.org/D53945

    Update: This contains changes to fix issues discovered by the bots:
    - add parentheses to silence warnings.
    - rename variables
    - use PlatformType from BinaryFormat (detail)
    by Juergen Ributzka
  1749. [x86] try select simplification for target-specific nodes

    This failed to select (which might be a separate bug) in
    X86ISelDAGToDAG because we try to create a select node
    that can be simplified away after rL347227.

    This change avoids the problem by simplifying the SHRUNKBLEND
    node sooner. In the test case, we manage to realize that the
    true/false values of the select (SHRUNKBLEND) are the same thing,
    so it simplifies away completely. (detail)
    by spatel
  1750. Revert "Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. "

    This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12.

    The tests were failing on 32 bit builds, and I don't have time
    to clean them up right now. I'll recommit tomorrow with fixed tests. (detail)
    by ericwf
  1751. Ensure that test clang-tidy/export-relpath.cpp works with Windows path separators. (detail)
    by ormris
  1752. Allow cpu-dispatch forward declarations.

    As a followup to r347805, allow forward declarations of cpu-dispatch and
    cpu-specific for the same reasons.

    Change-Id: Ic1bde9be369b1f8f1d47d58e6fbdc2f9dfcdd785 (detail)
    by erichkeane
  1753. Ensure sanitizer check function calls have a !dbg location

    Function calls without a !dbg location inside a function that has a
    DISubprogram make it impossible to construct inline information and
    are rejected by the verifier. This patch ensures that sanitizer check
    function calls have a !dbg location, by carrying forward the location
    of the preceding instruction or by inserting an artificial location if
    necessary.

    This fixes a crash when compiling the attached testcase with -Os.

    rdar://problem/45311226

    Differential Revision: https://reviews.llvm.org/D53459

    Note: This reapllies r344915, modified to reuse the IRBuilder's
    DebugLoc if one exists instead of picking the one from CGDebugInfo
    since the latter may get reset when emitting thunks such as block
    helpers in the middle of emitting another function. (detail)
    by Adrian Prantl
  1754. Revert "[TextAPI] TBD Reader/Writer"

    Reverting to unbreak bots. (detail)
    by Juergen Ributzka
  1755. [TextAPI] TBD Reader/Writer

    Add basic infrastructure for reading and writting TBD files (version 1 - 3).

    The TextAPI library is not used by anything yet (besides the unit tests). Tool
    support will be added in a separate commit.

    The TBD format is currently documented in the implementation file (TextStub.cpp).

    https://reviews.llvm.org/D53945 (detail)
    by Juergen Ributzka
  1756. [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.

    Differential Revision: https://reviews.llvm.org/D54756 (detail)
    by probinson
  1757. [DebugInfo] IR/Bitcode changes for DISubprogram flags.

    Packing the flags into one bitcode word will save effort in
    adding new flags in the future.

    Differential Revision: https://reviews.llvm.org/D54755 (detail)
    by probinson
  1758. Correct 'target' default behavior on redecl, allow forward declaration.

    Declarations without the attribute were disallowed because it would be
    ambiguous which 'target' it was supposed to be on.  For example:

    void ___attribute__((target("v1"))) foo();
    void foo(); // Redecl of above, or fwd decl of below?
    void ___attribute__((target("v2"))) foo();

    However, a first declaration doesn't have that problem, and erroring
    prevents it from working in cases where the forward declaration is
    useful.

    Additionally, a forward declaration of target==default wouldn't properly
    cause multiversioning, so this patch fixes that.

    The patch was not split since the 'default' fix would require
    implementing the same check for that case, followed by undoing the same
    change for the fwd-decl implementation.

    Change-Id: I66f2c5bc2477bcd3f7544b9c16c83ece257077b0 (detail)
    by erichkeane
  1759. [Coverage] Specify the Itanium ABI triple for a C++ test (detail)
    by Vedant Kumar
  1760. [Coverage] Do not visit artificial stmts in defaulted methods (PR39822)

    There is no reason to emit coverage mappings for artificial statements
    contained within defaulted methods, as these statements are not visible
    to users.

    Only emit a mapping for the body of the defaulted method (clang treats
    the text of the "default" keyword as the body when reporting locations).
    This allows users to see how often the default method is called, but
    trims down the coverage mapping by skipping visitation of the children
    of the method.

    The immediate motivation for this change is that the lexer's
    getPreciseTokenLocEnd API cannot return the correct location when given
    an artificial statement (with a somewhat made-up location) as an input.

    Test by Orivej Desh!

    Fixes llvm.org/PR39822. (detail)
    by Vedant Kumar
  1761. Reapply "[llvm-mca] Return the total number of cycles from method Pipeline::run()."

    This reapplies r347767 (originally reviewed at: https://reviews.llvm.org/D55000)
    with a fix for the missing std::move of the Error returned by the call to
    Pipeline::runCycle().

    Below is the original commit message from r347767.

    If a user only cares about the overall latency, then the best/quickest way is to
    change method Pipeline::run() so that it returns the total number of cycles to
    the caller.

    When the simulation pipeline is run, the number of cycles (or an error) is
    returned from method Pipeline::run().
    The advantage is that no hardware event listener is needed for computing that
    latency. So, the whole process should be faster (and simpler - at least for that
    particular use case). (detail)
    by adibiagio
  1762. Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."

    This broke the lldb bots. (detail)
    by davide
  1763. [OPENMP]Fix emission of the target regions in virtual functions.

    Fixed emission of the target regions found in the virtual functions.
    Previously we may end up with the situation when those regions could be
    skipped. (detail)
    by abataev
  1764. Revert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark in check-clangd"

    This revision was causing failures on the buildbots, and our internal CI.

    See: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20856 (detail)
    by ormris
  1765. [NFC] Move MultIversioning::Type into Decl so that it can be used in
    CodeGen

    Change-Id: I32b14edca3501277e0e65672eafe3eea38c6f9ae (detail)
    by erichkeane
  1766. Fix bad _LIBCPP_ALIGNOF test (detail)
    by ericwf
  1767. Implement P0966 - string::reserve should not shrink (detail)
    by marshall
  1768. (detail)
    by yln
  1769. Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.

    Summary:
    Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

    This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

    This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

    I think we should commit this change immediately, and decide what we want to do about the ABI afterwards.

    Reviewers: ldionne, EricWF

    Reviewed By: EricWF

    Subscribers: christof, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54814 (detail)
    by ericwf
  1770. [X86] Make X86TTIImpl::getCastInstrCost properly handle the case where AVX512 is enabled, but 512-bit vectors aren't legal.

    Unlike most cost model functions this code makes a lot of table lookups without using the results from getTypeLegalizationCost. This means 512-bit vectors can be looked up even when the type isn't legal.

    This patch adds a check around the two tables that contain 512-bit types to make sure that neither of the types would be split by type legalization. Meaning 512 bit types are illegal. I wanted to write this in a somewhat generic way that uses type legalization query hooks. But if prefered, I can switch to just using is512BitVector and the subtarget feature.

    Differential Revision: https://reviews.llvm.org/D54984 (detail)
    by ctopper
  1771. [X86] Add some cost model entries for sext/zext for avx512bw

    This fixes some of scalarization costs reported for sext/zext using avx512bw. This does not fix all scalarization costs being reported. Just the worst.

    I've restricted this only to combinations of types that are legal with avx512bw like v32i1/v64i1/v32i16/v64i8 and conversions between vXi1 and vXi8/vXi16 with legal vXi8/vXi16 result types.

    Differential Revision: https://reviews.llvm.org/D54979 (detail)
    by ctopper
  1772. [X86] Add a combine for back to back VSRAI instructions

    Expansion of SIGN_EXTEND_INREG can create a VSRAI instruction. If there is already a VSRAI after it, we should combine them into a larger VSRAI

    Differential Revision: https://reviews.llvm.org/D54959 (detail)
    by ctopper
  1773. [libcxx] Remove dynarray

    Summary:
    std::dynarray had been proposed for C++14, but it was pulled out from C++14
    and there are no plans to standardize it anymore.

    Reviewers: mclow.lists, EricWF

    Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54801 (detail)
    by Louis Dionne
  1774. [DebugInfo] Give inlinable calls DILocs (PR39807)

    In PR39807 we incorrectly handle circumstances where calls are common'd
    from conditional blocks into the parent BB. Calls that can be inlined
    must always have DebugLocs, however we strip them during commoning, which
    the IR verifier asserts on.

    Fix this by using applyMergedLocation: it will perform the same DebugLoc
    stripping of conditional Locs, but will also generate an unknown location
    DebugLoc that satisfies the requirement for inlinable calls to always have
    locations.

    Some of the prior logic for selecting a DebugLoc is now likely redundant;
    I'll generate a follow-up to remove it (involves editing more regression
    tests).

    Differential Revision: https://reviews.llvm.org/D54997 (detail)
    by jmorse
  1775. [libcxx] Use clang-verify in the lit test suite even when availability is enabled (detail)
    by Louis Dionne
  1776. [gcov] Disable instrprof-gcov-fork.test.

    Test has been flaky for over a week and author hasn't fixed. (detail)
    by morehouse
  1777. [LICM] Enable control flow hoisting by default

    Differential Revision: https://reviews.llvm.org/D54949 (detail)
    by john.brawn
  1778. [analyzer] Cleanup constructors in the Z3 backend

    Summary: Left only the constructors that are actually required, and marked the move constructors as deleted. They are not used anymore and we were never sure they've actually worked correctly.

    Reviewers: george.karpenkov, NoQ

    Reviewed By: george.karpenkov

    Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, Szelethus, donat.nagy, dkrupp

    Differential Revision: https://reviews.llvm.org/D54974 (detail)
    by mramalho
  1779. [LICM] Reapply r347190 "Make LICM able to hoist phis" with fix

    This commit caused failures because it failed to correctly handle cases where
    we hoist a phi, then hoist a use of that phi, then have to rehoist that use. We
    need to make sure that we rehoist the use to _after_ the hoisted phi, which we
    do by always rehoisting to the immediate dominator instead of just rehoisting
    everything to the original preheader.

    An option is also added to control whether control flow is hoisted, which is
    off in this commit but will be turned on in a subsequent commit.

    Differential Revision: https://reviews.llvm.org/D52827 (detail)
    by john.brawn
  1780. Revert [llvm-mca] Return the total number of cycles from method Pipeline::run().

    This reverts commits 347767. (detail)
    by adibiagio
  1781. [RISCV] Support .option push and .option pop

    This adds support in the RISCVAsmParser the storing of Subtarget feature bits to a stack so that they can be pushed/popped to enable/disable multiple features at once.

    Differential Revision: https://reviews.llvm.org/D46424
    Patch by Lewis Revill. (detail)
    by asb
  1782. [InstCombine] Combine saturating add/sub with constant operands

    Combine
      sat(sat(X + C1) + C2) -> sat(X + (C1+C2))
    and
      sat(sat(X - C1) - C2) -> sat(X - (C1+C2))
    if the sign of C1 and C2 matches.

    In the unsigned case we can compute C1+C2 with saturating arithmetic,
    and InstSimplify will reduce this just to the saturation value. For
    the signed case, we cannot perform the simplification if the result
    of the addition overflows.

    This change is part of https://reviews.llvm.org/D54534. (detail)
    by nikic
  1783. [InstCombine] Canonicalize ssub.sat to sadd.sat

    Canonicalize ssub.sat(X, C) to ssub.sat(X, -C) if C is constant and
    not signed minimum. This will help further optimizations to apply.

    This change is part of https://reviews.llvm.org/D54534. (detail)
    by nikic
  1784. [ValueTracking] Determine always-overflow condition for unsigned sub

    Always-overflow was already determined for unsigned addition, but
    not subtraction. This patch establishes parity.

    This allows us to perform some additional simplifications for
    signed saturating subtractions.

    This change is part of https://reviews.llvm.org/D54534. (detail)
    by nikic
  1785. [InstCombine] Use known overflow information for saturating add/sub

    If ValueTracking can determine that the add/sub can newer overflow,
    replace it with the corresponding nuw/nsw add/sub.

    Additionally, for the unsigned case, if ValueTracking determines
    that the add/sub always overflows, replace the result with the
    saturation value.

    This change is part of https://reviews.llvm.org/D54534. (detail)
    by nikic
  1786. [InstCombine] Canonicalize const arg for saturating adds

    If a saturating add intrinsic has one constant argument, make sure
    it is on the RHS. This will simplify further transformations.

    This change is part of https://reviews.llvm.org/D54534. (detail)
    by nikic
  1787. [Hexagon] Add missing flags to ELF YAMLIO (detail)
    by kparzysz
  1788. [llvm-mca] Return the total number of cycles from method Pipeline::run().

    If a user only cares about the overall latency, then the best/quickest way is to
    change method Pipeline::run() so that it returns the total number of cycles to
    the caller.

    When the simulation pipeline is run, the number of cycles (or an error) is
    returned from method Pipeline::run().
    The advantage is that no hardware event listener is needed for computing that
    latency. So, the whole process should be faster (and simpler - at least for that
    particular use case). (detail)
    by adibiagio
  1789. llvm-git: More tweaks.

    On python3, use bytes for reading and applying the patch file, rather
    than str. This fixes encoding issues when applying patches with
    python3.X (reported by zturner).

    Also, simplify and speed up "svn update" via svn's "--parents"
    argument, instead of manually computing and supplying the list of
    parent directories to update. (detail)
    by jyknight
  1790. [libcxx] Apply _LIBCPP_INLINE_VISIBILITY for std::hash for string_view (detail)
    by Louis Dionne
  1791. Fix DynamicLibraryTests build on Windows when LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is ON

    extract_symbols.py (introduced in D18826) expects all of its library arguments
    to be in the same directory - typically <config>/lib. DynamicLibraryLib.lib is
    instead to be found in lib/<config>.
    This patch intended to make DynamicLibraryLib.lib be created in <config>/lib
    alongside most of the other libraries.

    I previously tried passing absolute paths to extract_symbols.py but this
    generated command lines that were too long for Visual Studio 2015: D54587

    Differential Revision: https://reviews.llvm.org/D54701 (detail)
    by michaelplatings
  1792. [ThinLTO] Correct linkonce_any function import linkage. NFC.

    Summary:
    This is a NFC as we do not import non-odr vague linkage when computing
    for import list for a module.

    Reviewers: tejohnson, pcc

    Subscribers: inglorion, dexonsmith, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54928 (detail)
    by trentxintong
  1793. Fix build error due to missing cctype include
    in ARMTargetParser.cpp. (detail)
    by davidspickett
  1794. Fix false positive with lambda assignments in cert-err58-cpp.

    This check is about preventing exceptions from being thrown before main() executes, and assigning a lambda (rather than calling it) to a global object cannot throw any exceptions. (detail)
    by aaronballman
  1795. [clang-tidy] Added a test -export-fixes with relative paths.

    Summary: A test for D51864.

    Reviewers: ioeric, steveire

    Reviewed By: steveire

    Subscribers: xazax.hun, cfe-commits

    Differential Revision: https://reviews.llvm.org/D51865 (detail)
    by ibiryukov
  1796. [SLP]Fix PR39774: Set ReductionRoot if the original instruction is vectorized.

    Summary:
    If the original reduction root instruction was vectorized, it might be
    removed from the tree. It means that the insertion point may become
    invalidated and the whole vectorization of the reduction leads to the
    incorrect output result.
    The ReductionRoot instruction must be marked as externally used so it
    could not be removed. Otherwise it might cause inconsistency with the
    cost model and we may end up with too optimistic optimization.

    Reviewers: RKSimon, spatel, hfinkel, mkuper

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54955 (detail)
    by abataev
  1797. Re-commit r347419 "Update call to EvaluateAsInt() to the new syntax." (detail)
    by hans
  1798. Re-commit r347417 "Re-Reinstate 347294 with a fix for the failures."

    This was reverted in r347656 due to me thinking it caused a miscompile of
    Chromium. Turns out it was the Chromium code that was broken. (detail)
    by hans
  1799. [clangd] Fix test broken in r347754. (detail)
    by ioeric
  1800. [clangd] Less penalty for cross-namespace completions. (detail)
    by ioeric
  1801. [clangd] Build and test IndexBenchmark in check-clangd

    Summary:
    Include IndexBenchmark in check-clangd to make sure we won't forget to update
    it when doing breaking changes; also fix an out-of-date test input.

    Reviewers: ilya-biryukov

    Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54998 (detail)
    by hokein
  1802. [ASTImporter] Changed use of Import to Import_New in ASTImporter.

    Reviewers: a.sidorin, shafik, a_sidorin

    Reviewed By: a_sidorin

    Subscribers: gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53818 (detail)
    by balazske
  1803. Fix -Winfinite-recursion compile error. (detail)
    by hokein
  1804. Fix build of r347741 by adding missing vector
    include to ARMTargetParser.h. (detail)
    by davidspickett
  1805. [MachineScheduler] Add support for clustering mem ops with FI base operands

    Before this patch, the following stores in `merge_fail` would fail to be
    merged, while they would get merged in `merge_ok`:

    ```
    void use(unsigned long long *);
    void merge_fail(unsigned key, unsigned index)
    {
      unsigned long long args[8];
      args[0] = key;
      args[1] = index;
      use(args);
    }
    void merge_ok(unsigned long long *dst, unsigned a, unsigned b)
    {
      dst[0] = a;
      dst[1] = b;
    }
    ```

    The reason is that `getMemOpBaseImmOfs` would return false for FI base
    operands.

    This adds support for this.

    Differential Revision: https://reviews.llvm.org/D54847 (detail)
    by thegameg
  1806. [CodeGen][NFC] Make `TII::getMemOpBaseImmOfs` return a base operand

    Currently, instructions doing memory accesses through a base operand that is
    not a register can not be analyzed using `TII::getMemOpBaseRegImmOfs`.

    This means that functions such as `TII::shouldClusterMemOps` will bail
    out on instructions using an FI as a base instead of a register.

    The goal of this patch is to refactor all this to return a base
    operand instead of a base register.

    Then in a separate patch, I will add FI support to the mem op clustering
    in the MachineScheduler.

    Differential Revision: https://reviews.llvm.org/D54846 (detail)
    by thegameg
  1807. Fix a false-positive with cert-err58-cpp.

    If a variable is declared constexpr then its initializer needs to be a constant expression, and thus, cannot throw. This check is about not throwing exceptions before main() runs, and so it doesn't apply if the initializer cannot throw. This silences the diagnostic when initializing a constexpr variable and fixes PR35457. (detail)
    by aaronballman
  1808. [DebugInfo] Rename EmitDebugThreadLocal back to EmitDebugValue. NFC

    This reverts r294500. DwarfCompileUnit::addAddressExpr uses DIEExpr
    for PCOffset. In that case the expression is unrelated to thread locals
    and so emitting a value of the DIEExpr does not have to always mean
    emit-debug-thread-local. (detail)
    by atanasyan
  1809. [TableGen] Better error checking for TIED_TO constraints.

    There are quite strong constraints on how you can use the TIED_TO
    constraint between MC operands, many of which are currently not
    checked until compiler run time.

    MachineVerifier enforces that operands can only be tied together in
    pairs (no three-way ties), and MachineInstr::tieOperands enforces that
    one of the tied operands must be an output operand (def) and the other
    must be an input operand (use).

    Now we check these at TableGen time, so that if you violate any of
    them in a new instruction definition, you find out immediately,
    instead of having to wait until you compile something that makes code
    generation hit one of those assertions.

    Also in this commit, all the error reports in ParseConstraint now
    include the name and source location of the def where the problem
    happened, so that if you do trigger any of these errors, it's easier
    to find the part of your TableGen input where you made the mistake.

    The trunk sources already build successfully with this additional
    error check, so I think no in-tree target has any of these problems.

    Reviewers: fhahn, lhames, nhaehnle, MatzeB

    Reviewed By: MatzeB

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D53815 (detail)
    by statham
  1810. [ARM, AArch64] Move ARM/AArch64 target parsers into
    separate files to enable future changes.
       
    This moves ARM and AArch64 target parsing into their
    own files. They are still accessible through
    TargetParser.h as before.

    Several functions in AArch64 which were just forwarders to ARM
    have been removed. All except AArch64::getFPUName were unused,
    and that was only used in a test. Which itself was overlapping
    one in ARM, so it has also been removed.

    Differential revision: https://reviews.llvm.org/D53980 (detail)
    by davidspickett
  1811. [clangd] Canonicalize file path in URIForFile.

    Summary:
    File paths in URIForFile can come from index or local AST. Path from
    index goes through URI transformation and the final path is resolved by URI
    scheme and could be potentially different from the original path. Hence, we
    should do the same transformation for all paths. We do this in URIForFile, which
    now converts a path to URI and back to a canonicalized path.

    Reviewers: sammccall

    Reviewed By: sammccall

    Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54845 (detail)
    by ioeric
  1812. [clangd] Fix backward-compatibility - follow-up to textDocument/SymbolInfo

    Apparently clang 3.6 couldn't build the preceding patch. (detail)
    by Jan Korous
  1813. [clangd] Bump vscode-clangd v0.0.7 (detail)
    by hokein
  1814. [SystemZ::TTI]  Improve cost for compare of i64 with extended i32 load

    CGF/CLGF compares an i64 register with a sign/zero extended loaded i32 value
    in memory.

    This patch makes such a load considered foldable and so gets a 0 cost.

    Review: Ulrich Weigand
    https://reviews.llvm.org/D54944 (detail)
    by jonpa
  1815. [SystemZ::TTI]  Improve costs for i16 add, sub and mul against memory.

    AH, SH and MH costs are already covered in the cases where LHS is 32 bits and
    RHS is 16 bits of memory sign-extended to i32.

    As these instructions are also used when LHS is i16, this patch recognizes
    that the loads will get folded then as well.

    Review: Ulrich Weigand
    https://reviews.llvm.org/D54940 (detail)
    by jonpa
  1816. [SystemZ::TTI] Improved cost values for comparison against memory.

    Single instructions exist for i8 and i16 comparisons of memory against a
    small immediate.

    This patch makes sure that if the load in these cases has a single user (the
    ICmp), it gets a 0 cost (folded), and also that the ICmp gets a cost of 1.

    Review: Ulrich Weigand
    https://reviews.llvm.org/D54897 (detail)
    by jonpa
  1817. [SystemZ::TTI]  Return zero cost for scalar load/store connected with a bswap.

    Since byte-swapping loads and stores are supported, a 'load -> bswap' or
    'bswap -> store' sequence should have the cost of one.

    Review: Ulrich Weigand
    https://reviews.llvm.org/D54870 (detail)
    by jonpa
  1818. [llvm-objcopy] Hook up the -V alias to --version, output "GNU strip"

    This allows libtool to detect the presence of llvm-strip and use
    it with the options --strip-debug and --strip-unneeded.

    Also hook up the -V alias for objcopy.

    Differential Revision: https://reviews.llvm.org/D54936 (detail)
    by mstorsjo
  1819. PR39809: (const void*)0 is not a null pointer constant in C. (detail)
    by rsmith
  1820. PR12884: Add test (bug is already fixed). (detail)
    by rsmith
  1821. Move LoopHint.h from Sema to Parse

    struct LoopHint was only used within Parse and not in any of the Sema or
    Codegen files.  In the non-Parse files where it was included, it either wasn't
    used or LoopHintAttr was used, so its inclusion did nothing. (detail)
    by rtrieu
  1822. [CodeGen] Fix included headers.

    Remove the included Parse header because CodeGen should not depend on Parse.
    Instead, include the Lex headers that it needs instead. (detail)
    by rtrieu
  1823. [diagtool] Remove unneeded header includes. (detail)
    by rtrieu
  1824. Do not insert prefetches with unsupported memory operands.

    Summary:
    Ignore advices where the memory operand of the 'anchor' instruction
    uses unsupported register types.

    Reviewers: davidxl

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54983 (detail)
    by mtrofin
  1825. [OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC)

    The flag ColonExpected is not changed after being initialized to
    false at declaration.

    Patch by Ahsan Saghir

    Differential Revision: https://reviews.llvm.org/D54958 (detail)
    by kli
  1826. [X86] Add test cases to show that we don't properly take -mprefer-vector-width=256 and -min-legal-vector-width=256 into account when costing sext/zext.

    The check lines marked AVX256 in the zext256/sext256 functions should be closer to the AVX values which would take into account a splitting cost. (detail)
    by ctopper
  1827. [RISCV] Mark unit tests as "requires: riscv-registered-target"

    Some of these tests break if the RISCV backend has not been built.

    Reland D54816. (detail)
    by mgrang
  1828. [X86] Add exhaustive cost model testing for sext/zext for all vector types we reasonably support. Add cost model tests for truncating to vXi1.

    Our sext/zext cost modeling was somewhat incomplete. And had no coverage for the fact that avx512bw v32i16/v64i8 types return a scalarization cost.

    Truncates are a whole different mess because isTruncateFree is returning true for vectors when it shouldn't and that's the fall back for anything not in the tables. (detail)
    by ctopper
  1829. Fix typo in "[clang][ARC] Fix test for commit r347699" (detail)
    by Tatyana Krasnukha
  1830. [OPENMP][NVPTX]Basic support for reductions across the teams.

    Added basic codegen support for the reductions across the teams. (detail)
    by abataev
  1831. [MS] Push outermost class DeclContexts only in -fdelayed-template-parsing

    This is more or less a complete rewrite of r347627, and it fixes PR38460
    I added a reduced test case to DelayedTemplateParsing.cpp. (detail)
    by rnk
  1832. [libcxx] Make sure the re-export logic works when paths contain spaces (detail)
    by Louis Dionne
  1833. [libcxx] Fix libc++ re-exporting logic when Command Line Tools are not installed

    Summary:
    When the Xcode Command Line tools are not installed but CMAKE_OSX_SYSROOT is
    set, we would try to re-export symbols from the libc++abi.dylib shipped in
    the sysroot, which does not exist. This commit changes the build on OS X to
    always re-export symbols from the explicit re-export lists, which doesn't
    change depending on what system you're building on, and is therefore much
    less flaky.

    Reviewers: EricWF, mclow.lists

    Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54595 (detail)
    by Louis Dionne
  1834. [TableGen] Improve readability of generated code (NFC)

    Improve the readability of the generated code for `MCOpcodeSwitchStatement`. (detail)
    by evandro
  1835. [TableGen] Refactor macro names (NFC)

    Make the names for the macros for `TargetInstrInfo` uniform. (detail)
    by evandro
  1836. [clang][ARC] Fix test for commit r347699 (detail)
    by Tatyana Krasnukha
  1837. [yaml2obj] Treat COFF/ARM64 as a 64 bit architecture

    Differential Revision: https://reviews.llvm.org/D54935 (detail)
    by mstorsjo
  1838. [gn build] Add enough build files to be able to build llvm-tblgen.

    Adds build files for:

    - llvm/lib/DebugInfo/CodeView
    - llvm/lib/DebugInfo/MSF
    - llvm/lib/MC
    - llvm/lib/TableGen
    - llvm/utils/TableGen

    All the build files just list sources and deps and are uninteresting.

    Differential Revision: https://reviews.llvm.org/D54931 (detail)
    by nico
  1839. [clang][slh] add attribute for speculative load hardening

    Summary:
    Resubmit this with no changes because I think the build was broken
    by a different diff.
    -----
    The prior diff had to be reverted because there were two tests
    that failed. I updated the two tests in this diff

    clang/test/Misc/pragma-attribute-supported-attributes-list.test
    clang/test/SemaCXX/attr-speculative-load-hardening.cpp

    ----- Summary from Previous Diff (Still Accurate) -----

    LLVM IR already has an attribute for speculative_load_hardening. Before
    this commit, when a user passed the -mspeculative-load-hardening flag to
    Clang, every function would have this attribute added to it. This Clang
    attribute will allow users to opt into SLH on a function by function basis.

    This can be applied to functions and Objective C methods.

    Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54915 (detail)
    by zbrid
  1840. [InstCombine] Add tests for saturating add/sub; NFC

    These are baseline tests for D54534. (detail)
    by nikic
  1841. [clang][ARC] Add ARCTargetInfo

    Based-on-patch-by: Pete Couperus <petecoup@synopsys.com>

    Differential Revision: https://reviews.llvm.org/D53100 (detail)
    by Tatyana Krasnukha
  1842. [X86] Add cost model tests for experimental.vector.reduce.* with -x86-experimental-vector-widening-legalization (detail)
    by ctopper
  1843. [X86] Add cost model test for masked load an store with -x86-experimental-vector-widening-legalization (detail)
    by ctopper
  1844. [X86] Add cost model tests for fp_to_int/int_to_fp with -x86-experimental-vector-widening-legalization (detail)
    by ctopper
  1845. [X86] Add cost model tests for shifts with -x86-experimental-vector-widening-legalization. (detail)
    by ctopper
  1846. Don't speculatively emit VTTs for classes unless we are able to correctly emit references to all the functions they will (directly or indirectly) reference.

    Summary:
    This fixes a miscompile where we'd emit a VTT for a class that ends up
    referencing an inline virtual member function that we can't actually
    emit a body for (because we never instantiated it in the current TU),
    which in a corner case of a corner case can lead to link errors.

    Reviewers: rjmccall

    Subscribers: cfe-commits

    Differential Revision: https://reviews.llvm.org/D54768 (detail)
    by rsmith
  1847. [lit] Pass more environment variables through to child processes.

    This arose when I was trying to have a substitution which invoked a
    python script P, and that python script tried to invoke clang-cl (or
    even cl). Since we invoke P with a custom environment, it doesn't
    inherit the environment of the parent, and then when we go to invoke
    clang-cl, it's unable to find the MSVC installation directory. There
    were many more I could have passed through which are set by vcvarsall,
    but I tried to keep it simple and only pass through the important ones.

    Differential Revision: https://reviews.llvm.org/D54963 (detail)
    by zturner
  1848. Add missing error checking code intended for r347687 (detail)
    by rnk
  1849. Revert "[RISCV] Mark unit tests as "requires: riscv-registered-target""

    This reverts commit 1a6a0c9ea2716378d55858c11adf5941608531f8. (detail)
    by mgrang
  1850. [RISCV] Mark unit tests as "requires: riscv-registered-target"

    Summary: Some of these tests break if the RISCV backend has not been built.

    Reviewers: asb, apazos, sabuasal

    Reviewed By: sabuasal

    Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54816 (detail)
    by mgrang
  1851. [PDB] Add symbol records in bulk

    Summary:
    This speeds up linking clang.exe/pdb with /DEBUG:GHASH by 31%, from
    12.9s to 9.8s.

    Symbol records are typically small (16.7 bytes on average), but we
    processed them one at a time. CVSymbol is a relatively "large" type. It
    wraps an ArrayRef<uint8_t> with a kind an optional 32-bit hash, which we
    don't need. Before this change, each DbiModuleDescriptorBuilder would
    maintain an array of CVSymbols, and would write them individually with a
    BinaryItemStream.

    With this change, we now add symbols that happen to appear contiguously
    in bulk. For each .debug$S section (roughly one per function), we
    allocate two copies, one for relocation, and one for realignment
    purposes. For runs of symbols that go in the module stream, which is
    most symbols, we now add them as a single ArrayRef<uint8_t>, so the
    vector DbiModuleDescriptorBuilder is roughly linear in the number of
    .debug$S sections (O(# funcs)) instead of the number of symbol records
    (very large).

    Some stats on symbol sizes for the curious:
      PDB size: 507M
      sym bytes: 316,508,016
      sym count:  18,954,971
      sym byte avg: 16.7

    As future work, we may be able to skip copying symbol records in the
    linker for realignment purposes if we make LLVM write them aligned into
    the object file. We need to double check that such symbol records are
    still compatible with link.exe, but if so, it's definitely worth doing,
    since my profile shows we spend 500ms in memcpy in the symbol merging
    code. We could potentially cut that in half by saving a copy.
    Alternatively, we could apply the relocations *after* we iterate the
    symbols. This would require some careful re-engineering of the
    relocation processing code, though.

    Reviewers: zturner, aganea, ruiu

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54554 (detail)
    by rnk
  1852. [TableGen] Preprocessing support

    Differential Revision: https://reviews.llvm.org/D54926 (detail)
    by vzakhari
  1853. [ASTImporter] Added Import functions for transition to new API.

    Summary:
    These Import_New functions should be used in the ASTImporter,
    and the old Import functions should not be used. Later the
    Import_New should be renamed to Import again and the old Import
    functions must be removed. But this can happen only after LLDB
    was updated to use the new Import interface.

    This commit is only about introducing the new Import_New
    functions. These are not implemented now, only calling the old
    Import ones.

    Reviewers: shafik, rsmith, a_sidorin, a.sidorin

    Reviewed By: a_sidorin

    Subscribers: spyffe, a_sidorin, gamesh411, shafik, rsmith, dkrupp, martong, Szelethus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53751 (detail)
    by balazske
  1854. [X86] Replace an APInt that is guaranteed to be 8-bits with just an 'unsigned'

    We're already mixing this APInt with other 'unsigned' variables. This allows us to use regular comparison operators instead of needing to use APInt::ult or APInt::uge. And it removes a later conversion from APInt to unsigned.

    I might be adding another combine to this function and this will probably simplify the logic required for that. (detail)
    by ctopper
  1855. [PartialInliner] Make PHIs free in cost computation.

    InlineCost also treats them as free and the current implementation
    can cause assertion failures if PHI nodes are moved outside the region
    from entry BBs to the region.

    It also updates the code to use the instructionsWithoutDebug iterator.

    Reviewers: davidxl, davide, vsk, graham-yiu-huawei

    Reviewed By: davidxl

    Differential Revision: https://reviews.llvm.org/D54748 (detail)
    by fhahn
  1856. [X86] Add -march=cascadelake support in clang.

    This is skylake-avx512 with the addition of avx512vnni ISA.

    Patch by Jianping Chen

    Differential Revision: https://reviews.llvm.org/D54792 (detail)
    by ctopper
  1857. [X86] Add cascade lake arch in X86 target.

    This is skylake-avx512 with the addition of avx512vnni ISA.

    Patch by Jianping Chen

    Differential Revision: https://reviews.llvm.org/D54785 (detail)
    by ctopper
  1858. Documentation: add \file markup as needed.

    This makes Doxygen correctly associate the doc comment with the current
    file rather than adding to the documentation for namespace llvm. (detail)
    by jdennett
  1859. Fix linker option for -fprofile-arcs -ftest-coverage

    Summary:
    Linux toolchain accidentally added "-u__llvm_runtime_variable" when "-fprofile-arcs -ftest-coverage", this is not added when "--coverage" option is used.
    Using "-u__llvm_runtime_variable" generates an empty default.profraw file while an application built with  "-fprofile-arcs -ftest-coverage" is running.

    Reviewers: calixte, marco-c, sylvestre.ledru

    Reviewed By: marco-c

    Subscribers: vsk, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54195 (detail)
    by marco
  1860. Revert "[clang] - Simplify tools::SplitDebugName."

    This reverts commit r347035 as it introduced assertion failures under
    certain conditions. More information can be found here:
    https://reviews.llvm.org/rL347035 (detail)
    by jonastoth
  1861. [clangd] textDocument/SymbolInfo extension

    New method returning symbol info for given source position.

    Differential Revision: https://reviews.llvm.org/D54799

    rdar://problem/46050281 (detail)
    by Jan Korous
  1862. [clangd][NFC] Move SymbolID to a separate file

    Prerequisity for textDocument/SymbolInfo

    Differential Revision: https://reviews.llvm.org/D54799 (detail)
    by Jan Korous
  1863. Implement P1085R2 - Should Span be Regular?. This consists entirely of deletions (detail)
    by marshall
  1864. [clang-tidy] Ignore bool -> single bit bitfield conversion in readability-implicit-bool-conversion

    Summary: There is no ambiguity / information loss in this conversion

    Reviewers: alexfh, aaron.ballman, hokein

    Reviewed By: alexfh

    Subscribers: xazax.hun, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54941 (detail)
    by malcolm.parsons
  1865. [Demangle] remove itaniumFindTypesInMangledName

    Summary:
    This (very specialized) function was added to enable an LLDB use case.
    Now that a more generic interface (overriding of parser functions -
    D52992)  is available, and LLDB has been converted to use that (D54074),
    the function is unused and can be removed.

    Reviewers: erik.pilkington, sgraenitz, rsmith

    Subscribers: mgorny, hiraditya, christof, libcxx-commits, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54893 (detail)
    by labath
  1866. [clangd] Put direct headers into srcs section.

    Summary:
    Currently, there's no way of knowing about header files
    using compilation database, since it doesn't contain header files as entries.

    Using this information, restoring from cache using compile commands becomes
    possible instead of doing directory traversal. Also, we can issue indexing
    actions for out-of-date headers even if source files depending on them haven't
    changed.

    Reviewers: sammccall

    Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54817 (detail)
    by kadircet
  1867. [llvm-mca] pass -dispatch-stats flag to a couple of tests. NFC

    This change is in preparation for a patch that fixes PR36666.

    llvm-mca currently doesn't know if a buffered processor resource describes a
    load or store queue. So, any dynamic dispatch stall caused by the lack of
    load/store queue entries is normally reported as a generic SCHEDULER stall. See for
    example the -dispatch-stats output from the two tests modified by this patch.

    In future, processor models will be able to tag processor resources that are
    used to describe load/store queues. That information would then be used by
    llvm-mca to correctly classify dynamic dispatch stalls caused by the lack of
    tokens in the LS. (detail)
    by adibiagio
  1868. [x86] regenerate checks; NFC (detail)
    by spatel
  1869. [AMDGPU] Disable DAG combine at -O0

    Differential Revision: https://reviews.llvm.org/D54358 (detail)
    by rampitec
  1870. Derive builtin return type from its definition

    Summary:
    Prior to this patch, OpenCL code such as the following would attempt to create
    a BranchInst with a non-bool argument:

        if (enqueue_kernel(get_default_queue(), 0, nd, ^(void){})) /* ... */

    This patch is a follow up on a similar issue with pipe builtin
    operations. See commit r280800 and https://bugs.llvm.org/show_bug.cgi?id=30219.

    This change, while being conservative on non-builtin functions,
    should set the type of expressions invoking builtins to the
    proper type, instead of defaulting to `bool` and requiring
    manual overrides in Sema::CheckBuiltinFunctionCall.

    In addition to tests for enqueue_kernel, the tests are extended to
    check other OpenCL builtins.

    Reviewers: Anastasia, spatel, rsmith

    Reviewed By: Anastasia

    Subscribers: kristina, cfe-commits, svenvh

    Differential Revision: https://reviews.llvm.org/D52879 (detail)
    by mantognini
  1871. Revert r347419 "Update call to EvaluateAsInt() to the new syntax."

    It's pre-requisite was reverted in r347656. (detail)
    by hans
  1872. Revert r347417 "Re-Reinstate 347294 with a fix for the failures."

    This caused a miscompile in Chrome (see crbug.com/908372) that's
    illustrated by this small reduction:

      static bool f(int *a, int *b) {
        return !__builtin_constant_p(b - a) || (!(b - a));
      }

      int arr[] = {1,2,3};

      bool g() {
        return f(arr, arr + 3);
      }

      $ clang -O2 -S -emit-llvm a.cc -o -

    g() should return true, but after r347417 it became false for some reason.

    This also reverts the follow-up commits.

    r347417:
    > Re-Reinstate 347294 with a fix for the failures.
    >
    > Don't try to emit a scalar expression for a non-scalar argument to
    > __builtin_constant_p().
    >
    > Third time's a charm!

    r347446:
    > The result of is.constant() is unsigned.

    r347480:
    > A __builtin_constant_p() returns 0 with a function type.

    r347512:
    > isEvaluatable() implies a constant context.
    >
    > Assume that we're in a constant context if we're asking if the expression can
    > be compiled into a constant initializer. This fixes the issue where a
    > __builtin_constant_p() in a compound literal was diagnosed as not being
    > constant, even though it's always possible to convert the builtin into a
    > constant.

    r347531:
    > A "constexpr" is evaluated in a constant context. Make sure this is reflected
    > if a __builtin_constant_p() is a part of a constexpr. (detail)
    by hans
  1873. [clangd] Prevent thread starvation in tests on loaded systems.

    Summary:
    Background index deliberately runs low-priority, but for tests this may stop
    them making progress.

    Reviewers: kadircet

    Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

    Differential Revision: https://reviews.llvm.org/D54938 (detail)
    by sammccall
  1874. [libclang] Fix clang_Cursor_getNumArguments and clang_Cursor_getArgument for CXXConstructExpr

    Constructors have the same methods for arguments as call expressions.
    Let's provide a way to get their arguments the same way.

    Differential Revision: https://reviews.llvm.org/D54934 (detail)
    by yvvan
  1875. InstCombine: add comment explaining malloc deletion. NFC.

    I tried to change this, not quite realising the logic behind what we
    were doing. Hopefully this comment will help the next person to come
    along. (detail)
    by Tim Northover
  1876. [clang-tidy] Avoid inconsistent notes in readability-container-size-empty

    When a warning is issued in a template instantiation, the check would previously
    use template arguments in a note, which would result in inconsistent or
    duplicate warnings (depending on how deduplication was done). This patch removes
    template arguments from the note. (detail)
    by alexfh
  1877. [clang-tidy] Minor fixes in a test

    Use CHECK-FIXES where it was intended instead of CHECK-MESSAGES. Fixed compiler
    warnings to pacify YouCompleteMe. (detail)
    by alexfh
  1878. [ASTImporter] Typedef import brings in the complete type

    Summary:
    When we already have an incomplete underlying type of a typedef in the
    "To" context, and the "From" context has the same typedef, but the
    underlying type is complete, then the imported type should be complete.

    Fixes an assertion in CTU analysis of Xerces:
    Assertion `DD && "queried property of class with no definition"' failed.
    This assert is happening in the analyzer engine, because that attempts
    to query an underlying type of a typedef, which happens to be
    incomplete.

    Reviewers: a_sidorin, a.sidorin

    Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

    Differential Revision: https://reviews.llvm.org/D53693 (detail)
    by martong
  1879. [CMake] Add a missing case of TO_CMAKE_PATH

    This fixes building sanitizers for mingw natively. (detail)
    by mstorsjo
  1880. Add missing REQUIRES: asserts (detail)
    by mkazantsev
  1881. [X86] Add test cases for vector shifts of v2i32/v2i16/v4i16/v2i8/v4i8/v8i8 with promotion legalization and widening legalization. NFC (detail)
    by ctopper
  1882. [X86] Use getUnpackl/getUnpackh instead of directly creating UNPCKL/UNPCKH nodes. (detail)
    by ctopper
  1883. [LoopSimplifyCFG] Turn on term folding after underlying bug fixed (detail)
    by mkazantsev
  1884. [LoopSimplifyCFG] Fix corner case with duplicating successors

    It fixes a bug that doesn't update Phi inputs of the only live successor that
    is in the list of block's successors more than once.

    Thanks @uabelho for finding this.

    Differential Revision: https://reviews.llvm.org/D54849
    Reviewed By: anna (detail)
    by mkazantsev
  1885. [gn build] Merge r347530 to gn. (detail)
    by nico
  1886. Move a file I forgot to move in r347636. (detail)
    by nico
  1887. [gn build] Create abi-breaking.h, config.h, llvm-config.h, and add a build file for llvm/lib/Support.

    The comments at the top of
    llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn and
    llvm/utils/gn/build/write_cmake_config.py should explain the main bits
    happening in this patch. The main parts here are that these headers are
    generated at build time, not gn time, and that currently they don't do any
    actual feature checks but just hardcode most things based on the current OS,
    which seems to work well enough. If this stops being enough, the feature checks
    should each be their own action writing the result to somewhere, and the config
    write step should depend on those checks (so that they can run in parallel and
    as part of the build) -- utils/llvm/gn/README.rst already has some more words
    on that in "Philosophy".

    (write_cmake_config.py is also going to be used to write clang's
    clang/include/clang/Config/config.h)

    This also adds a few files for linking to system libraries in a consistent way
    if needed in llvm/utils/gn/build/libs (and moves pthread to that model).0

    I'm also adding llvm/utils/gn/secondary/llvm/lib/Target/targets.gni in this
    patch because $native_arch is needed for writing llvm-config.h -- the rest of
    it will be used later, when the build files for llvm/lib/Target get added. That
    file describes how to select which archs to build.

    As a demo, also add a build file for llvm-undname and make it the default build
    target (it depends on everything that can currently be built).

    Differential Revision: https://reviews.llvm.org/D54678 (detail)
    by nico
  1888. [clangd] NFC: Prefer `isa<>` to `dyn_cast<>` to do the checking.

    Summary: Prefer `isa<>` to `dyn_cast<>` when there only need a checking.

    Reviewers: ilya-biryukov, MaskRay

    Reviewed By: ilya-biryukov, MaskRay

    Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits, MTC

    Differential Revision: https://reviews.llvm.org/D54878 (detail)
    by henrywong
  1889. [docs] UBSan and ASan are supported on Windows

    Also fix a bullet list.

    Fixes PR39775 (detail)
    by rnk
  1890. [X86] Prevent DAG combine from folding a bitcast from vXi1 to iX with a store on pre-AVX512 targets.

    If we fold the bitcast into the store we'll end up creating a truncating store to vXi1 that will get scalarized. Instead allow the bitcast to be turned into a movmsk.

    We probably need to do something if the store itself is a vXi1 type, but I'll leave that til a testcase appears. (detail)
    by ctopper
  1891. [X86] Add a bunch of test cases for storing a scalar bitcasted from a vXi1 type.

    Currently a store combine will absorb the bitcast before our combine that turns bitcasts into movmsk gets a chance to run. This results in a store being created with a vXi1 type. Type legalization then promotes the input type and makes this a truncating store. Then we badly scalarize this store.

    Currently we avoid this on v8i1->i8 bitcasts due to an incompletely qualified(per the original intention) check in isLoadBitCastBeneficial. An easy fix is to disable this for all vXi1->iX bitcasts on pre-avx512 targets. We'll still generate terrible code if the IR explicitly contains a store of vXi1 without a bitcast. We could probably solve that by just turning all stores of vXi1 into (store (iX (bitcast))) as an early DAG combine. (detail)
    by ctopper
  1892. Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"

    It broke the Windows self-host:
    http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio

    I can build
    lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to
    repro. (detail)
    by rnk
  1893. [analyzer][PlistMacroExpansion] Part 3.: Macro arguments are expanded

    This part focuses on expanding macro arguments.

    Differential Revision: https://reviews.llvm.org/D52795 (detail)
    by szelethus
  1894. Revert "[clang][slh] add attribute for speculative load hardening"

    until I figure out why the build is failing or timing out

    ***************************

    Summary:
    The prior diff had to be reverted because there were two tests
    that failed. I updated the two tests in this diff

    clang/test/Misc/pragma-attribute-supported-attributes-list.test
    clang/test/SemaCXX/attr-speculative-load-hardening.cpp

    LLVM IR already has an attribute for speculative_load_hardening. Before
    this commit, when a user passed the -mspeculative-load-hardening flag to
    Clang, every function would have this attribute added to it. This Clang
    attribute will allow users to opt into SLH on a function by function
    basis.

    This can be applied to functions and Objective C methods.

    Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54915

    This reverts commit a5b3c232d1e3613f23efbc3960f8e23ea70f2a79.
    (r347617) (detail)
    by zbrid
  1895. [MS] Push fewer DeclContexts for delayed template parsing

    Only push the outermost record as a DeclContext when parsing a function
    body. See the comments in Sema::getContainingDC about the way the parser
    pushes contexts. This is intended to match the behavior the parser
    normally displays where it parses all method bodies from all nested
    classes at the end of the outermost class, when all nested classes are
    complete.

    Fixes PR38460. (detail)
    by rnk
  1896. [stack-safety] Update comment (detail)
    by Vitaly Buka
  1897. [stack-safety] Fix and uncomment assert (detail)
    by Vitaly Buka
  1898. [stack-safety] Fix build on gcc 5.4 (detail)
    by Vitaly Buka
  1899. Fix filtering of sanitizer_common unittest architectures on Darwin. (detail)
    by kuba.brecka
  1900. [InstCombine] add tests for rotate/bswap equality; NFC (detail)
    by spatel
  1901. [clang][slh] add attribute for speculative load hardening

    Summary:
    The prior diff had to be reverted because there were two tests
    that failed. I updated the two tests in this diff

    clang/test/Misc/pragma-attribute-supported-attributes-list.test
    clang/test/SemaCXX/attr-speculative-load-hardening.cpp

    ----- Summary from Previous Diff (Still Accurate) -----

    LLVM IR already has an attribute for speculative_load_hardening. Before
    this commit, when a user passed the -mspeculative-load-hardening flag to
    Clang, every function would have this attribute added to it. This Clang
    attribute will allow users to opt into SLH on a function by function basis.

    This can be applied to functions and Objective C methods.

    Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54915 (detail)
    by zbrid
  1902. Fix debug build break

    Comment out an assertion from D54543 which failed with error: no member named 'Range' in '(anonymous namespace)::PassAsArgInfo'. (detail)
    by jfb
  1903. Notify the linker when a TU compiled with split-stack has a function without a prologue.

    More context here: https://go-review.googlesource.com/c/go/+/148819/ (detail)
    by saugustine
  1904. Remove trailing empty line (detail)
    by Vitaly Buka
  1905. [stack-safety] Analysis documentation

    Summary:
    Basic documentation of the Stack Safety Analysis.
    It will be improved during review and upstream of an implementation.

    Reviewers: kcc, eugenis, vlad.tsyrklevich, glider

    Reviewed By: vlad.tsyrklevich

    Subscribers: arphaman, llvm-commits

    Differential Revision: https://reviews.llvm.org/D53336 (detail)
    by Vitaly Buka
  1906. [stack-safety] Inter-Procedural Analysis implementation

    Summary:
    IPA is implemented as module pass which produce map from Function or Alias to
    StackSafetyInfo for a single function.

    From prototype by Evgenii Stepanov and Vlad Tsyrklevich.

    Reviewers: eugenis, vlad.tsyrklevich, pcc, glider

    Subscribers: hiraditya, mgrang, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54543 (detail)
    by Vitaly Buka
  1907. [stack-safety] Empty local passes for Stack Safety Global Analysis

    Reviewers: eugenis, vlad.tsyrklevich

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54541 (detail)
    by Vitaly Buka
  1908. AArch64ISelLowering: Remove a return-of-assignment to allow NRVO

    Patch by Arthur O'Dwyer! (detail)
    by dblaikie
  1909. Remove duplicate _LIBCPP_INLINE_VISIBILITY attributes.

    This attribute should appear only on the first declaration. This
    patch cleans up <string> by removing the attribute on redeclarations. (detail)
    by ericwf
  1910. Add new passes to X86 pipeline tests

    Summary: Fixes test failures introduced by rL347596.

    Reviewers: davidxl

    Reviewed By: davidxl

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54916 (detail)
    by mtrofin
  1911. [X86] Add dependency from X86 to ProfileData after rL347596 (detail)
    by maskray
  1912. [ICP] Remove incompatible attributes at indirect-call promoted callsites.

    Summary:
    Removing ncompatible attributes at indirect-call promoted callsites, not removing it results in
    at least a IR verification error.

    Reviewers: davidxl, xur, mssimpso

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D54913 (detail)
    by trentxintong
  1913. [InstCombine] add helper function to reduce code duplication; NFC (detail)
    by spatel
  1914. [stack-safety] Local analysis implementation

    Summary:
    Analysis produces StackSafetyInfo which contains information with how allocas
    and parameters were used in functions.

    From prototype by Evgenii Stepanov and  Vlad Tsyrklevich.

    Reviewers: eugenis, vlad.tsyrklevich, pcc, glider

    Subscribers: hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54504 (detail)
    by Vitaly Buka
  1915. [stack-safety] Empty local passes for Stack Safety Local Analysis

    Reviewers: eugenis, vlad.tsyrklevich

    Subscribers: mgorny, hiraditya, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54502 (detail)
    by Vitaly Buka
  1916. [cfi] Help sanstats to find binary if they are not at the original location

    Summary:
    By default sanstats search binaries at the same location where they were when
    stats was collected. Sometime you can not print report immediately or you need
    to move post-processing to another workstation. To support this use-case when
    original binary is missing sanstats will fall-back to directory with sanstats
    file.

    Reviewers: pcc

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D53857 (detail)
    by Vitaly Buka
  1917. [cfi] Make sanstats print address of the check

    Summary: Help with off-line symbolization or other type debugging.

    Reviewers: pcc

    Subscribers: llvm-commits

    Differential Revision: https://reviews.llvm.org/D53606 (detail)
    by Vitaly Buka
  1918. [AArch64] Refactor the scheduling predicates (3/3) (NFC)

    Refactor the scheduling predicates based on `MCInstPredicate`.  In this
    case, `AArch64InstrInfo::hasExtendedReg()`.

    Differential revision: https://reviews.llvm.org/D54822 (detail)
    by evandro
  1919. [AArch64] Refactor the scheduling predicates (2/3) (NFC)

    Refactor the scheduling predicates based on `MCInstPredicate`.  In this
    case, `AArch64InstrInfo::hasShiftedReg()`.

    Differential revision: https://reviews.llvm.org/D54820 (detail)
    by evandro
  1920. [AArch64] Refactor the scheduling predicates (1/3) (NFC)

    Refactor the scheduling predicates based on `MCInstPredicate`.  In this
    case, `AArch64InstrInfo::isScaledAddr()`

    Differential revision: https://reviews.llvm.org/D54777 (detail)
    by evandro
  1921. Support for inserting profile-directed cache prefetches

    Summary:
    Support for profile-driven cache prefetching (X86)

    This change is part of a larger system, consisting of a cache prefetches recommender, create_llvm_prof (https://github.com/google/autofdo), and LLVM.

    A proof of concept recommender is DynamoRIO's cache miss analyzer. It processes memory access traces obtained from a running binary and identifies patterns in cache misses. Based on them, it produces a csv file with recommendations. The expectation is that, by leveraging such recommendations, we can reduce the amount of clock cycles spent waiting for data from memory. A microbenchmark based on the DynamoRIO analyzer is available as a proof of concept: https://goo.gl/6TM2Xp.

    The recommender makes prefetch recommendations in terms of:

    * the binary offset of an instruction with a memory operand;
    * a delta;
    * and a type (nta, t0, t1, t2)

    meaning: a prefetch of that type should be inserted right before the instrution at that binary offset, and the prefetch should be for an address delta away from the memory address the instruction will access.

    For example:

    0x400ab2,64,nta

    and assuming the instruction at 0x400ab2 is:

    movzbl (%rbx,%rdx,1),%edx

    means that the recommender determined it would be beneficial for a prefetchnta instruction to be inserted right before this instruction, as such:

    prefetchnta 0x40(%rbx,%rdx,1)
    movzbl (%rbx, %rdx, 1), %edx

    The workflow for prefetch cache instrumentation is as follows (the proof of concept script details these steps as well):

    1. build binary, making sure -gmlt -fdebug-info-for-profiling is passed. The latter option will enable the X86DiscriminateMemOps pass, which ensures instructions with memory operands are uniquely identifiable (this causes ~2% size increase in total binary size due to the additional debug information).

    2. collect memory traces, run analysis to obtain recommendations (see above-referenced DynamoRIO demo as a proof of concept).

    3. use create_llvm_prof to convert recommendations to reference insertion locations in terms of debug info locations.

    4. rebuild binary, using the exact same set of arguments used initially, to which -mllvm -prefetch-hints-file=<file> needs to be added, using the afdo file obtained at step 3.

    Note that if sample profiling feedback-driven optimization is also desired, that happens before step 1 above. In this case, the sample profile afdo file that was used to produce the binary at step 1 must also be included in step 4.

    The data needed by the compiler in order to identify prefetch insertion points is very similar to what is needed for sample profiles. For this reason, and given that the overall approach (memory tracing-based cache recommendation mechanisms) is under active development, we use the afdo format as a syntax for capturing this information. We avoid confusing semantics with sample profile afdo data by feeding the two types of information to the compiler through separate files and compiler flags. Should the approach prove successful, we can investigate improvements to this encoding mechanism.

    Reviewers: davidxl, wmi, craig.topper

    Reviewed By: davidxl, wmi, craig.topper

    Subscribers: davide, danielcdh, mgorny, aprantl, eraman, JDevlieghere, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54052 (detail)
    by mtrofin
  1922. AMDGPU: Record SGPR spills when restoring too

    It's possible in some cases to have a restore present
    without a corresponding spill. Due to an apparent bug
    in D54366 <https://reviews.llvm.org/D54366>, only the
    restore for a register was emitted. It's probably
    always a bug for this to happen, but due to how SGPR
    spilling is implemented, this makes the issues appear
    worse than it is. (detail)
    by arsenm
  1923. [LegalizeVectorTypes][X86][ARM][AArch64][PowerPC] Don't use SplitVecOp_TruncateHelper for FP_TO_SINT/UINT.

    SplitVecOp_TruncateHelper tries to promote the result type while splitting FP_TO_SINT/UINT. It then concatenates the result and introduces a truncate to the original result type. But it does this without inserting the AssertZExt/AssertSExt that the regular result type promotion would insert. Nor does it turn FP_TO_UINT into FP_TO_SINT the way normal result type promotion for these operations does. This is bad on X86 which doesn't support FP_TO_SINT until AVX512.

    This patch disables the use of SplitVecOp_TruncateHelper for these operations and just lets normal promotion handle it. I've tweaked a couple things in X86ISelLowering to avoid a few obvious regressions there. I believe all the changes on X86 are improvements. The other targets look neutral.

    Differential Revision: https://reviews.llvm.org/D54906 (detail)
    by ctopper
  1924. [ThinLTO] Consolidate cache key computation between new/old LTO APIs

    Summary:
    The old legacy LTO API had a separate cache key computation, which was
    a subset of the cache key computation in the new LTO API (from what I
    can tell this is largely just because certain features such as CFI,
    dsoLocal, etc are only utilized via the new LTO API). However, having
    separate computations is unnecessary (much of the code is duplicated),
    and can lead to bugs when adding new optimizations if both cache
    computation algorithms aren't updated properly - it's much easier to
    maintain if we have a single facility.

    This patch refactors the old LTO API code to use the cache key
    computation from the new LTO API. To do this, we set up an lto::Config
    object and fill in the fields that the old LTO was hashing (the others
    will just use the defaults).

    There are two notable changes:
    - I added a Freestanding flag to the LTO Config. Currently this is only
    used by the legacy LTO API. In the patch that added it (D30791) I had
    asked about adding it to the new LTO API, but it looks like that was not
    addressed. This should probably be discussed as a follow up to this
    change, as it is orthogonal.
    - The legacy LTO API had some code that was hashing the GUID of all
    preserved symbols defined in the module. I looked back at the history of
    this (which was added with the original hashing in the legacy LTO API in
    D18494), and there is a comment in the review thread that it was added
    in preparation for future internalization. We now do the internalization
    of course, and that is handled in the new LTO API cache key computation
    by hashing the recorded linkage type of all defined globals. Therefore I
    didn't try to move over and keep the preserved symbols handling.

    Reviewers: steven_wu, pcc

    Subscribers: mehdi_amini, inglorion, eraman, dexonsmith, dang, llvm-commits

    Differential Revision: https://reviews.llvm.org/D54635 (detail)
    by tejohnson
  1925. [SelectionDAG] Teach BaseIndexOffset::match to unwrap the base after looking through an add/or

    We might find a target specific node that needs to be unwrapped after we look through an add/or. Otherwise we get inconsistent results if one pointer is just X86WrapperRIP and the other is (add X86WrapperRIP, C)

    Differential Revision: https://reviews.llvm.org/D54818 (detail)
    by ctopper
  1926. [X86] Add test case for D54818 (detail)
    by ctopper
  1927. Add basic_string::__resize_default_init (from P1072)

    This patch adds an implementation of __resize_default_init as
    described in P1072R2. Additionally, it uses it in filesystem to
    demonstrate its intended utility.

    Once P1072 lands, or if it changes it's interface, I will adjust
    the internal libc++ implementation to match. (detail)
    by ericwf
  1928. Revert "[clang][slh] add attribute for speculative load hardening"

    This reverts commit 801eaf91221ba6dd6996b29ff82659ad6359e885. (