1. Jul 13, 2021
    • Leonard Chan's avatar
      [NFC][compiler-rt][hwasan] Move shadow bound variables to hwasan.cpp · b270c3fb
      Leonard Chan authored
      This way, other platforms can define these values.
      
      Differential Revision: https://reviews.llvm.org/D105744
      b270c3fb
    • Craig Topper's avatar
      [X86] Teach X86FloatingPoint's handleCall to only erase the FP stack if there... · d5c97f4b
      Craig Topper authored
      [X86] Teach X86FloatingPoint's handleCall to only erase the FP stack if there is a regmask operand that clobbers the FP stack.
      
      There are some calls to functions like `__alloca` that are missing
      a regmask operand. Lack of a regmask operand means that all
      registers that aren't mentioned by def operands are preserved.
      __alloca only updates EAX and ESP and has def operands for
      them so this is ok. Because there is no regmask the register
      allocator won't spill the FP registers across the call. Assuming
      we want to keep the FP stack untoched across these calls, we
      need to handle this is in the FP stackifier.
      
      We might want to add a proper regmask operand to the code that
      creates these calls to indicate all registers are preserved, but we'd
      still need this change to the FP stackifier to know to preserve the
      FP stack for such a regmask.
      
      The test is kind of long, but bugpoint wasn't able to reduce it
      any further.
      
      Fixes PR50782
      
      Reviewed By: pengfei
      
      Differential Revision: https://reviews.llvm.org/D105762
      d5c97f4b
    • Fangrui Song's avatar
      [llvm-readobj] Switch command line parsing from llvm::cl to OptTable · 46580d43
      Fangrui Song authored
      Users should generally observe no difference as long as they don't use
      unintended option forms. Behavior changes:
      
      * `-t=d` is removed. Use `-t d` instead.
      * `--demangle=false` and `--demangle=0` cannot be used. Omit the option or use `--no-demangle`. Other flag-style options don't have `--no-` forms.
      * `--help-list` is removed. This is a `cl::` specific option.
      * llvm-readobj now supports grouped short options as well.
      * `--color` is removed. This is generally not useful (only apply to errors/warnings) but was inherited from Support.
      
      Some adjustment to the canonical forms
      (usually from GNU readelf; currently llvm-readobj has too many redundant aliases):
      
      * --dyn-syms is canonical. --dyn-symbols is a hidden alias
      * --file-header is canonical. --file-headers is a hidden alias
      * --histogram is canonical. --elf-hash-histogram is a hidden alias
      * --relocs is canonical. --relocations is a hidden alias
      * --section-groups is canonical. --elf-section-groups is a hidden alias
      
      OptTable avoids global option collision if we decide to support multiplexing for binary utilities.
      
      * Most one-dash long options are still supported. `-dt, -sd, -st, -sr` are dropped due to their conflict with grouped short options.
      * `--section-mapping=false` (D57365) is strange but is kept for now.
      * Many `cl::opt` variables were unnecessarily external. I added `static` whenever appropriate.
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D105532
      46580d43
    • Andrzej Warzynski's avatar
      [flang][nfc] Simplify CMake · fe892114
      Andrzej Warzynski authored
      Folds `list(APPEND <list> [<element>...])` into the definition of
      `<list>`.
      fe892114
    • Rob Suderman's avatar
      [mlir][tosa] Added more shape inference for tosa ops · 5a4e7760
      Rob Suderman authored
      Added shape inference for:
      - scatter
      - gather
      - transpose
      - slice
      - pad
      - concat
      - reduction operations
      
      Also updated reshape for more aggressive shape inference.
      
      Differential Revision: https://reviews.llvm.org/D105383
      5a4e7760
    • Fangrui Song's avatar
      [test] Move AMDGPU reloc test from Object to tools/llvm-readobj and simplify it · a95f56f6
      Fangrui Song authored
      We already have some reloc-types-elf-*.test serving the similar purpose.
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D105783
      a95f56f6
    • Jinsong Ji's avatar
      [AIX] Emit version string in .file directive · 28fb69e0
      Jinsong Ji authored
      AIX .file directive support including compiler version string.
      https://www.ibm.com/docs/en/aix/7.2?topic=ops-file-pseudo-op
      
      This patch adds the support so that it will be easier to identify build
      compiler in objects.
      
      Reviewed By: #powerpc, shchenz
      
      Differential Revision: https://reviews.llvm.org/D105743
      28fb69e0
    • David Green's avatar
      [ARM] Expand types in VQDMULH tests. NFC · af6f136a
      David Green authored
      af6f136a
    • Joachim Protze's avatar
      [OpenMP] Remove TSAN annotations from libomp · 681055ea
      Joachim Protze authored
      The annotations in libomp were never built by default. The annotations are
      also superseded by the annotations which the OMPT tool libarcher.so provides.
      With respect to libarcher, libomp behaves as if libarcher would be the last
      element of OMP_TOOL_LIBARARIES. I.e., if no other OMPT tool gets active,
      libarcher will check if an OpenMP application is built with TSan.
      
      Since libarcher gets loaded by default, enabling LIBOMP_TSAN_SUPPORT would
      result in redundant annotations for TSan, which slightly differ in details
      and coverage (e.g. task dependencies are not handled well by the annotations
      in libomp).
      
      This patch removes all TSan annotations from the OpenMP runtime code.
      
      Differential Revision: https://reviews.llvm.org/D103767
      681055ea
    • Louis Dionne's avatar
      88b73a98
    • Albion Fung's avatar
      [PowerPC] Implement trap and conversion builtins for XL compatibility · ef49d925
      Albion Fung authored
      This patch implements trap and FP to and from double conversions. The builtins
      generate code that mirror what is generated from the XL compiler. Intrinsics
      are named conventionally with builtin_ppc, but are aliased to provide the same
      builtin names as the XL compiler.
      
      Differential Revision: https://reviews.llvm.org/D103668
      ef49d925
    • Fangrui Song's avatar
      [llvm-objcopy] Improve performance of long pattern lists · 0144e625
      Fangrui Song authored
      Some users use a long list of fixed patterns (PR50404) and
      O(|patterns|*|symbols|) can be too slow. Such usage typically does not use
      --regex or --wildcard. We can use a DenseSet<CachedHashStringRef> to optimize
      name lookups.
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D105218
      0144e625
  2. Jul 12, 2021
    • Benjamin Kramer's avatar
      sanitizer_common: Suppress another thread safety warning · 6f613181
      Benjamin Kramer authored
      Another follow-up to 0da172b1
      
      compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'CandidateTSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
      }
      ^
      compiler-rt/lib/scudo/scudo_tsd_shared.cpp:95:21: note: mutex acquired here
            CandidateTSD->lock();
                          ^
      compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'TSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
      }
      ^
      compiler-rt/lib/scudo/scudo_tsd_shared.cpp:101:8: note: mutex acquired here
        TSD->lock();
             ^
      compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'TSDs[Index].Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
      }
      ^
      compiler-rt/lib/scudo/scudo_tsd_shared.cpp:80:23: note: mutex acquired here
            if (TSDs[Index].tryLock()) {
                            ^
      6f613181
    • Benjamin Kramer's avatar
      sanitizer_common: Fix the build for platforms that use shared TSDs · 561b9446
      Benjamin Kramer authored
      Looks like an oversight in 0da172b1
      
      compiler-rt/lib/scudo/scudo_tsd_shared.inc:53:1: error: mutex 'TSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
      }
      ^
      compiler-rt/lib/scudo/scudo_tsd_shared.inc:49:12: note: mutex acquired here
        if (TSD->tryLock())
                 ^
      561b9446
    • Philip Reames's avatar
      [langref] attempt to clarify semantics of inttoptr/ptrtoint for non-integral types · f74bb95b
      Philip Reames authored
      In review discussion on D104322, Eli and Roman quite reasonable raised concerns about the LangRef not really providing a precise definition for inttoptr/ptrtoint on non-integral types. These had previously been disallowed, but I'd pragmatically allowed them in ac81cb7e. This is my attempt to improve the situation.
      
      Differential Revision: https://reviews.llvm.org/D104547
      f74bb95b
    • Bardia Mahjour's avatar
      [Altivec] Use signed comparison for vec_all_* and vec_any_* interfaces · 2071ce9d
      Bardia Mahjour authored
      We are currently being inconsistent in using signed vs unsigned comparisons for
      vec_all_* and vec_any_* interfaces that use vector bool types. For example we
      use signed comparison for vec_all_ge(vector signed char, vector bool char) but
      unsigned comparison for when the arguments are swapped. GCC and XL use signed
      comparison instead. This patch makes clang consistent with itself and with XL
      and GCC.
      
      Reviewed By: nemanjai
      
      Differential Revision: https://reviews.llvm.org/D105666
      2071ce9d
    • Vassil Vassilev's avatar
      Reland "[clang-repl] Implement partial translation units and error recovery." · 11b47c10
      Vassil Vassilev authored
      Original commit message:
      
      [clang-repl] Implement partial translation units and error recovery.
      
      https://reviews.llvm.org/D96033 contained a discussion regarding efficient
      modeling of error recovery. @rjmccall has outlined the key ideas:
      
      Conceptually, we can split the translation unit into a sequence of partial
      translation units (PTUs). Every declaration will be associated with a unique PTU
      that owns it.
      
      The first key insight here is that the owning PTU isn't always the "active"
      (most recent) PTU, and it isn't always the PTU that the declaration
      "comes from". A new declaration (that isn't a redeclaration or specialization of
      anything) does belong to the active PTU. A template specialization, however,
      belongs to the most recent PTU of all the declarations in its signature - mostly
      that means that it can be pulled into a more recent PTU by its template
      arguments.
      
      The second key insight is that processing a PTU might extend an earlier PTU.
      Rolling back the later PTU shouldn't throw that extension away. For example, if
      the second PTU defines a template, and the third PTU requires that template to
      be instantiated at float, that template specialization is still part of the
      second PTU. Similarly, if the fifth PTU uses an inline function belonging to the
      fourth, that definition still belongs to the fourth. When we go to emit code in
      a new PTU, we map each declaration we have to emit back to its owning PTU and
      emit it in a new module for just the extensions to that PTU. We keep track of
      all the modules we've emitted for a PTU so that we can unload them all if we
      decide to roll it back.
      
      Most declarations/definitions will only refer to entities from the same or
      earlier PTUs. However, it is possible (primarily by defining a
      previously-declared entity, but also through templates or ADL) for an entity
      that belongs to one PTU to refer to something from a later PTU. We will have to
      keep track of this and prevent unwinding to later PTU when we recognize it.
      Fortunately, this should be very rare; and crucially, we don't have to do the
      bookkeeping for this if we've only got one PTU, e.g. in normal compilation.
      Otherwise, PTUs after the first just need to record enough metadata to be able
      to revert any changes they've made to declarations belonging to earlier PTUs,
      e.g. to redeclaration chains or template specialization lists.
      
      It should even eventually be possible for PTUs to provide their own slab
      allocators which can be thrown away as part of rolling back the PTU. We can
      maintain a notion of the active allocator and allocate things like Stmt/Expr
      nodes in it, temporarily changing it to the appropriate PTU whenever we go to do
      something like instantiate a function template. More care will be required when
      allocating declarations and types, though.
      
      We would want the PTU to be efficiently recoverable from a Decl; I'm not sure
      how best to do that. An easy option that would cover most declarations would be
      to make multiple TranslationUnitDecls and parent the declarations appropriately,
      but I don't think that's good enough for things like member function templates,
      since an instantiation of that would still be parented by its original class.
      Maybe we can work this into the DC chain somehow, like how lexical DCs are.
      
      We add a different kind of translation unit `TU_Incremental` which is a
      complete translation unit that we might nonetheless incrementally extend later.
      Because it is complete (and we might want to generate code for it), we do
      perform template instantiation, but because it might be extended later, we don't
      warn if it declares or uses undefined internal-linkage symbols.
      
      This patch teaches clang-repl how to recover from errors by disconnecting the
      most recent PTU and update the primary PTU lookup tables. For instance:
      
      ```./clang-repl
      clang-repl> int i = 12; error;
      In file included from <<< inputs >>>:1:
      input_line_0:1:13: error: C++ requires a type specifier for all declarations
      int i = 12; error;
                  ^
      error: Parsing failed.
      clang-repl> int i = 13; extern "C" int printf(const char*,...);
      clang-repl> auto r1 = printf("i=%d\n", i);
      i=13
      clang-repl> quit
      ```
      
      Differential revision: https://reviews.llvm.org/D104918
      11b47c10
    • Bradley Smith's avatar
      [SelectionDAG] Simplify PromoteIntRes_INSERT_SUBVECTOR to only handle result · 112c0903
      Bradley Smith authored
      Let other parts of legalization handle the rest of the node, this allows
      re-use of existing optimizations elsewhere.
      
      Differential Revision: https://reviews.llvm.org/D105624
      112c0903
    • Nico Weber's avatar
      [lld/mac] Make tbd files in one test valid · 396f2e9d
      Nico Weber authored
      No behavior change, but ld64 can't load .tbd files without the
      trailing `...`, so include them to make it easier to run tests
      with l64 too.
      396f2e9d
    • Louis Dionne's avatar
      [libc++] Test on Clang ToT by default · 85cce4d4
      Louis Dionne authored
      This is what ffccf96e should have enabled, however the symlink
      in the Docker image was not pointing to the right compiler, so we were
      testing with Clang 12 instead of ToT.
      85cce4d4
    • Sanjay Patel's avatar
      [SLP] add test for multiple logical reductions; NFC · 0d17b5d0
      Sanjay Patel authored
      More coverage for:
      D105730
      0d17b5d0
    • Dmitry Vyukov's avatar
      sanitizer_common: support printing __m128i type · 6ca72478
      Dmitry Vyukov authored
      __m128i is vector SSE type used in tsan.
      It's handy to be able to print it for debugging.
      
      Reviewed By: vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D102167
      6ca72478
    • Simon Tatham's avatar
      Remove unused parameter from parseMSInlineAsm. · e49985bb
      Simon Tatham authored
      No implementation uses the `LocCookie` parameter at all. Errors are
      reported from inside that function by `llvm::SourceMgr`, and the
      instance of that at the clang call site arranges to pass the error
      messages back to a `ClangAsmParserCallback`, which is where the clang
      SourceLocation for the error is computed.
      
      (This is part of a patch series working towards the ability to make
      SourceLocation into a 64-bit type to handle larger translation units.
      But this particular change seems beneficial in its own right.)
      
      Reviewed By: miyuki
      
      Differential Revision: https://reviews.llvm.org/D105490
      e49985bb
    • Abbas Sabra's avatar
      1af97c9d
    • Benjamin Kramer's avatar
      [AArch64] Silence unused variable warning. NFC. · 0da3573a
      Benjamin Kramer authored
      AArch64ISelLowering.cpp:15167:8: warning: unused variable 'OpCode' [-Wunused-variable]
        auto OpCode = N->getOpcode();
             ^
      0da3573a
    • Louis Dionne's avatar
    • Felix Berger's avatar
      [clang-tidy] performance-unnecessary-copy-initialization: Disable structured bindings. · 187e050b
      Felix Berger authored
      Structured bindings can currently trigger the check and lead to a wrong
      fix. Because the DecompositionDecl itself is not used and the check does not
      iterate through its the decl's bindings to verify whether the bindings' holding
      vars are used this leads to the whole statement to be deleted.
      
      To support structured bindings properly 3 cases would need to be considered.
      
        1. All holding vars are not used -> The statement can be deleted.
        2. All holding vars are used as const or not used -> auto can be converted to const auto&.
        3. Neither case is true -> leave unchanged.
      
      In the check we'll have to separate the logic that determines this from the code
      that produces the diagnostic and fixes and first determine which of the cases
      we're dealing with before creating fixes.
      
      Since this is a bigger refactoring we'll disable structured bindings for now to
      prevent incorrect fixes.
      
      Differential Revision: https://reviews.llvm.org/D105727
      
      Reviewed-by: ymandel
      187e050b
    • Dmitry Vyukov's avatar
      sanitizer_common: allow COMMON_INTERCEPTOR_ENTER to use labels · b3bd8850
      Dmitry Vyukov authored
      The memcpy interceptor is the only one that uses COMMON_INTERCEPTOR_ENTER
      more than once in a single function. This does not allow COMMON_INTERCEPTOR_ENTER
      to use labels, because they are global for the whole function (not block scoped).
      Don't include COMMON_INTERCEPTOR_ENTER code twice.
      
      Reviewed By: melver
      
      Differential Revision: https://reviews.llvm.org/D105774
      b3bd8850
    • Raphael Isemann's avatar
      [lldb][NFC] Use ArrayRef in TypeSystemClang::SetFunctionParameters · 7177c595
      Raphael Isemann authored
      The implementation converts the pointer/size pair anyway back to ArrayRef.
      7177c595
    • Frederik Gossen's avatar
      [MLIR][StandardToLLVM] Move `copyUnrankedDescriptors` to pattern · ed1f149b
      Frederik Gossen authored
      Make the function `copyUnrankedDescriptors` accessible in
      `ConvertToLLVMPattern`.
      
      Differential Revision: https://reviews.llvm.org/D105810
      ed1f149b
    • Cullen Rhodes's avatar
      [AArch64] Add target features for Armv9-A Scalable Matrix Extension (SME) · 9e426751
      Cullen Rhodes authored
      First patch in a series adding MC layer support for the Arm Scalable
      Matrix Extension.
      
      This patch adds the following features:
      
          sme, sme-i64, sme-f64
      
      The sme-i64 and sme-f64 flags are for the optional I16I64 and F64F64
      features.
      
      If a target supports I16I64 then the following instructions are
      implemented:
      
        * 64-bit integer ADDHA and ADDVA variants (D105570).
        * SMOPA, SMOPS, SUMOPA, SUMOPS, UMOPA, UMOPS, USMOPA, and USMOPS
          instructions that accumulate 16-bit integer outer products into 64-bit
          integer tiles.
      
      If a target supports F64F64 then the FMOPA and FMOPS instructions that
      accumulate double-precision floating-point outer products into
      double-precision tiles are implemented.
      
      Outer products are implemented in D105571.
      
      The reference can be found here:
      https://developer.arm.com/documentation/ddi0602/2021-06
      
      Reviewed By: CarolineConcatto
      
      Differential Revision: https://reviews.llvm.org/D105569
      9e426751
    • Michael Liao's avatar
      Fix warning '-Wparentheses'. NFC. · 8253fa22
      Michael Liao authored
      8253fa22
    • Jonas Paulsson's avatar
      [SystemZ] Bugfix for the 'N' code for inline asm operand. · 96421af5
      Jonas Paulsson authored
      Don't use a local MachineOperand copy in SystemZAsmPrinter::PrintAsmOperand()
      and change the register as it may break the MRI tracking of register
      uses. Use an MCOperand instead.
      
      Review: Ulrich Weigand
      
      Differential Revision: https://reviews.llvm.org/D105757
      96421af5
    • Sanjay Patel's avatar
      [InstCombine] reduce signbit test of logic ops to cmp with zero · a488c787
      Sanjay Patel authored
      This is the pattern from the description of:
      https://llvm.org/PR50816
      
      There might be a way to generalize this to a smaller or more
      generic pattern, but I have not found it yet.
      
      https://alive2.llvm.org/ce/z/ShzJoF
      
      define i1 @src(i8 %x) {
        %add = add i8 %x, -1
        %xor = xor i8 %x, -1
        %and = and i8 %add, %xor
        %r = icmp slt i8 %and, 0
        ret i1 %r
      }
      
      define i1 @tgt(i8 %x) {
        %r = icmp eq i8 %x, 0
        ret i1 %r
      }
      a488c787
    • Sanjay Patel's avatar
      [InstCombine][tests] add tests for signbit + logic; NFC · 4b9d6982
      Sanjay Patel authored
      PR50816
      4b9d6982
    • Tobias Gysi's avatar
      [mlir][linalg][python] Add auto-generated file warning (NFC). · b4e843ba
      Tobias Gysi authored
      Annotate LinalgNamedStructuredOps.yaml with a comment stating the file is auto-generated and should not be edited manually.
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D105809
      b4e843ba
    • Simon Pilgrim's avatar
      [CostModel][X86] Adjust truncate SSE/AVX legalized costs based on llvm-mca reports. · 96b4117d
      Simon Pilgrim authored
      Update truncation costs based on the worst case costs from the script in D103695.
      
      Move to using legalized types wherever possible, which allows us to prune the cost tables.
      96b4117d
    • Nico Weber's avatar
      [gn build] port 0da172b1 more · eecd5d0a
      Nico Weber authored
      eecd5d0a
    • David Green's avatar
      [AArch64] Set the latency of Cortex-A55 stores to 1 · f73334c4
      David Green authored
      This sets the latency of stores to 1 in the Cortex-A55 scheduling model,
      to better match the values given in the software optimization guide.
      
      The latency of a store in normal llvm scheduling does not appear to have
      a lot of uses. If the store has no outputs then the latency is somewhat
      meaningless (and pre/post increment update operands use the WriteAdr
      write for those operands instead). The one place it does alter things is
      the latency between a store and the end of the scheduling region, which
      can in turn have an effect on the critical path length. As a result a
      latency of 1 is more correct and offers ever-so-slightly better
      scheduling of instructions near the end of the block.
      
      They are marked as RetireOOO to keep the llvm-mca from introducing
      stalls where non would exist.
      
      Differential Revision: https://reviews.llvm.org/D105541
      f73334c4
    • Nico Weber's avatar
      [gn build] (semi-manually) port 0da172b1 · 0c6fad23
      Nico Weber authored
      0c6fad23