1. Dec 02, 2020
    • Vitaly Buka's avatar
      bdd6718b
    • Fangrui Song's avatar
      [WebAssembly] Rename --lto-no-new-pass-manager to --no-lto-new-pass-manager · 31e03a9b
      Fangrui Song authored
      In addition, disallow `-lto-new-pass-manager` (see D79371).
      
      Note: the ELF port has also adopted --no-lto-new-pass-manager
      
      Reviewed By: aeubanks
      
      Differential Revision: https://reviews.llvm.org/D92422
      31e03a9b
    • Jessica Paquette's avatar
      [AArch64][GlobalISel] Don't write to WZR in non-flag-setting G_BRCOND case · c82f002c
      Jessica Paquette authored
      We are avoiding writing to WZR just about everywhere else.
      
      Also update the code to use MachineIRBuilder for the sake of consistency.
      
      We also didn't have a GlobalISel testcase for this path, so add a simple one
      now.
      
      Differential Revision: https://reviews.llvm.org/D90626
      c82f002c
    • Richard Smith's avatar
      Remove CXXBasePaths::found_decls and simplify and modernize its only · 1f40d60a
      Richard Smith authored
      caller.
      
      This function did not satisfy its documented contract: it only
      considered the first lookup result on each base path, not all lookup
      results. It also performed unnecessary memory allocations.
      
      This change results in a minor change to our representation: we now
      include overridden methods that are found by any derived-to-base path
      (not involving another override) in the list of overridden methods for a
      function, rather than filtering out functions from bases that are both
      direct virtual bases and indirect virtual bases for which the indirect
      virtual base path contains another override for the function. (That
      filtering rule is part of the class-scope name lookup rules, and doesn't
      really have much to do with enumerating overridden methods.) The users
      of the list of overridden methods do not appear to rely on this
      filtering having happened, and it's simpler to not do it.
      1f40d60a
    • Tom Stellard's avatar
      91843f79
    • Vitaly Buka's avatar
      [sanitizer] Make DTLS_on_tls_get_addr signal safer · 8a300deb
      Vitaly Buka authored
      Avoid relocating DTV table and use linked list of mmap-ed pages.
      
      Reviewed By: eugenis
      
      Differential Revision: https://reviews.llvm.org/D92428
      8a300deb
    • Vitaly Buka's avatar
      [NFC] Extract ForEachDVT · adfefa55
      Vitaly Buka authored
      adfefa55
    • Fangrui Song's avatar
      [RISCVAsmParser] Allow a SymbolRef operand to be a complex expression · e27e3ba9
      Fangrui Song authored
      So that instructions like `lla a5, (0xFF + end) - 4` (supported by GNU as) can
      be parsed.
      
      Add a missing test that an operand like `foo + foo` is not allowed.
      
      Reviewed By: jrtc27
      
      Differential Revision: https://reviews.llvm.org/D92293
      e27e3ba9
    • Nico Weber's avatar
      [lld/mac] Fix issues around thin archives · 07ab597b
      Nico Weber authored
      - most importantly, fix a use-after-free when using thin archives,
        by putting the archive unique_ptr to the arena allocator. This
        ports D65565 to MachO
      
      - correctly demangle symbol namess from archives in diagnostics
      
      - add a test for thin archives -- it finds this UaF, but only when
        running it under asan (it also finds the demangling fix)
      
      - make forceLoadArchive() use addFile() with a bool to have the archive
        loading code in fewer places. no behavior change; matches COFF port a
        bit better
      
      Differential Revision: https://reviews.llvm.org/D92360
      07ab597b
    • Leonard Chan's avatar
      [llvm] Fix for failing test from fdbd84c6 · 19bdc8e5
      Leonard Chan authored
      When handling a DSOLocalEquivalent operand change:
      
      - Remove assertion checking that the `To` type and current type are the
        same type. This is not always a requirement.
      - Add a missing bitcast from an old DSOLocalEquivalent to the type of
        the new one.
      19bdc8e5
    • Jessica Paquette's avatar
      [AArch64][GlobalISel] Select Bcc when it's better than TB(N)Z · 6c3fa97d
      Jessica Paquette authored
      Instead of falling back to selecting TB(N)Z when we fail to select an
      optimized compare against 0, select Bcc instead.
      
      Also simplify selectCompareBranch a little while we're here, because the logic
      was kind of hard to follow.
      
      At -O0, this is a 0.1% geomean code size improvement for CTMark.
      
      A simple example of where this can kick in is here:
      https://godbolt.org/z/4rra6P
      
      In the example above, GlobalISel currently produces a subs, cset, and tbnz.
      SelectionDAG, on the other hand, just emits a compare and b.le.
      
      Differential Revision: https://reviews.llvm.org/D92358
      6c3fa97d
    • Tony's avatar
      [NFC][AMDGPU] AMDGPU code object V4 ABI documentation · 04424c69
      Tony authored
      - Documantation for AMDGPU code object V4.
      - Documentation clarification for code object V2 and V3.
      - Documentation for the clang-offload-bundler.
      - Numerous other documentation clarifications.
      
      Change-Id: I338b327cc9e75da6c987b7e081b496402a5a020e
      
      Differential Revision: https://reviews.llvm.org/D92434
      04424c69
    • LLVM GN Syncbot's avatar
      [gn build] Port 3fcb0eeb · e8b816ad
      LLVM GN Syncbot authored
      e8b816ad
    • Arthur Eubanks's avatar
      [gn build] Format all gn files · ec13b391
      Arthur Eubanks authored
      $ git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
      ec13b391
    • Arthur Eubanks's avatar
      [gn build] Manually port 8fee2ee9 · ea7b0718
      Arthur Eubanks authored
      ea7b0718
    • Eric Astor's avatar
      [ms] [llvm-ml] Support command-line defines · c64037b7
      Eric Astor authored
      Enable command-line defines as textmacros
      
      Reviewed By: thakis
      
      Differential Revision: https://reviews.llvm.org/D90059
      c64037b7
    • River Riddle's avatar
      [mlir][PDL] Add support for PDL bytecode and expose PDL support to OwningRewritePatternList · abfd1a8b
      River Riddle authored
      PDL patterns are now supported via a new `PDLPatternModule` class. This class contains a ModuleOp with the pdl::PatternOp operations representing the patterns, as well as a collection of registered C++ functions for native constraints/creations/rewrites/etc. that may be invoked via the pdl patterns. Instances of this class are added to an OwningRewritePatternList in the same fashion as C++ RewritePatterns, i.e. via the `insert` method.
      
      The PDL bytecode is an in-memory representation of the PDL interpreter dialect that can be efficiently interpreted/executed. The representation of the bytecode boils down to a code array(for opcodes/memory locations/etc) and a memory buffer(for storing attributes/operations/values/any other data necessary). The bytecode operations are effectively a 1-1 mapping to the PDLInterp dialect operations, with a few exceptions in cases where the in-memory representation of the bytecode can be more efficient than the MLIR representation. For example, a generic `AreEqual` bytecode op can be used to represent AreEqualOp, CheckAttributeOp, and CheckTypeOp.
      
      The execution of the bytecode is split into two phases: matching and rewriting. When matching, all of the matched patterns are collected to avoid the overhead of re-running parts of the matcher. These matched patterns are then considered alongside the native C++ patterns, which rewrite immediately in-place via `RewritePattern::matchAndRewrite`,  for the given root operation. When a PDL pattern is matched and has the highest benefit, it is passed back to the bytecode to execute its rewriter.
      
      Differential Revision: https://reviews.llvm.org/D89107
      abfd1a8b
    • Jez Ng's avatar
      [lld-macho] Add isCodeSection() · c7dbaec3
      Jez Ng authored
      This is the same logic that ld64 uses to determine which sections
      contain functions. This was added so that we could determine which
      STABS entries should be N_FUN.
      
      Reviewed By: clayborg
      
      Differential Revision: https://reviews.llvm.org/D92430
      c7dbaec3
    • Jez Ng's avatar
      [lld-macho] Flesh out STABS implementation · 78f6498c
      Jez Ng authored
      This addresses a lot of the comments in {D89257}. Ideally it'd have been
      done in the same diff, but the commits in between make that difficult.
      
      This diff implements:
      * N_GSYM and N_STSYM, the STABS for global and static symbols
      * Has the STABS reflect the section IDs of their referent symbols
      * Ensures we don't fail when encountering absolute symbols or files with
        no debug info
      * Sorts STABS symbols by file to minimize the number of N_OSO entries
      
      Reviewed By: clayborg
      
      Differential Revision: https://reviews.llvm.org/D92366
      78f6498c
    • Jez Ng's avatar
      [lld-macho] Add archive name and file modtime to STABS output · b768d57b
      Jez Ng authored
      We should also set the modtime when running LTO. That will be done in a
      future diff, together with support for the `-object_path_lto` flag.
      
      Reviewed By: clayborg
      
      Differential Revision: https://reviews.llvm.org/D91318
      b768d57b
    • Jez Ng's avatar
      [lld-macho] Emit empty string as first entry of string table · d0c4be42
      Jez Ng authored
      ld64 emits string tables which start with a space and a zero byte. We
      match its behavior here since some tools depend on it.
      
      Similar rationale as {D89561}.
      
      Reviewed By: #lld-macho, smeenai
      
      Differential Revision: https://reviews.llvm.org/D89639
      d0c4be42
    • Jez Ng's avatar
      [lld-macho] Emit local symbols in symtab; record metadata in LC_DYSYMTAB · 51629abc
      Jez Ng authored
      Symbols of the same type must be laid out contiguously: following ld64's
      lead, we choose to emit all local symbols first, then external symbols,
      and finally undefined symbols. For each symbol type, the LC_DYSYMTAB
      load command will record the range (start index and total number) of
      those symbols in the symbol table.
      
      This work was motivated by the fact that LLDB won't search for debug
      info if LC_DYSYMTAB says there are no local symbols (since STABS symbols
      are all local symbols). With this change, LLDB is now able to display
      the source lines at a given breakpoint when debugging our binaries.
      
      Some tests had to be updated due to local symbol names now appearing in
      `llvm-objdump`'s output.
      
      Reviewed By: #lld-macho, smeenai, clayborg
      
      Differential Revision: https://reviews.llvm.org/D89285
      51629abc
    • Jez Ng's avatar
      [lld-macho] Emit STABS symbols for debugging, and drop debug sections · 3fcb0eeb
      Jez Ng authored
      Debug sections contain a large amount of data. In order not to bloat the size
      of the final binary, we remove them and instead emit STABS symbols for
      `dsymutil` and the debugger to locate their contents in the object files.
      
      With this diff, `dsymutil` is able to locate the debug info. However, we need
      a few more features before `lldb` is able to work well with our binaries --
      e.g. having `LC_DYSYMTAB` accurately reflect the number of local symbols,
      emitting `LC_UUID`, and more. Those will be handled in follow-up diffs.
      
      Note also that the STABS we emit differ slightly from what ld64 does. First, we
      emit the path to the source file as one `N_SO` symbol instead of two. (`ld64`
      emits one `N_SO` for the dirname and one of the basename.) Second, we do not
      emit `N_BNSYM` and `N_ENSYM` STABS to mark the start and end of functions,
      because the `N_FUN` STABS already serve that purpose. @clayborg recommended
      these changes based on his knowledge of what the debugging tools look for.
      
      Additionally, this current implementation doesn't accurately reflect the size
      of function symbols. It uses the size of their containing sectioins as a proxy,
      but that is only accurate if `.subsections_with_symbols` is set, and if there
      isn't an `N_ALT_ENTRY` in that particular subsection. I think we have two
      options to solve this:
      
      1. We can split up subsections by symbol even if `.subsections_with_symbols`
         is not set, but include constraints to ensure those subsections retain
         their order in the final output. This is `ld64`'s approach.
      2. We could just add a `size` field to our `Symbol` class. This seems simpler,
         and I'm more inclined toward it, but I'm not sure if there are use cases
         that it doesn't handle well. As such I'm punting on the decision for now.
      
      Reviewed By: clayborg
      
      Differential Revision: https://reviews.llvm.org/D89257
      3fcb0eeb
    • Nico Weber's avatar
      [gn build] (manually) port 8fee2ee9 · ba4e45a0
      Nico Weber authored
      ba4e45a0
    • Mark Nauwelaerts's avatar
      [clang-format] Add new option PenaltyIndentedWhitespace · 1e4d6d1c
      Mark Nauwelaerts authored
      Reviewed By: MyDeveloperDay
      
      Differential Revision: https://reviews.llvm.org/D90534
      1e4d6d1c
    • Sam Clegg's avatar
      [lld][WebAssembly] Feedback from D92038. NFC · a38ed62e
      Sam Clegg authored
      Differential Revision: https://reviews.llvm.org/D92429
      a38ed62e
    • Louis Dionne's avatar
    • Eric Astor's avatar
      [ms] [llvm-ml] Introduce command-line compatibility for ml.exe and ml64.exe · 8fee2ee9
      Eric Astor authored
      Switch to OptParser for command-line handling
      
      Reviewed By: thakis
      
      Differential Revision: https://reviews.llvm.org/D90058
      8fee2ee9
    • James Park's avatar
      Avoid redundant inline with LLVM_ATTRIBUTE_ALWAYS_INLINE · 78b0ec3d
      James Park authored
      Fix MSVC warning when __forceinline is paired with inline.
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D85264
      78b0ec3d
    • Jez Ng's avatar
      [lld-macho] Extend PIE option handling · 6b3eecd2
      Jez Ng authored
      * Enable PIE by default if targeting 10.6 or above on x86-64. (The
        manpage says 10.7, but that actually applies only to i386, and in
        general varies based on the target platform. I didn't update the
        manpage because listing all the different behaviors would make for a
        pretty long description.)
      * Add support for `-no_pie`
      * Remove `HelpHidden` from `-pie`
      
      Reviewed By: thakis
      
      Differential Revision: https://reviews.llvm.org/D92362
      6b3eecd2
    • David Blaikie's avatar
      Revert "[FastISel] Flush local value map on ever instruction" and dependent patches · 615f63e1
      David Blaikie authored
      This reverts commit cf1c774d.
      
      This change caused several regressions in the gdb test suite - at least
      a sample of which was due to line zero instructions making breakpoints
      un-lined. I think they're worth investigating/understanding more (&
      possibly addressing) before moving forward with this change.
      
      Revert "[FastISel] NFC: Clean up unnecessary bookkeeping"
      This reverts commit 3fd39d36.
      
      Revert "[FastISel] NFC: Remove obsolete -fast-isel-sink-local-values option"
      This reverts commit a474657e.
      
      Revert "Remove static function unused after cf1c774d."
      This reverts commit dc35368c.
      
      Revert "[lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction""
      This reverts commit 53a14a47.
      615f63e1
    • Michał Górny's avatar
      [lldb] [test] Reenable two passing tests on FreeBSD · e1f613ce
      Michał Górny authored
      [Reenable TestReproducerAttach and TestThreadSpecificBpPlusCondition
      on FreeBSD -- both seem to pass correctly now.
      e1f613ce
    • Muhammad Omair Javaid's avatar
      Make offset field optional in RegisterInfo packet for Arm64 · 78cb4562
      Muhammad Omair Javaid authored
      This patch carries forward our aim to remove offset field from qRegisterInfo
      packets and XML register description. I have created a new function which
      returns if offset fields are dynamic meaning client can calculate offset on
      its own based on register number sequence and register size. For now this
      function only returns true for NativeRegisterContextLinux_arm64 but we can
      test this for other architectures and make it standard later.
      
      As a consequence we do not send offset field from lldb-server (arm64 for now)
      while other stubs dont have an offset field so it wont effect them for now.
      On the client side we have replaced previous offset calculation algorithm
      with a new scheme, where we sort all primary registers in increasing
      order of remote regnum and then calculate offset incrementally.
      
      This committ also includes a test to verify all of above functionality
      on Arm64.
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D91241
      78cb4562
    • Muhammad Omair Javaid's avatar
      RegisterInfoPOSIX_arm64 remove unused bytes from g/G packet · 26b8ea2e
      Muhammad Omair Javaid authored
      This came up while putting together our new strategy to create g/G packets
      in compliance with GDB RSP protocol where register offsets are calculated in
      increasing order of register numbers without any unused spacing.
      
      RegisterInfoPOSIX_arm64::GPR size was being calculated after alignment
      correction to 8 bytes which meant there was a 4 bytes unused space between
      last gpr (cpsr) and first vector register V. We have put LLVM_PACKED_START
      decorator on RegisterInfoPOSIX_arm64::GPR to make sure single byte
      alignment is enforced. Moreover we are now doing to use arm64 user_pt_regs
      struct defined in ptrace.h for accessing ptrace user registers.
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D92063
      26b8ea2e
    • cchen's avatar
    • Arthur Eubanks's avatar
      Reland [CMake][NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/ · aafb3662
      Arthur Eubanks authored
      This allows us to use its value everywhere, rather than just clang. Some
      other places, like opt and lld, will use its value soon.
      
      Rename it internally to LLVM_ENABLE_NEW_PASS_MANAGER.
      
      The #define for it is now in llvm-config.h.
      
      The initial land accidentally set the value of
      LLVM_ENABLE_NEW_PASS_MANAGER to the string
      ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER instead of its value.
      
      Reviewed By: rnk, hans
      
      Differential Revision: https://reviews.llvm.org/D92072
      aafb3662
    • Louis Dionne's avatar
      2671fccf
    • Arthur Eubanks's avatar
      [LLD][ELF][NewPM] Add option to force legacy PM · 99d82412
      Arthur Eubanks authored
      In preparation for the NPM switch.
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D92417
      99d82412
    • Rahul Joshi's avatar
      [MLIR] Fix genTypeInterfaceMethods() to work correctly with InferTypeOpInterface · 6b043ecd
      Rahul Joshi authored
      - Change InferTypeOpInterface::inferResultTypes to use fully qualified types matching
        the ones generated by genTypeInterfaceMethods, so the redundancy can be detected.
      - Move genTypeInterfaceMethods() before genOpInterfaceMethods() so that the
        inferResultTypes method generated by genTypeInterfaceMethods() takes precedence
        over the declaration that might be generated by genOpInterfaceMethods()
      - Modified an op in the test dialect to exercise this (the modified op would fail to
        generate valid C++ code due to duplicate inferResultTypes methods).
      
      Differential Revision: https://reviews.llvm.org/D92414
      6b043ecd
    • Arthur Eubanks's avatar
      Revert "[CMake][NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/" · 806a76c0
      Arthur Eubanks authored
      The new pass manager was accidentally enabled by default with this change.
      
      This reverts commit a36bd4c9.
      806a76c0