1. Dec 10, 2020
    • Scott Linder's avatar
      [AMDGPU][MC] Restore old error position for "too few operands" · f5f4b8b6
      Scott Linder authored
      Revert part of https://reviews.llvm.org/D92084 to make it simpler to
      start consuming the EndOfStatement token within AMDGPU's
      ParseInstruction in a future patch. This also brings us back to what
      every other target currently does.
      
      A future change to move the position back to the end of the statement
      would likely need to audit all of the AMDGPUOperand SMLoc ranges, and
      determine the SMLoc for the last character of the last operand.
      
      Reviewed By: dp
      
      Differential Revision: https://reviews.llvm.org/D92960
      f5f4b8b6
    • Matt Morehouse's avatar
      [DFSan] Add custom wrapper for recvmsg. · a3eb2fb2
      Matt Morehouse authored
      The wrapper clears shadow for anything written by recvmsg.
      
      Reviewed By: stephan.yichao.zhao
      
      Differential Revision: https://reviews.llvm.org/D92949
      a3eb2fb2
    • Sam Clegg's avatar
      [WebAssembly] Add support for named data sections in wasm binaries · 9a72d3e3
      Sam Clegg authored
      Followup to https://reviews.llvm.org/D91769 which added support
      for names globals.
      
      Differential Revision: https://reviews.llvm.org/D92909
      9a72d3e3
    • Mircea Trofin's avatar
      55ea639d
    • Kirill Bobyrev's avatar
      [clangd] NFC: Add client-side logging for remote index requests · 5a1bc69f
      Kirill Bobyrev authored
      Figuring out whether the server is responding and debugging issues with remote
      index setup is no easy task: add verbose logging for client side RPC requests
      to relieve some pain.
      
      Reviewed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D92181
      5a1bc69f
    • Sergei Grechanik's avatar
      [mlir][Affine] Fix vectorizability check for multiple load/stores · 2d3b9fdc
      Sergei Grechanik authored
      This patch fixes a bug that allowed vectorizing of loops with loads and
      stores having indexing functions varying along different memory
      dimensions.
      
      Reviewed By: aartbik, dcaballe
      
      Differential Revision: https://reviews.llvm.org/D92702
      2d3b9fdc
    • Peyton, Jonathan L's avatar
      [OpenMP] Fix norespect affinity bug for Windows · fe3b244e
      Peyton, Jonathan L authored
      KMP_AFFINITY=norespect was triggering an error because the underlying
      process affinity mask was not updated to include the entire machine.
      The Windows documentation states that the thread affinities must be
      subsets of the process affinity. This patch also moves the printing
      (for KMP_AFFINITY=verbose) of whether the initial mask was respected
      out of each topology detection function and to one location where the
      initial affinity mask is read.
      
      Differential Revision: https://reviews.llvm.org/D92587
      fe3b244e
    • Peyton, Jonathan L's avatar
      [OpenMP] Fix too long name for shm segment on macOS · 9b7d6a6b
      Peyton, Jonathan L authored
      Remove the user id component to the shm segment name and just use
      the pid like before.
      
      Differential Revision: https://reviews.llvm.org/D92660
      9b7d6a6b
    • Gabor Marton's avatar
      [ASTImporter] Support CXXDeductionGuideDecl with local typedef · a5e6590b
      Gabor Marton authored
      CXXDeductionGuideDecl with a local typedef has its own copy of the
      TypedefDecl with the CXXDeductionGuideDecl as the DeclContext of that
      TypedefDecl.
      ```
            template <typename T> struct A {
              typedef T U;
              A(U, T);
            };
            A a{(int)0, (int)0};
      ```
      Related discussion on cfe-dev:
      http://lists.llvm.org/pipermail/cfe-dev/2020-November/067252.html
      
      Without this fix, when we import the CXXDeductionGuideDecl (via
      VisitFunctionDecl) then before creating the Decl we must import the
      FunctionType. However, the first parameter's type is the afore mentioned
      local typedef. So, we then start importing the TypedefDecl whose
      DeclContext is the CXXDeductionGuideDecl itself. The infinite loop is
      formed.
      ```
       #0 clang::ASTNodeImporter::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl*) clang/lib/AST/ASTImporter.cpp:3543:0
       #1 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/DeclNodes.inc:405:0
       #2 clang::ASTImporter::ImportImpl(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8038:0
       #3 clang::ASTImporter::Import(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8200:0
       #4 clang::ASTImporter::ImportContext(clang::DeclContext*) clang/lib/AST/ASTImporter.cpp:8297:0
       #5 clang::ASTNodeImporter::ImportDeclContext(clang::Decl*, clang::DeclContext*&, clang::DeclContext*&) clang/lib/AST/ASTImporter.cpp:1852:0
       #6 clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&) clang/lib/AST/ASTImporter.cpp:1628:0
       #7 clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) clang/lib/AST/ASTImporter.cpp:2419:0
       #8 clang::ASTNodeImporter::VisitTypedefDecl(clang::TypedefDecl*) clang/lib/AST/ASTImporter.cpp:2500:0
       #9 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/DeclNodes.inc:315:0
       #10 clang::ASTImporter::ImportImpl(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8038:0
       #11 clang::ASTImporter::Import(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8200:0
       #12 llvm::Expected<clang::TypedefNameDecl*> clang::ASTNodeImporter::import<clang::TypedefNameDecl>(clang::TypedefNameDecl*) clang/lib/AST/ASTImporter.cpp:165:0
       #13 clang::ASTNodeImporter::VisitTypedefType(clang::TypedefType const*) clang/lib/AST/ASTImporter.cpp:1304:0
       #14 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:74:0
       #15 clang::ASTImporter::Import(clang::QualType) clang/lib/AST/ASTImporter.cpp:8071:0
       #16 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) clang/lib/AST/ASTImporter.cpp:179:0
       #17 clang::ASTNodeImporter::VisitFunctionProtoType(clang::FunctionProtoType const*) clang/lib/AST/ASTImporter.cpp:1244:0
       #18 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:47:0
       #19 clang::ASTImporter::Import(clang::QualType) clang/lib/AST/ASTImporter.cpp:8071:0
       #20 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) clang/lib/AST/ASTImporter.cpp:179:0
       #21 clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&) clang/lib/AST/ASTImporter.cpp:198:0
       #22 clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) clang/lib/AST/ASTImporter.cpp:3313:0
       #23 clang::ASTNodeImporter::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl*) clang/lib/AST/ASTImporter.cpp:3543:0
      ```
      
      The fix is to first create the TypedefDecl and only then start to import
      the DeclContext.
      Basically, we could do this during the import of all other Decls (not
      just for typedefs). But it seems, there is only one another AST
      construct that has a similar cycle: a struct defined as a function
      parameter:
      ```
      int struct_in_proto(struct data_t{int a;int b;} *d);
      
      ```
      In that case, however, we had decided to return simply with an error
      back then because that seemed to be a very rare construct.
      
      Differential Revision: https://reviews.llvm.org/D92209
      a5e6590b
    • Richard Smith's avatar
      Add another test for PR48434. · 4ae8651c
      Richard Smith authored
      4ae8651c
    • Richard Smith's avatar
      Add new 'preferred_name' attribute. · 2a2c228c
      Richard Smith authored
      This attribute permits a typedef to be associated with a class template
      specialization as a preferred way of naming that class template
      specialization. This permits us to specify that (for example) the
      preferred way to express 'std::basic_string<char>' is as 'std::string'.
      
      The attribute is applied to the various class templates in libc++ that have
      corresponding well-known typedef names.
      
      This is a re-commit. The previous commit was reverted because it exposed
      a pre-existing bug that has since been fixed / worked around; see
      PR48434.
      
      Differential Revision: https://reviews.llvm.org/D91311
      2a2c228c
    • Richard Smith's avatar
      PR48434: Work around crashes due to deserialization cycles via typedefs. · 997a719d
      Richard Smith authored
      Ensure that we can deserialize a TypedefType even while in the middle of
      deserializing its TypedefDecl, by removing the need to look at the
      TypedefDecl while constructing the TypedefType.
      
      This fixes all the currently-known failures for PR48434, but it's not a
      complete fix, because we can still trigger deserialization cycles, which
      are not supposed to happen.
      997a719d
    • Fangrui Song's avatar
    • Duncan P. N. Exon Smith's avatar
      Frontend: Migrate to FileEntryRef in VerifyDiagnosticConsumer.cpp, NFC · 82789228
      Duncan P. N. Exon Smith authored
      Add a `FileEntryRef` overload of `SourceManager::translateFile`, and
      migrate `ParseDirective` in VerifyDiagnosticConsumer.cpp to use it and
      the corresponding overload of `createFileID`.
      
      No functionality change here.
      
      Differential Revision: https://reviews.llvm.org/D92699
      82789228
    • Peter Collingbourne's avatar
      scudo: Fix quarantine allocation when MTE enabled. · e5a28e12
      Peter Collingbourne authored
      Quarantines have always been broken when MTE is enabled because the
      quarantine batch allocator fails to reset tags that may have been
      left behind by a user allocation.
      
      This was only noticed when running the Scudo unit tests with Scudo
      as the system allocator because quarantines are turned off by
      default on Android and the test binary turns them on by defining
      __scudo_default_options, which affects the system allocator as well.
      
      Differential Revision: https://reviews.llvm.org/D92881
      e5a28e12
    • Peter Collingbourne's avatar
      scudo: Split setRandomTag in two. NFCI. · 9f8aeb06
      Peter Collingbourne authored
      Separate the IRG part from the STZG part since we will need to use
      the latter on its own for some upcoming changes.
      
      Differential Revision: https://reviews.llvm.org/D92880
      9f8aeb06
    • Florian Hahn's avatar
      [AArch64] Add aarch64_neon_vcmla{_rot{90,180,270}} intrinsics. · 77fd12a6
      Florian Hahn authored
      Add builtins required to implement vcmla and rotated variants from
      the ACLE
      
      Reviewed By: t.p.northover
      
      Differential Revision: https://reviews.llvm.org/D92929
      77fd12a6
    • Jon Chesterfield's avatar
      7c596143
    • Michael Munday's avatar
      [RISCV][NFC] Regenerate RISCV CodeGen tests · e28b6a60
      Michael Munday authored
      Regenerated using:
      
      ./llvm/utils/update_llc_test_checks.py -u llvm/test/CodeGen/RISCV/*.ll
      
      This has added comments to spill-related instructions and added @plt to
      some symbols.
      
      Differential Revision: https://reviews.llvm.org/D92841
      e28b6a60
    • Jianzhou Zhao's avatar
      [dfsan] Track field/index-level shadow values in variables · ea981165
      Jianzhou Zhao authored
      *************
      * The problem
      *************
      See motivation examples in compiler-rt/test/dfsan/pair.cpp. The current
      DFSan always uses a 16bit shadow value for a variable with any type by
      combining all shadow values of all bytes of the variable. So it cannot
      distinguish two fields of a struct: each field's shadow value equals the
      combined shadow value of all fields. This introduces an overtaint issue.
      
      Consider a parsing function
      
         std::pair<char*, int> get_token(char* p);
      
      where p points to a buffer to parse, the returned pair includes the next
      token and the pointer to the position in the buffer after the token.
      
      If the token is tainted, then both the returned pointer and int ar
      tainted. If the parser keeps on using get_token for the rest parsing,
      all the following outputs are tainted because of the tainted pointer.
      
      The CL is the first change to address the issue.
      
      **************************
      * The proposed improvement
      **************************
      Eventually all fields and indices have their own shadow values in
      variables and memory.
      
      For example, variables with type {i1, i3}, [2 x i1], {[2 x i4], i8},
      [2 x {i1, i1}] have shadow values with type {i16, i16}, [2 x i16],
      {[2 x i16], i16}, [2 x {i16, i16}] correspondingly; variables with
      primary type still have shadow values i16.
      
      ***************************
      * An potential implementation plan
      ***************************
      
      The idea is to adopt the change incrementially.
      
      1) This CL
      Support field-level accuracy at variables/args/ret in TLS mode,
      load/store/alloca still use combined shadow values.
      
      After the alloca promotion and SSA construction phases (>=-O1), we
      assume alloca and memory operations are reduced. So if struct
      variables do not relate to memory, their tracking is accurate at
      field level.
      
      2) Support field-level accuracy at alloca
      3) Support field-level accuracy at load/store
      
      These two should make O0 and real memory access work.
      
      4) Support vector if necessary.
      5) Support Args mode if necessary.
      6) Support passing more accurate shadow values via custom functions if
      necessary.
      
      ***************
      * About this CL.
      ***************
      The CL did the following
      
      1) extended TLS arg/ret to work with aggregate types. This is similar
      to what MSan does.
      
      2) implemented how to map between an original type/value/zero-const to
      its shadow type/value/zero-const.
      
      3) extended (insert|extract)value to use field/index-level progagation.
      
      4) for other instructions, propagation rules are combining inputs by or.
      The CL converts between aggragate and primary shadow values at the
      cases.
      
      5) Custom function interfaces also need such a conversion because
      all existing custom functions use i16. It is unclear whether custome
      functions need more accurate shadow propagation yet.
      
      6) Added test cases for aggregate type related cases.
      
      Reviewed-by: morehouse
      
      Differential Revision: https://reviews.llvm.org/D92261
      ea981165
    • Jon Chesterfield's avatar
    • Jon Chesterfield's avatar
    • Reid Kleckner's avatar
      Don't setup inalloca for swiftcc on i686-windows-msvc · df282215
      Reid Kleckner authored
      Swiftcall does it's own target-independent argument type classification,
      since it is not designed to be ABI compatible with anything local on the
      target that isn't LLVM-based. This means it never uses inalloca.
      However, we have duplicate logic for checking for inalloca parameters
      that runs before call argument setup. This logic needs to know ahead of
      time if inalloca will be used later, and we can't move the
      CGFunctionInfo calculation earlier.
      
      This change gets the calling convention from either the
      FunctionProtoType or ObjCMethodDecl, checks if it is swift, and if so
      skips the stackbase setup.
      
      Depends on D92883.
      
      Differential Revision: https://reviews.llvm.org/D92944
      df282215
    • Reid Kleckner's avatar
      De-templatify EmitCallArgs argument type checking, NFCI · d7098ff2
      Reid Kleckner authored
      This template exists to abstract over FunctionPrototype and
      ObjCMethodDecl, which have similar APIs for storing parameter types. In
      place of a template, use a PointerUnion with two cases to handle this.
      Hopefully this improves readability, since the type of the prototype is
      easier to discover. This allows me to sink this code, which is mostly
      assertions, out of the header file and into the cpp file. I can also
      simplify the overloaded methods for computing isGenericMethod, and get
      rid of the second EmitCallArgs overload.
      
      Differential Revision: https://reviews.llvm.org/D92883
      d7098ff2
    • Raphael Isemann's avatar
      [lldb][NFC] Refactor _get_bool_config_skip_if_decorator · 199ec40e
      Raphael Isemann authored
      NFC preparation for another patch. Also add some documentation for why the
      error value is true (and not false).
      199ec40e
    • Jon Chesterfield's avatar
    • Justin Bogner's avatar
      Limit the recursion depth of SelectionDAG::isSplatValue() · e6a1187d
      Justin Bogner authored
      This method previously always recursively checked both the left-hand
      side and right-hand side of binary operations for splatted (broadcast)
      vector values to determine if the parent DAG node is a splat.
      
      Like several other SelectionDAG methods, limit the recursion depth to
      MaxRecursionDepth (6). This prevents stack overflow.
      See also https://issuetracker.google.com/173785481
      
      Patch by Nicolas Capens. Thanks!
      
      Differential Revision: https://reviews.llvm.org/D92421
      e6a1187d
    • Alexey Bader's avatar
      [MCJIT] Add cmake variables to customize ittapi git location and revision. · be9b4bbd
      Alexey Bader authored
      To support llorg builds this patch provides the following changes:
      
      1)  Added cmake variable ITTAPI_GIT_REPOSITORY to control the location of ITTAPI repository.
           Default value of ITTAPI_GIT_REPOSITORY is github location: https://github.com/intel/ittapi.git
           Also, the separate cmake variable ITTAPI_GIT_TAG was added for repo tag.
      2)  Added cmake variable ITTAPI_SOURCE_DIR to control the place where the repo will be cloned.
           Default value of ITTAPI_SOURCE_DIR is build area: PROJECT_BINARY_DIR
      
      Reviewed By: etyurin, bader
      
      Patch by ekovanov.
      
      Differential Revision: https://reviews.llvm.org/D91935
      be9b4bbd
    • Arthur Eubanks's avatar
      Reland Pin -loop-reduce to legacy PM · 664b1871
      Arthur Eubanks authored
      This was accidentally reverted by a later change.
      
      LSR currently only runs in the codegen pass manager.
      There are a couple issues with LSR and the NPM.
      1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
      bunch of tests' expected output. This is fixable with some time put in.
      2) LSR doesn't preserve LCSSA. See
      llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
      SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
      off. Turning it on causes some code sinking out of loops to fail due to
      SCEVExpander's inability to handle the newly created trivial PHI nodes in the
      broken critical edge (I was looking at
      llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll).
      I also tried simply just calling formLCSSA() at the end of LSR, but the extra
      PHI nodes cause regressions in codegen tests.
      
      We'll delay figuring these issues out until later.
      
      This causes the number of check-llvm failures with -enable-new-pm true
      by default to go from 60 to 29.
      
      Reviewed By: asbirlea
      
      Differential Revision: https://reviews.llvm.org/D92796
      664b1871
    • Fangrui Song's avatar
      [CMake] Add llvm-profgen to LLVM_TEST_DEPENDS · b4cbb87f
      Fangrui Song authored
      Otherwise `check-llvm-*` may not rebuild llvm-profgen, causing llvm-profgen tests
      to fail if llvm-profgen happens to be stale.
      b4cbb87f
    • Jonas Devlieghere's avatar
      [lldb] Track the API boundary using a thread_local variable. · 5861234e
      Jonas Devlieghere authored
      The reproducers currently use a static variable to track the API
      boundary. This is obviously incorrect when the SB API is used
      concurrently. While I do not plan to support that use-case (right now),
      I do want to avoid us crashing. As a first step, correctly track API
      boundaries across multiple threads.
      
      Before this patch SB API calls made by the embedded script interpreter
      would be considered "behind the API boundary" and correctly ignored.
      After this patch, we need to tell the reproducers to ignore the
      scripting thread as a "private thread".
      
      Differential revision: https://reviews.llvm.org/D92811
      5861234e
    • Arthur Eubanks's avatar
      fed7565e
    • Mircea Trofin's avatar
      [FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms · f9a27df1
      Mircea Trofin authored
      Explicitly opt-out llvm/test/Transforms/Attributor.
      
      Verified by flipping the default value of allow-unused-prefixes and
      observing that none of the failures were under llvm/test/Transforms.
      
      Differential Revision: https://reviews.llvm.org/D92404
      f9a27df1
    • Sam McCall's avatar
      [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC · 634a377b
      Sam McCall authored
      This is a step towards making compile_commands.json reloadable.
      
      The idea is:
       - in addition to rare CDB loads we're soon going to have somewhat-rare CDB
         reloads and fairly-common stat() of files to validate the CDB
       - so stop doing all our work under a big global lock, instead using it to
         acquire per-directory structures with their own locks
       - each directory can be refreshed from disk every N seconds, like filecache
       - avoid locking these at all in the most common case: directory has no CDB
      
      Differential Revision: https://reviews.llvm.org/D92381
      634a377b
    • Louis Dionne's avatar
      [libc++] Run back-deployment CI on macOS 10.15 instead of 10.14 · 717b0da7
      Louis Dionne authored
      The goal was to add coverage for back-deployment over the filesystem
      library, but it was added in macOS 10.15, not 10.14.
      
      Differential Revision: https://reviews.llvm.org/D92937
      717b0da7
    • LLVM GN Syncbot's avatar
      [gn build] Port b804eef0 · cff1f4cb
      LLVM GN Syncbot authored
      cff1f4cb
    • LLVM GN Syncbot's avatar
      [gn build] Port ac7864ec · da1392e1
      LLVM GN Syncbot authored
      da1392e1
    • LLVM GN Syncbot's avatar
      [gn build] Port 5934a791 · d75791ec
      LLVM GN Syncbot authored
      d75791ec
    • Adam Czachorowski's avatar
      [clangd] Split tweak tests into one file per tweak. · 5934a791
      Adam Czachorowski authored
      No changes to the tests themselves, other than some auto -> const auto
      diagnostic fixes and formatting.
      
      Differential Revision: https://reviews.llvm.org/D92939
      5934a791
    • Kazushi (Jam) Marukawa's avatar
      [VE] Add vsum and vfsum intrinsic instructions · 1a2147fe
      Kazushi (Jam) Marukawa authored
      Add vsum and vfsum intrinsic instructions and regression tests.
      
      Reviewed By: simoll
      
      Differential Revision: https://reviews.llvm.org/D92938
      1a2147fe