1. Dec 10, 2020
    • Duncan P. N. Exon Smith's avatar
      Remove RemappedFiles param from ASTUnit::LoadFromASTFile, NFC · c3ff9939
      Duncan P. N. Exon Smith authored
      This parameter is always set to `None`. Remove it.
      
      Differential Revision: https://reviews.llvm.org/D90889
      c3ff9939
    • Matt Morehouse's avatar
      [DFSan] Add custom wrapper for getsockopt. · 4eedc2e3
      Matt Morehouse authored
      The wrapper clears shadow for optval and optlen when written.
      
      Reviewed By: stephan.yichao.zhao, vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D92961
      4eedc2e3
    • Rahul Joshi's avatar
      [MLIR] Minor cleanup for Shape dialect. · b0d02b69
      Rahul Joshi authored
      - Remove some unused types from the Shape dialect
      - Fix from_extent_tensor to only allow 1D index tensors
      - Fix assuming_yield to only allow shape.assuming as the parent op.
      - Fix some documentation typos and reword some things.
      
      Differential Revision: https://reviews.llvm.org/D92901
      b0d02b69
    • Jason Molenda's avatar
      Ignore DBGArchitecture from dsymForUUID's plist · 2cedc44a
      Jason Molenda authored
      When the architecture from the returned plist differs from the
      architecture lldb will pick when loading the binary file, lldb will
      reject the binary as not matching.  We are working with UUID's in
      this case, so an architecture is not disambiguating anything; it
      just opens this possibility for failing to load the specified binary.
      Stop reading the architecture from the plist.
      
      <rdar://problem/71612561>
      Differential revision: https://reviews.llvm.org/D92692
      2cedc44a
    • Duncan P. N. Exon Smith's avatar
      ARCMigrate: Migrate ObjCMT.cpp over to FileEntryRef · 898d61b3
      Duncan P. N. Exon Smith authored
      Migrate ObjCMT.cpp from using `const FileEntry*` to `FileEntryRef`. This
      is one of the blockers for changing `SourceManager` to use
      `FileEntryRef`.
      
      This adds an initial version of `SourceManager::getFileEntryRefForID`,
      which uses to `FileEntry::getLastRef`; after `SourceManager` switches,
      `SourceManager::getFileEntryForID` will need to call this function.
      
      This also adds uses of `FileEntryRef` as a key in a `DenseMap`, and a
      call to `hash_value(Optional)` in `DenseMapInfo<EditEntry>`; support for
      these were added in prep commits.
      
      Differential Revision: https://reviews.llvm.org/D92678
      898d61b3
    • Peter Collingbourne's avatar
      scudo: Shrink secondary header and cache entry size by a word on Linux. NFCI. · a7790508
      Peter Collingbourne authored
      Normally compilers will allocate space for struct fields even if the
      field is an empty struct. Use the [[no_unique_address]] attribute to
      suppress that behavior. This attribute that was introduced in C++20,
      but compilers that do not support [[no_unique_address]] will ignore
      it since it uses C++11 attribute syntax.
      
      Differential Revision: https://reviews.llvm.org/D92966
      a7790508
    • Scott Linder's avatar
      [MC][AMDGPU] Consume EndOfStatement in asm parser · 9260a999
      Scott Linder authored
      Avoids spurious newlines showing up in the output when emitting assembly
      via MC.
      
      Reviewed By: MaskRay, arsenm
      
      Differential Revision: https://reviews.llvm.org/D92690
      9260a999
    • Craig Topper's avatar
      [X86] Use APInt::isSignedIntN instead of isIntN for 64-bit ANDs in... · 5ff5cf8e
      Craig Topper authored
      [X86] Use APInt::isSignedIntN instead of isIntN for 64-bit ANDs in X86DAGToDAGISel::IsProfitableToFold
      
      Pretty sure we meant to be checking signed 32 immediates here
      rather than unsigned 32 bit. I suspect I messed this up because
      in MathExtras.h we have isIntN and isUIntN so isIntN differs in
      signedness depending on whether you're using APInt or plain integers.
      
      This fixes a case where we didn't fold a constant created
      by shrinkAndImmediate. Since shrinkAndImmediate doesn't topologically
      sort constants it creates, we can fail to convert the Constant
      to a TargetConstant. This leads to very strange behavior later.
      
      Fixes PR48458.
      5ff5cf8e
    • Reid Kleckner's avatar
      Avoid a possible one-byte OOB read off of .drectve sections · c8466a57
      Reid Kleckner authored
      Pointed out by Ryan Prichard
      c8466a57
    • Tres Popp's avatar
      [mlir] Allow RegionBranchOps in dependence analysis · 7ea94922
      Tres Popp authored
      This is to prevent assertion failures on scf.if and shape.assuming
      operations where this is not enough information currently to handle any
      aliasing information.
      
      Differential Revision: https://reviews.llvm.org/D92963
      7ea94922
    • Fangrui Song's avatar
      [LLD][gold] Add -plugin-opt=no-new-pass-manager · 68ff3b33
      Fangrui Song authored
      -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=on configured LLD and LLVMgold.so
      will use the new pass manager by default. Add an option to
      use the legacy pass manager. This will also be used by the Clang driver
      when -fno-new-pass-manager (D92915) / -fno-experimental-new-pass-manager is set.
      
      Reviewed By: aeubanks, tejohnson
      
      Differential Revision: https://reviews.llvm.org/D92916
      68ff3b33
    • Duncan P. N. Exon Smith's avatar
      Frontend: Migrate to FileEntryRef in CompilerInstance::InitializeSourceManager, NFC · a5c89bb0
      Duncan P. N. Exon Smith authored
      Use `FileManager::getVirtualFileRef` to get the virtual file for stdin,
      and add an overload of `SourceManager::overrideFileContents` that takes
      a `FileEntryRef`, migrating `CompilerInstance::InitializeSourceManager`.
      
      Differential Revision: https://reviews.llvm.org/D92680
      a5c89bb0
    • Yuanfang Chen's avatar
      [NFCI] Add missing triple to several LTO tests · 8b23b3ab
      Yuanfang Chen authored
      Also remove the module triple of clang/test/CodeGenObjC/arc.ll, the
      commandline tripe is all it needs.
      8b23b3ab
    • 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