1. Nov 26, 2019
    • Michał Górny's avatar
      [lldb] [Process/NetBSD] Fix handling concurrent watchpoint events · 7644d8ba
      Michał Górny authored
      Fix handling concurrent watchpoint events so that they are reported
      correctly in LLDB.
      
      If multiple watchpoints are hit concurrently, the NetBSD kernel reports
      them as series of SIGTRAPs with a thread specified, and the debugger
      investigates DR6 in order to establish which watchpoint was hit.  This
      is normally fine.
      
      However, LLDB disables and reenables the watchpoint on all threads after
      each hit, which results in the hit status from DR6 being wiped.
      As a result, it can't establish which watchpoint was hit in successive
      SIGTRAP processing.
      
      In order to workaround this problem, clear DR6 only if the breakpoint
      is overwritten with a new one.  More specifically, move cleaning DR6
      from ClearHardwareWatchpoint() to SetHardwareWatchpointWithIndex(),
      and do that only if the newly requested watchpoint is different
      from the one being set previously.  This ensures that the disable-enable
      logic of LLDB does not clear watchpoint hit status for the remaining
      threads.
      
      This also involves refactoring of watchpoint logic.  With the old logic,
      clearing watchpoint involved wiping dr6 & dr7, and setting it setting
      dr{0..3} & dr7.  With the new logic, only enable bit is cleared
      from dr7, and the remaining bits are cleared/overwritten while setting
      new watchpoint.
      
      Differential Revision: https://reviews.llvm.org/D70025
      7644d8ba
    • Michał Górny's avatar
      [lldb] [Process/NetBSD] Copy watchpoints to newly-created threads · d970d4d4
      Michał Górny authored
      NetBSD ptrace interface does not populate watchpoints to newly-created
      threads.  Solve this via copying the watchpoints from the current thread
      when new thread is reported via TRAP_LWP.
      
      Add a test that verifies that when the user does not have permissions
      to set watchpoints on NetBSD, the 'watchpoint set' errors out gracefully
      and thread monitoring does not crash on being unable to copy watchpoints
      to new threads.
      
      Differential Revision: https://reviews.llvm.org/D70023
      d970d4d4
    • Michał Górny's avatar
      [lldb] [Process/NetBSD] Improve threading support · 8d9400b6
      Michał Górny authored
      Implement major improvements to multithreaded program support.  Notably,
      support tracking new and exited threads, associate signals and events
      with correct threads and support controlling individual threads when
      resuming.
      
      Firstly, use PT_SET_EVENT_MASK to enable reporting of created and exited
      threads via SIGTRAP.  Handle TRAP_LWP events to keep track
      of the currently running threads.
      
      Secondly, update the signal (both generic and SIGTRAP) handling code
      to account for per-thread signals correctly.  Signals delivered
      to the whole process are reported on all threads, while per-thread
      signals and events are reported only to the specific thread.
      The remaining threads are marked as 'stopped with no reason'.  Note that
      NetBSD always stops all threads on debugger events.
      
      Thirdly, implement the ability to set every thread as running, stopped
      or single-stepping separately while continuing the process.  This also
      provides the ability to send a signal to the whole process or to one
      of its thread while resuming.
      
      Differential Revision: https://reviews.llvm.org/D70022
      8d9400b6
    • Shoaib Meenai's avatar
      [libcxx] Omit unneeded locale fallbacks on Android 21+ · d018b556
      Shoaib Meenai authored
      Android API level 21 and above have all these functions available, so we
      don't need to include our fallback definitions.
      
      Differential Revision: https://reviews.llvm.org/D69983
      d018b556
    • Michał Górny's avatar
      [lldb] [test] XFAIL ASAN tests on NetBSD · 6a7f6145
      Michał Górny authored
      6a7f6145
    • Craig Topper's avatar
      [TargetLowering] Merge ExpandChainLibCall with makeLibCall · d6ec6e4b
      Craig Topper authored
      I need to be able to drop an operand for STRICT_FP_ROUND handling on X86. Merging these functions gives me the ArrayRef interface that passes the return type, operands, and debugloc instead of the Node.
      
      Differential Revision: https://reviews.llvm.org/D70503
      d6ec6e4b
    • Sanjay Patel's avatar
      [InstCombine] remove shuffle mask canonicalization that creates undef elements · 35827164
      Sanjay Patel authored
      This is NFC-intended because SimplifyDemandedVectorElts() does the same
      transform later. As discussed in D70641, we may want to change that
      behavior, so we need to isolate where it happens.
      35827164
    • Dan Gohman's avatar
      [WebAssembly] Change the llvm-lto dir to use the LLVM Version · 872a53ef
      Dan Gohman authored
      Using the version instead of the VCS revision, which isn't available
      when LLVM_APPEND_VC_REV is set. The bitcode format should be
      backwards-compatible at least within a minor version, so the version
      string should be sufficient.
      
      Differential Revision: https://reviews.llvm.org/D70677
      872a53ef
    • Momchil Velikov's avatar
      [ARM] Generate CMSE instructions from CMSE intrinsics · 09555ce0
      Momchil Velikov authored
      This patch adds instruction selection patterns for the TT, TTT, TTA, and TTAT
      instructions and tests for llvm.arm.cmse.tt, llvm.arm.cmse.ttt,
      llvm.arm.cmse.tta, and llvm.arm.cmse.ttat intrinsics (added in a previous
      patch).
      
      Patch by Javed Absar.
      
      Differential Revision: https://reviews.llvm.org/D70407
      09555ce0
    • Jonas Paulsson's avatar
      [SystemZ] Return the right offsets from getCalleeSavedSpillSlots(). · a7d3f693
      Jonas Paulsson authored
      // Due to the SystemZ ABI, the DWARF CFA (Canonical Frame Address) is not
      // equal to the incoming stack pointer, but to incoming stack pointer plus
      // 160.  The getOffsetOfLocalArea() returned value is interpreted as "the
      // offset of the local area from the CFA".
      
      The immediate offsets into the Register save area returned by
      getCalleeSavedSpillSlots() should take this offset into account, which this
      patch makes sure of.
      
      Patch and review by Ulrich Weigand.
      https://reviews.llvm.org/D70427
      a7d3f693
    • Whitney Tsang's avatar
      [NFC][LoopFusion] Use isControlFlowEquivalent() from CodeMoverUtils. · aaf7f05a
      Whitney Tsang authored
      Reviewer: kbarton, jdoerfert, Meinersbur, bmahjour, etiotto
      Reviewed By: Meinersbur
      Subscribers: hiraditya, llvm-commits
      Tag: LLVM
      Differential Revision: https://reviews.llvm.org/D70619
      aaf7f05a
    • Nemanja Ivanovic's avatar
      [PowerPC] Fix VSX clobbers of CSR registers · 7fbaa809
      Nemanja Ivanovic authored
      If an inline asm statement clobbers a VSX register that overlaps with a
      callee-saved Altivec register or FPR, we will not record the clobber and will
      therefore violate the ABI. This is clearly a bug so this patch fixes it.
      
      Differential revision: https://reviews.llvm.org/D68576
      7fbaa809
    • Sanjay Patel's avatar
      [InstCombine] prevent infinite loop from conflicting shuffle mask transforms · e85d2e49
      Sanjay Patel authored
      The pattern in question is currently not possible because we
      aggressively (wrongly) transform mask elements to undef values
      if they choose from an undef operand. That, however, would
      change if we tighten our semantics for shuffles as discussed
      in D70641. Adding this check gives us the flexibility to make
      that change with minimal overhead for current definitions.
      e85d2e49
    • Kostya Kortchinsky's avatar
      [scudo][standalone] Fix for releaseToOS prior to init · 15664fe2
      Kostya Kortchinsky authored
      Summary:
      cferris@ found an issue where calling `releaseToOS` prior to any other
      heap operation would lead to a crash, due to the allocator not being
      properly initialized (it was discovered via `mallopt`).
      
      The fix is to call `initThreadMaybe` prior to calling `releaseToOS` for
      the Primary.
      
      Add a test that crashes prior to fix.
      
      Reviewers: hctim, cferris, pcc, eugenis
      
      Subscribers: #sanitizers, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D70552
      15664fe2
    • bmahjour's avatar
      [DDG] Data Dependence Graph - Topological Sort · bec37c3f
      bmahjour authored
      Summary:
      In this patch the DDG DAG is sorted topologically to put the
      nodes in the graph in the order that would satisfy all
      dependencies. This helps transformations that would like to
      generate code based on the DDG. Since the DDG is a DAG a
      reverse-post-order traversal would give us the topological
      ordering. This patch also sorts the basic blocks passed to
      the builder based on program order to ensure that the
      dependencies are computed in the correct direction.
      
      Authored By: bmahjour
      
      Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert
      
      Reviewed By: Meinersbur
      
      Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70609
      bec37c3f
    • Sanjay Patel's avatar
      [InstCombine] simplify code for shuffle mask canonicalization; NFC · fc31b58e
      Sanjay Patel authored
      We never use the local 'Mask' before returning, so that was dead code.
      fc31b58e
  2. Nov 25, 2019
    • Sanjay Patel's avatar
    • Sanjay Patel's avatar
    • Hans Wennborg's avatar
      Revert 3f91705c "ARM-NEON: make type modifiers orthogonal and allow multiple modifiers." · 21f26470
      Hans Wennborg authored
      This broke the vcreate_u64 intrinsic. Example:
      
        $ cat /tmp/a.cc
        #include <arm_neon.h>
      
        void g() {
          auto v = vcreate_u64(0);
        }
        $ bin/clang -c /tmp/a.cc --target=arm-linux-androideabi16 -march=armv7-a
        /tmp/a.cc:4:12: error: C-style cast from scalar 'int' to vector 'uint64x1_t' (vector of 1 'uint64_t' value) of different size
          auto v = vcreate_u64(0);
                   ^~~~~~~~~~~~~~
        /work/llvm.monorepo/build.release/lib/clang/10.0.0/include/arm_neon.h:4144:11: note: expanded from macro 'vcreate_u64'
          __ret = (uint64x1_t)(__p0); \
                  ^~~~~~~~~~~~~~~~~~
      
      Reverting until this can be investigated.
      
      > The modifier system used to mutate types on NEON intrinsic definitions had a
      > separate letter for all kinds of transformations that might be needed, and we
      > were quite quickly running out of letters to use. This patch converts to a much
      > smaller set of orthogonal modifiers that can be applied together to achieve the
      > desired effect.
      >
      > When merging with downstream it is likely to cause a conflict with any local
      > modifications to the .td files. There is a new script in
      > utils/convert_arm_neon.py that was used to convert all .td definitions and I
      > would suggest running it on the last downstream version of those files before
      > this commit rather than resolving conflicts manually.
      21f26470
    • Jay Foad's avatar
      [AMDGPU] Fix function name in debug output · 357bd914
      Jay Foad authored
      357bd914
    • jasonliu's avatar
      [AIX][XCOFF] Generate undefined symbol in symbol table for external function call · 906ecae2
      jasonliu authored
      Summary:
      This patch sets up the infrastructure for
      
       1. Associate MCSymbolXCOFF with an MCSectionXCOFF when it could not
          get implicitly associated.
       2. Generate undefined symbols. The patch itself generates undefined symbol
          for external function call only. Generate undefined symbol for external
          global variable and external function descriptors will be handled in
          separate patch(s) after this is land.
      
      Differential Revision: https://reviews.llvm.org/D70443
      906ecae2
    • Raphael Isemann's avatar
      [lldb][NFC] Allow range-based for-loops on VariableList · d1782133
      Raphael Isemann authored
      Summary:
      Adds support for doing range-based for-loops on LLDB's VariableList and
      modernises all the index-based for-loops in LLDB where possible.
      
      Reviewers: labath, jdoerfert
      
      Reviewed By: labath
      
      Subscribers: JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D70668
      d1782133
    • Jeremy Morse's avatar
      [DebugInfo] Avoid register coalesing unsoundly changing DBG_VALUE locations · d9c9a4e4
      Jeremy Morse authored
      This is a re-land of D56151 / r364515 with a completely new implementation.
      
      Once MIR code leaves SSA form and the liveness of a vreg is considered,
      DBG_VALUE insts are able to refer to non-live vregs, because their
      debug-uses do not contribute to liveness. This non-liveness becomes
      problematic for optimizations like register coalescing, as they can't
      ``see'' the debug uses in the liveness analyses.
      
      As a result registers get coalesced regardless of debug uses, and that can
      lead to invalid variable locations containing unexpected values. In the
      added test case, the first vreg operand of ADD32rr is merged with various
      copies of the vreg (great for performance), but a DBG_VALUE of the
      unmodified operand is blindly updated to the modified operand. This changes
      what value the variable will appear to have in a debugger.
      
      Fix this by changing any DBG_VALUE whose operand will be resurrected by
      register coalescing to be a $noreg DBG_VALUE, i.e. give the variable no
      location. This is an overapproximation as some coalesced locations are safe
      (others are not) -- an extra domination analysis would be required to work
      out which, and it would be better if we just don't generate non-live
      DBG_VALUEs.
      
      Differential Revision: https://reviews.llvm.org/D64630
      d9c9a4e4
    • Raphael Isemann's avatar
      [lldb] Remove lldb's own ASTDumper · 7a6588ab
      Raphael Isemann authored
      Summary:
      LLDB's ASTDumper is just a clone of Clang's ASTDumper but with some scary code and
      some unrelated functionality (like dumping name/attributes of types). This removes LLDB's ASTDumper
      and replaces its uses with the `ClangUtils::DumpDecl` method that just calls Clang's ASTDumper
      and returns the result as a string.
      
      The few uses where we just want a textual representation of a type (which will print their name/attributes but not
      dump any AST) are now also in ClangUtil under a `ToString` name until we find a better home for them.
      
      Reviewers: labath
      
      Reviewed By: labath
      
      Subscribers: mgorny, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D70663
      7a6588ab
    • Anna Welker's avatar
      [ARM][MVE] Select vqneg · 6fc3e6f2
      Anna Welker authored
      Adds a pattern to ARMInstrMVE.td to use a VQNEG
        instruction if an equivalent multi-instruction
        construct is found.
      
      Differential Revision: https://reviews.llvm.org/D70491
      6fc3e6f2
    • OCHyams's avatar
      [DebugInfo@O2][Utils] Undef instead of delete dbg.values in helper func · 2de23c83
      OCHyams authored
      Summary:
      Related bug: https://bugs.llvm.org/show_bug.cgi?id=40648
      
      Static helper function rewriteDebugUsers in Local.cpp deletes dbg.value
      intrinsics when it cannot move or rewrite them, or salvage the deleted
      instruction's value. It should instead undef them in this case.
      
      This patch fixes that and I've added a test which covers the failing test
      case in bz40648. I've updated the unit test Local.ReplaceAllDbgUsesWith
      to check for this behaviour (and fixed a typo in the test which would
      cause the old test to always pass).
      
      Reviewers: aprantl, vsk, djtodoro, probinson
      
      Reviewed By: vsk
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #debug-info, #llvm
      
      Differential Revision: https://reviews.llvm.org/D70604
      2de23c83
    • serge_sans_paille's avatar
      [AVR] Fix endianness handling in AVR MC · 29b4d8f1
      serge_sans_paille authored
      Differential Revision: https://reviews.llvm.org/D67926
      29b4d8f1
    • Georgii Rymar's avatar
      [yaml2obj/obj2yaml] - Add support for SHT_LLVM_DEPENDENT_LIBRARIES sections. · 9659464d
      Georgii Rymar authored
      This section contains strings specifying libraries to be added to the link by the linker.
      The strings are encoded as standard null-terminated UTF-8 strings.
      
      This patch adds a way to describe and dump SHT_LLVM_DEPENDENT_LIBRARIES sections.
      
      I introduced a new YAMLFlowString type here. That used to teach obj2yaml to dump
      them like:
      
      ```
      Libraries: [ foo, bar ]
      ```
      
      instead of the following (if StringRef would be used):
      
      ```
      Libraries:
        - foo
        - bar
      ```
      
      Differential revision: https://reviews.llvm.org/D70598
      9659464d
    • Kadir Cetinkaya's avatar
      [clangd] Fix diagnostic location for macro expansions · e841029a
      Kadir Cetinkaya authored
      Summary:
      Diagnostic locations were broken when it was result of a macro
      expansion. This patch fixes it by using expansion location instead of location
      inside macro body.
      
      Fixes https://github.com/clangd/clangd/issues/201.
      
      Reviewers: hokein
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D70494
      e841029a
    • Kadir Cetinkaya's avatar
      [clangd] Improve symbol qualification in DefineInline code action · 5075c682
      Kadir Cetinkaya authored
      Summary:
      Currently define inline action fully qualifies any names in the
      function body, which is not optimal and definitely natural.
      
      This patch tries to improve the situation by dropping any name
      specifiers shared by function and names spelled in the body. For example
      if you are moving definition of a function in namespace clang::clangd,
      and body has any decl's coming from clang or clang::clangd namespace,
      those qualifications won't be added since they are redundant.
      
      It also drops any qualifiers that are visible in target context.
      
      Reviewers: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69033
      5075c682
    • Kadir Cetinkaya's avatar
      [clangd] Helper for getting nested namespace qualification · 97d6e8e0
      Kadir Cetinkaya authored
      Summary:
      Introduce a new helper for getting minimally required qualifiers
      necessary to spell a name at a point in a given DeclContext. Currently takes
      using directives and nested namespecifier of DeclContext itself into account.
      
      Initially will be used in define inline and outline actions.
      
      Reviewers: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69608
      97d6e8e0
    • Pavel Labath's avatar
      [lldb-vscode] Fix a race in test_extra_launch_commands · aa16bf15
      Pavel Labath authored
      Summary:
      The test used a non-stopping "run" command to launch the process. This
      is different from the regular launch with no extra launch commands,
      which uses eLaunchFlagStopAtEntry to ensure that the process stops
      straight away.
      
      I'm not really sure what's supposed to happen in non-stop-at-entry mode,
      or if that's even supported, but what ended up happening was the launch
      packet got a reply while the process was running. Then the test case did
      a continue_to_next_stop(), which queued a *second* resume request
      (along with the internal "resumes" which were being issued as a part of
      normal process startup). These two resumes ended up chasing each other's
      tails inside lldb in a way which produced hilarious log traces.
      Surprisingly, the test ended up passing most of the time, but it did
      cause spurious failures when the test seemed to miss a breakpoint.
      
      This changes the test to use stop-at-entry mode in the manual launch
      sequence too, which seems to be enough to make the test pass reliably.
      
      Reviewers: clayborg, kusmour, jankratochvil
      
      Subscribers: lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D70127
      aa16bf15
    • QingShan Zhang's avatar
    • Craig Topper's avatar
    • czhengsz's avatar
      Revert "[PowerPC] combine rlwinm+rlwinm to rlwinm" · d1c16598
      czhengsz authored
      This reverts commit 29f6f9b2.
      d1c16598
    • Seiya Nuta's avatar
      [llvm-objcopy][MachO] Implement --dump-section · d72a8a4d
      Seiya Nuta authored
      Reviewers: alexshap, rupprecht, jhenderson
      
      Reviewed By: alexshap, rupprecht, jhenderson
      
      Subscribers: MaskRay, jakehehrlich, abrachet, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66408
      d72a8a4d
    • Petr Hosek's avatar
      [CMake] Use correct include path for InstrProfData.inc on Darwin · e8a4e589
      Petr Hosek authored
      On Darwin, part of the profile runtime is included in the builtin
      library. f35032e0 changed the location of InstrProfData.inc but the
      builtin build for Darwin hasn't been updated to include the new
      path which causes a breakage when building for Darwin. This change
      addresses this breakage.
      e8a4e589
    • Florian Hahn's avatar
      Recommit f0c2a5af "[LV] Generalize conditions for sinking instrs for first order recurrences." · 9d24933f
      Florian Hahn authored
      This version contains 2 fixes for reported issues:
      1. Make sure we do not try to sink terminator instructions.
      2. Make sure we bail out, if we try to sink an instruction that needs to
         stay in place for another recurrence.
      
      Original message:
      If the recurrence PHI node has a single user, we can sink any
      instruction without side effects, given that all users are dominated by
      the instruction computing the incoming value of the next iteration
      ('Previous'). We can sink instructions that may cause traps, because
      that only causes the trap to occur later, but not on any new paths.
      
      With the relaxed check, we also have to make sure that we do not have a
      direct cycle (meaning PHI user == 'Previous), which indicates a
      reduction relation, which potentially gets missed by
      ReductionDescriptor.
      
      As follow-ups, we can also sink stores, iff they do not alias with
      other instructions we move them across and we could also support sinking
      chains of instructions and multiple users of the PHI.
      
      Fixes PR43398.
      
      Reviewers: hsaito, dcaballe, Ayal, rengolin
      
      Reviewed By: Ayal
      
      Differential Revision: https://reviews.llvm.org/D69228
      9d24933f
    • Simon Atanasyan's avatar
      1de788a1
    • Florian Hahn's avatar
      [LoopInterchange] Adjust assertions when updating successors. · 9a432161
      Florian Hahn authored
      Currently the assertion in updateSuccessor is overly strict in some
      cases and overly relaxed in other cases. For branches to the inner and
      outer loop preheader it is too strict, because they can either be
      unconditional branches or conditional branches with duplicate targets.
      Both cases are fine and we can allow updating multiple successors.
      
      On the other hand, we have to at least update one successor. This patch
      adds such an assertion.
      9a432161