1. Dec 21, 2019
    • Michael Trent's avatar
      Constrain the macho-stabs test added in f72d001e to run on systems... · b4dfa74a
      Michael Trent authored
      Constrain the macho-stabs test added in f72d001e to run on systems configured with an x86 backend.
      
      Summary: This fixes a failure on the Builder clang-cmake-armv7-quick bot.
      
      Reviewers: lhames, jhenderson
      
      Reviewed By: lhames
      
      Subscribers: kristof.beyls, rupprecht, seiya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71792
      b4dfa74a
    • Philip Reames's avatar
      Add a set of tests with basic coverage of the recently added boundary align feature. · dcda6be7
      Philip Reames authored
      There are tests in the included patch, but the duplication is non obvious, so I'm starting with basic coverage beore cleaning up a few of them
      dcda6be7
    • Peter Collingbourne's avatar
      gn build: Silence mismatched-new-delete warning in scudo C++ wrapper tests. · 71b26f1d
      Peter Collingbourne authored
      These tests are deliberately mismatching new and delete, so the warnings
      are just noise.
      
      Differential Revision: https://reviews.llvm.org/D71783
      71b26f1d
    • Jessica Paquette's avatar
      [NFC][MachineOutliner] Rewrite setSuffixIndices to be iterative · d5750770
      Jessica Paquette authored
      Having this function be recursive could use up way too much stack space.
      
      Rewrite it as an iterative traversal in the tree instead to prevent this.
      
      Fixes PR44344.
      d5750770
    • Craig Topper's avatar
      [X86] Add test cases for missing propagation of fpexcept flag on strict fp operations. NFC · 07815fc1
      Craig Topper authored
      The flag is being lost during type legalization or lowering. This
      covers some of the cases. I'm sure there are many missing.
      07815fc1
    • Petr Hosek's avatar
      [llvm-symbolizer] Prefix invocations in test with env · 581a7d0e
      Petr Hosek authored
      This addresses an issue introduced in dedad08e and is needed to make
      sure this test works properly on Windows.
      581a7d0e
    • Jonas Devlieghere's avatar
      Revert "[lldb/CMake] Change how we deal with optional dependencies" · fe86289b
      Jonas Devlieghere authored
      This is failing on both the Windows and Debian bot.
      fe86289b
    • Vedant Kumar's avatar
      [DWARF] Defer creating declaration DIEs until we prepare call site info · fa4701e1
      Vedant Kumar authored
      It isn't necessary to create DIEs for all of the declaration subprograms
      in a CU's retainedTypes list. We can defer creating these subprograms
      until we need to prepare a call site tag that refers to one.
      
      This cleanup was mentioned in passing in D70350.
      fa4701e1
    • Vedant Kumar's avatar
      Reland: [DWARF] Allow cross-CU references of subprogram definitions · 79daafc9
      Vedant Kumar authored
      This allows a call site tag in CU A to reference a callee DIE in CU B
      without resorting to creating an incomplete duplicate DIE for the callee
      inside of CU A.
      
      We already allow cross-CU references of subprogram declarations, so it
      doesn't seem like definitions ought to be special.
      
      This improves entry value evaluation and tail call frame synthesis in
      the LTO setting. During LTO, it's common for cross-module inlining to
      produce a call in some CU A where the callee resides in a different CU,
      and there is no declaration subprogram for the callee anywhere. In this
      case llvm would (unnecessarily, I think) emit an empty DW_TAG_subprogram
      in order to fill in the call site tag. That empty 'definition' defeats
      entry value evaluation etc., because the debugger can't figure out what
      it means.
      
      As a follow-up, maybe we could add a DWARF verifier check that a
      DW_TAG_subprogram at least has a DW_AT_name attribute.
      
      Update:
      
      Reland with a fix to create a declaration DIE when the declaration is
      missing from the CU's retainedTypes list. The declaration is left out
      of the retainedTypes list in two cases:
      
      1) Re-compiling pre-r266445 bitcode (in which declarations weren't added
         to the retainedTypes list), and
      2) Doing LTO function importing (which doesn't update the retainedTypes
         list).
      
      It's possible to handle (1) and (2) by modifying the retainedTypes list
      (in AutoUpgrade, or in the LTO importing logic resp.), but I don't see
      an advantage to doing it this way, as it would cause more DWARF to be
      emitted compared to creating the declaration DIEs lazily.
      
      Tested with a stage2 ThinLTO+RelWithDebInfo build of clang, and with a
      ReleaseLTO-g build of the test suite.
      
      rdar://46577651, rdar://57855316, rdar://57840415
      
      Differential Revision: https://reviews.llvm.org/D70350
      79daafc9
    • Michael Trent's avatar
      llvm-objdump should ignore Mach-O stab symbols for disassembly. · f72d001e
      Michael Trent authored
      Summary:
      llvm-objdump will commonly error out when disassembling a Mach-O binary with
      stab symbols, or when printing a Mach-O symbol table that includesstab symbols.
      That is because the Mach-O N_OSO symbol has been modified to include the
      bottom 8-bit value of the Mach-O's cpusubtype value in the section field. In
      general, one cannot blindly assume a stab symbol's section field is valid
      unless one has actually consulted the specification for the specific stab.
      
      Since objdump mostly just walks the symbol table to get mnemonics for code
      disassembly it's best for objdump to just ignore stab symbols. llvm-nm will
      do a more complete and correct job of displaying Mach-O symbol table contents.
      
      Reviewers: pete, lhames, ab, thegameg, jhenderson, MaskRay
      
      Reviewed By: thegameg, MaskRay
      
      Subscribers: MaskRay, rupprecht, seiya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71394
      f72d001e
    • Yury Delendik's avatar
      [WebAssembly] Use TargetIndex operands in DbgValue to track WebAssembly operands locations · adf7a0a5
      Yury Delendik authored
      Extends DWARF expression language to express locals/globals locations. (via
      target-index operands atm) (possible variants are: non-virtual registers
      or address spaces)
      
      The WebAssemblyExplicitLocals can replace virtual registers to targertindex
      operand type at the time when WebAssembly backend introduces
      {get,set,tee}_local instead of corresponding virtual registers.
      
      Reviewed By: aprantl, dschuff
      
      Tags: #debug-info, #llvm
      
      Differential Revision: https://reviews.llvm.org/D52634
      adf7a0a5
    • Sam Clegg's avatar
      Fix name of InitLibcalls() function in comment · 538b485c
      Sam Clegg authored
      Differential Revision: https://reviews.llvm.org/D71781
      538b485c
    • Jim Ingham's avatar
    • Jonas Devlieghere's avatar
      [lldb/CMake] Change how we deal with optional dependencies · 41d7c227
      Jonas Devlieghere authored
      Recently there has been some discussion about how we deal with optional
      dependencies in LLDB. The approach in LLVM is to make things work out of
      the box. If the dependency isn't there, we move on silently.
      
      That's not true for LLDB. Unless you explicitly disable the dependency
      with LLDB_ENABLE_*, you'll get a configuration-time error. The
      historical reason for this is that LLDB's dependencies have a much
      broader impact, think about Python for example which is required to run
      the test suite.
      
      The current approach can be frustrating from a user experience
      perspective. Sometimes you just want to ensure LLDB builds with a change
      in clang.
      
      This patch changes the optional dependencies (with the exception of
      Python) to a new scheme. The LLDB_ENABLE_* now takes three values: On,
      Off or Auto, with the latter being the default. On and Off behave the
      same as today, forcing the dependency to be enabled or disabled. If the
      dependency is set to On but is not found, it results in a configuration
      time warning. For Auto we detect if the dependency is there and either
      enable or disable it depending on whether it's found.
      
      Differential revision: https://reviews.llvm.org/D71306
      
      PS: The reason Python isn't included yet is because it's so pervasive
      that I plan on doing that in a separate patch.
      41d7c227
    • Julian Lettner's avatar
      [iOS sim] Ensure simulator device is booted in iossim_prepare.py · d1783db9
      Julian Lettner authored
      Recent versions of the iOS simulator require that a "simulator device"
      is booted before we can use `simctl spawn` (see iossim_run.py) to start
      processes.
      
      We can use `simctl bootstatus` to ensure that the simulator device
      is booted before we run any tests via lit.  The `-b` option starts the
      device if necessary.
      
      Reviewed By: delcypher
      
      Differential Revision: https://reviews.llvm.org/D71449
      d1783db9
    • Stephen Kelly's avatar
      Revert "Customize simplified dumping and matching of LambdaExpr" · 0378f3a9
      Stephen Kelly authored
      This reverts commit 494b1318.
      0378f3a9
    • Jakub Kuderski's avatar
      [InstCombine] Improve infinite loop detection · c431c407
      Jakub Kuderski authored
      Summary:
      This patch limits the default number of iterations performed by InstCombine. It also exposes a new option that allows to specify how many iterations is considered getting stuck in an infinite loop.
      
      Based on experiments performed on real-world C++ programs, InstCombine seems to perform at most ~8-20 iterations, so treating 1000 iterations as an infinite loop seems like a safe choice. See D71145 for details.
      
      The two limits can be specified via command line options.
      
      Reviewers: spatel, lebedev.ri, nikic, xbolva00, grosser
      
      Reviewed By: spatel
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71673
      c431c407
    • Stephen Kelly's avatar
      Customize simplified dumping and matching of LambdaExpr · 494b1318
      Stephen Kelly authored
      Reviewers: aaron.ballman
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71680
      494b1318
    • Adrian Prantl's avatar
      Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot · 44b4b833
      Adrian Prantl authored
      This is a purely cosmetic change that is NFC in terms of the binary
      output. I bugs me that I called the attribute DW_AT_LLVM_isysroot
      since the "i" is an artifact of GCC command line option syntax
      (-isysroot is in the category of -i options) and doesn't carry any
      useful information otherwise.
      
      This attribute only appears in Clang module debug info.
      
      Differential Revision: https://reviews.llvm.org/D71722
      44b4b833
    • Michał Górny's avatar
    • Kostya Kortchinsky's avatar
      [scudo][standalone] Support __BIONIC__ · 0fd6f190
      Kostya Kortchinsky authored
      Summary:
      Some Android builds that we are interested in define `__BIONIC__`
      but not `__ANDROID__`, so expand `SCUDO_ANDROID` to encompass those.
      
      Reviewers: cferris, hctim, pcc, eugenis, morehouse
      
      Subscribers: krytarowski, #sanitizers, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D71772
      0fd6f190
    • Bill Wendling's avatar
      Add parentheses to silence warning · dc03b960
      Bill Wendling authored
      dc03b960
    • Petr Hosek's avatar
      [llvm-symbolizer] Support reading options from environment · dedad08e
      Petr Hosek authored
      llvm-symbolizer is used by sanitizers to symbolize errors discovered by
      sanitizer, but there's no way to pass options to llvm-symbolizer since
      the tool is invoked directly by the sanitizer runtime. Therefore, we
      don't have a way to pass options needed to find debug symbols such as
      -dsym-hint or -debug-file-directory. This change enables reading options
      from the LLVM_SYMBOLIZER_OPTS in addition to command line which can be
      used to pass those additional options to llvm-symbolizer invocations
      made by sanitizer runtime.
      
      Differential Revision: https://reviews.llvm.org/D71668
      dedad08e
    • Evgenii Stepanov's avatar
      [msan] Check qsort input. · ddf897fc
      Evgenii Stepanov authored
      Summary:
      Qsort interceptor suppresses all checks by unpoisoning the data in the
      wrapper of a comparator function, and then unpoisoning the output array
      as well.
      
      This change adds an explicit run of the comparator on all elements of
      the input array to catch any sanitizer bugs.
      
      Reviewers: vitalybuka
      
      Subscribers: #sanitizers, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D71780
      ddf897fc
    • Gabor Horvath's avatar
      59878ec8
    • LLVM GN Syncbot's avatar
      [gn build] Port 82923c71 · 226a0140
      LLVM GN Syncbot authored
      226a0140
    • Gabor Horvath's avatar
      [analyzer] Add Fuchsia Handle checker · 82923c71
      Gabor Horvath authored
      The checker can diagnose handle use after releases, double releases, and
      handle leaks.
      
      Differential Revision: https://reviews.llvm.org/D70470
      82923c71
    • Evgenii Stepanov's avatar
      [msan] Intercept qsort, qsort_r. · 07861e95
      Evgenii Stepanov authored
      Summary:
      This fixes qsort-related false positives with glibc-2.27.
      I'm not entirely sure why they did not show up with the earlier
      versions; the code seems similar enough.
      
      Reviewers: vitalybuka
      
      Subscribers: #sanitizers, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D71740
      07861e95
    • Philip Reames's avatar
      More style cleanups following rG14fc20ca [NFC] · c148e2e2
      Philip Reames authored
      Demote member functions to static functions where possible
      Use early continue/early return to reduce nesting
      Clarify comments slightly.
      Reuse previously define expression in one case.
      c148e2e2
    • Sid Manning's avatar
      Avoid unsupported LLD options · d567b0ba
      Sid Manning authored
      Differential Revision: https://reviews.llvm.org/D70919
      d567b0ba
    • Philip Reames's avatar
      Fix a memory leak introduced w/the instruction padding support in rG14fc20ca · 4024d49e
      Philip Reames authored
      Should have caught this in review, but only noticed when addressing post commit style items.  We were creating a new instance of the X86MCInstrInfo class, and then never reclaiming the memory.  This wasn't even conditional on the new off by default flags, so it was an unconditional leak.
      4024d49e
    • Philip Reames's avatar
      Comment and adjust style in the newly introduced MCBoundaryAlignFragment... · 8b725f04
      Philip Reames authored
      Comment and adjust style in the newly introduced MCBoundaryAlignFragment infrastructure.  More to follow.
      8b725f04
    • Gabor Horvath's avatar
      [attributes][analyzer] Add annotations for handles. · fe17b30a
      Gabor Horvath authored
      These annotations will be used in an upcomming static analyzer check
      that finds handle leaks, use after releases, and double releases.
      
      Differential Revision: https://reviews.llvm.org/D70469
      fe17b30a
    • Kamlesh Kumar's avatar
    • Philip Reames's avatar
      Align branches within 32-Byte boundary (NOP padding) · 14fc20ca
      Philip Reames authored
      WARNING: If you're looking at this patch because you're looking for a full
      performace mitigation of the Intel JCC Erratum, this is not it!
      
      This is a preliminary patch on the patch towards mitigating the performance
      regressions caused by Intel's microcode update for Jump Conditional Code
      Erratum.  For context, see:
      https://www.intel.com/content/www/us/en/support/articles/000055650.html
      
      The patch adds the required assembler infrastructure and command line options
      needed to exercise the logic for INTERNAL TESTING.  These are NOT public flags,
      and should not be used for anything other than LLVM's own testing/debugging
      purposes.  They are likely to change both in spelling and meaning.
      
      WARNING: This patch is knowingly incorrect in some cornercases.  We need, and
      do not yet provide, a mechanism to selective enable/disable the padding.
      Conversation on this will continue in parellel with work on extending this
      infrastructure to support prefix padding.
      
      The goal here is to have the assembler align specific instructions such that
      they neither cross or end at a 32 byte boundary.  The impacted instructions are:
      a. Conditional jump.
      b. Fused conditional jump.
      c. Unconditional jump.
      d. Indirect jump.
      e. Ret.
      f. Call.
      
      The new options for llvm-mc are:
          -x86-align-branch-boundary=NUM aligns branches within NUM byte boundary.
          -x86-align-branch=TYPE[+TYPE...] specifies types of branches to align.
      
      A new MCFragment type, MCBoundaryAlignFragment, is added, which may emit
      NOP to align the fused/unfused branch.
      
      alignBranchesBegin inserts MCBoundaryAlignFragment before instructions,
      alignBranchesEnd marks the end of the branch to be aligned,
      relaxBoundaryAlign grows or shrinks sizes of NOP to align the target branch.
      
      Nop padding is disabled when the instruction may be rewritten by the linker,
      such as TLS Call.
      
      Process Note: I am landing a patch by skan as it has been LGTMed, and
      continuing to iterate on the review is simply slowing us down at this point.
      We can and will continue to iterate in tree.
      
      Patch By: skan
      Differential Revision: https://reviews.llvm.org/D70157
      14fc20ca
    • Dan Liew's avatar
      [NFC][Driver] Add dummy compiler-rt sanitizer dylibs for Darwin. · 03512b26
      Dan Liew authored
      This adds dummy files to the test resource directory used by the Clang
      driver tests.
      
      rdar://problem/58118584
      03512b26
    • Fangrui Song's avatar
      [PPC32] Emit R_PPC_PLTREL24 for calls to dso_local ifunc · e8054f09
      Fangrui Song authored
        static void *ifunc(void) __attribute__((ifunc("resolver")));
        void foo() { ifunc(); }
      
      The relocation produced by the ifunc() call:
      
      1. gcc -msecure-plt -fPIC => R_PPC_PLTREL24 r_addend=0x8000
      2. gcc -msecure-plt -PIE => R_PPC_PLTREL24 r_addend=0x8000
      3. clang -msecure-plt -fPIC => R_PPC_PLTREL24 r_addend=0x8000
      4. clang -msecure-plt -fPIE => R_PPC_REL24
      
      4 is incorrect. The R_PPC_REL24 needs a call stub due to ifunc. If this
      relocation is mixed with other R_PPC_PLTREL24(r_addend=0x8000) in a
      function, both GNU ld and lld (after D71621 fix) may produce a wrong
      result.
      
      This patch fixes 4 to use R_PPC_PLTREL24, which matches GCC.
      Both GNU ld and lld (after D71621) will be happy.
      
      Reviewed By: sfertile
      
      Differential Revision: https://reviews.llvm.org/D71649
      e8054f09
    • Craig Topper's avatar
      [X86] Fix a KNL miscompile caused by combineSetCC swapping LHS/RHS variables before a later use. · de2378b4
      Craig Topper authored
      The setcc operands are copied into LHS and RHS variables at the top of the function. We also capture the condition code.
      
      A later piece of code swaps the operands and changing the CC variable as part of a canonicalization to make some other checks simpler. But we might not make the transform we canonicalized for. So we continue on through the function where we can use the swapped LHS/RHS variables and access the original condition code operand instead of the modified CC variable. This leads to a setcc being created with the original condition code, but with swapped operands.
      
      To mitigate this, this patch does a couple things. The LHS/RHS/CC variables are made const to keep them from being modified like this again. The transform that needs the swap now uses temporary copies of the variables. And the transform that used the original condition code operand has been altered to use the CC variable we cached originally. Either of these changes are enough to fix the issue, but doing both to make this code very safe.
      
      I also considered rewriting the swap code in some way to check both permutations without explicitly swapping or needing temporary variables, but held off on that.
      
      Differential Revision: https://reviews.llvm.org/D71736
      de2378b4
    • Jonas Devlieghere's avatar
      [lldb/Lua] Implement a Simple Lua Script Interpreter Prototype · 28613242
      Jonas Devlieghere authored
      This implements a very elementary Lua script interpreter. It supports
      running a single command as well as running interactively. It uses
      editline if available. It's still missing a bunch of stuff though. Some
      things that I intentionally ingored for now are that I/O isn't properly
      hooked up (so every print goes to stdout) and the non-editline support
      which is not handling a bunch of corner cases. The latter is a matter of
      reusing existing code in the Python interpreter.
      
      Discussion on the mailing list:
      http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html
      
      Differential revision: https://reviews.llvm.org/D71234
      28613242
    • Jim Ingham's avatar
      In 'thread step-out' command, only insert a breakpoint in executable memory. · 2a42a5a2
      Jim Ingham authored
      Previously, if the current function had a nonstandard stack layout/ABI, and had a valid
      data pointer in the location where the return address is usually located, data corruption
      would occur when the breakpoint was written. This could lead to an incorrectly reported
      crash or silent corruption of the program's state. Now, if the above check fails, the command safely aborts.
      
      Differential Revision: https://reviews.llvm.org/D71372
      2a42a5a2