1. Apr 30, 2019
    • Alexander Potapenko's avatar
      MSan: handle llvm.lifetime.start intrinsic · 06d00afa
      Alexander Potapenko authored
      Summary:
      When a variable goes into scope several times within a single function
      or when two variables from different scopes share a stack slot it may
      be incorrect to poison such scoped locals at the beginning of the
      function.
      In the former case it may lead to false negatives (see
      https://github.com/google/sanitizers/issues/590), in the latter - to
      incorrect reports (because only one origin remains on the stack).
      
      If Clang emits lifetime intrinsics for such scoped variables we insert
      code poisoning them after each call to llvm.lifetime.start().
      If for a certain intrinsic we fail to find a corresponding alloca, we
      fall back to poisoning allocas for the whole function, as it's now
      impossible to tell which alloca was missed.
      
      The new instrumentation may slow down hot loops containing local
      variables with lifetime intrinsics, so we allow disabling it with
      -mllvm -msan-handle-lifetime-intrinsics=false.
      
      Reviewers: eugenis, pcc
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60617
      
      llvm-svn: 359536
      06d00afa
    • Markus Lavin's avatar
      [DebugInfo] DW_OP_deref_size in PrologEpilogInserter. · a475da36
      Markus Lavin authored
      The PrologEpilogInserter need to insert a DW_OP_deref_size before
      prepending a memory location expression to an already implicit
      expression to avoid having the existing expression act on the memory
      address instead of the value behind it.
      
      The reason for using DW_OP_deref_size and not plain DW_OP_deref is that
      big-endian targets need to read the right size as simply truncating a
      larger read would yield the wrong result (LSB bytes are not at the lower
      address).
      
      This re-commit fixes issues reported in the first one. Namely deref was
      inserted under wrong conditions and additionally the deref_size argument
      was incorrectly encoded.
      
      Differential Revision: https://reviews.llvm.org/D59687
      
      llvm-svn: 359535
      a475da36
    • Eric Fiselier's avatar
      Update DemangleConfig.h to better mangle LLVM's version. · 2520530b
      Eric Fiselier authored
      There's no need for the demangling bits to depend on libc++ internals,
      in the same way they don't when compiled as part of LLVM.
      
      llvm-svn: 359534
      2520530b
    • Kang Zhang's avatar
      [NFC][PowerPC] Use -check-prefixes to simplify the check in code-align.ll · d43b66b3
      Kang Zhang authored
      Summary:
      When checking the same output, we can use the `-check-prefixes` to simplify the check.
      For example, if we want to check below output.
      ```
      ; GENERIC-LABEL: .globl  foo
      ; BASIC-LABEL: .globl  foo
      ; PWR-LABEL: .globl  foo
      ; GENERIC: .p2align  2
      ; BASIC: .p2align  4
      ; PWR: .p2align  4
      ; GENERIC: @foo
      ; BASIC: @foo
      ; PWR: @foo
      
      ```
      If we use `-check-prefixes`
      ```
      ... -check-prefixes=CHECK,GENERAL
      ... -check-prefixes=CHECK,BASIC
      ... -check-prefixes=CHECK,PWR
      ```
      Above check can be simplify to:
      ```
      ; CHECK-LABEL: .globl  foo
      ; GENERIC: .p2align  2
      ; BASIC: .p2align  4
      ; PWR: .p2align  4
      ; CHECK: @foo
      ```
      
      Reviewed By: hfinkel
      Differential Revision: https://reviews.llvm.org/D61227
      
      llvm-svn: 359533
      d43b66b3
    • Zi Xuan Wu's avatar
      [DAGCombiner] Do not generate ISD::ADDE node if adde is not legal for the... · 49d60fdc
      Zi Xuan Wu authored
      [DAGCombiner] Do not generate ISD::ADDE node if adde is not legal for the target when combine ISD::TRUNC node
      
      Do not combine (trunc adde(X, Y, Carry)) into (adde trunc(X), trunc(Y), Carry), 
      if adde is not legal for the target. Even it's at type-legalize phase. 
      Because adde is special and will not be legalized at operation-legalize phase later.
      
      This fixes: PR40922
      https://bugs.llvm.org/show_bug.cgi?id=40922
      
      Differential Revision: https://reviews.llvm.org//D60854
      
      llvm-svn: 359532
      49d60fdc
    • Artem Dergachev's avatar
      [analyzer] Treat functions without run-time branches as "small". · ab7747b7
      Artem Dergachev authored
      Currently we always inline functions that have no branches, i.e. have exactly
      three CFG blocks: ENTRY, some code, EXIT. This makes sense because when there
      are no branches, it means that there's no exponential complexity introduced
      by inlining such function. Such functions also don't trigger various fundamental
      problems with our inlining mechanism, such as the problem of inlined
      defensive checks.
      
      Sometimes the CFG may contain more blocks, but in practice it still has
      linear structure because all directions (except, at most, one) of all branches
      turned out to be unreachable. When this happens, still treat the function
      as "small". This is useful, in particular, for dealing with C++17 if constexpr.
      
      Differential Revision: https://reviews.llvm.org/D61051
      
      llvm-svn: 359531
      ab7747b7
    • Artem Dergachev's avatar
      [analyzer] SmartPtrModeling: Fix a null dereference. · eb71c0c9
      Artem Dergachev authored
      Don't crash when trying to model a call in which the callee is unknown
      in compile time, eg. a pointer-to-member call.
      
      Differential Revision: https://reviews.llvm.org/D61285
      
      llvm-svn: 359530
      eb71c0c9
    • Lang Hames's avatar
      [ORC] Fix an ambiguous call in a unit test. · baa55074
      Lang Hames authored
      llvm-svn: 359529
      baa55074
    • Aaron Smith's avatar
      [PECOFF] Implementation of ObjectFilePECOFF:: GetUUID() · b8d03935
      Aaron Smith authored
      Summary:
      Provide an implementation of GetUUID() for remote debugging scenarios.
      
      Return a PDB's GUID (or PDB70's Signature) as the UUID.
      
      Reviewers: amccarth, labath
      
      Reviewed By: labath
      
      Subscribers: amccarth, clayborg, Hui, labath, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D56229
      
      llvm-svn: 359528
      b8d03935
    • Vitaly Buka's avatar
      [clangd] Fix GN build · d1e87d41
      Vitaly Buka authored
      llvm-svn: 359527
      d1e87d41
    • Marshall Clow's avatar
      Implement LWG 2960: nonesuch is insufficiently useless · 39084db3
      Marshall Clow authored
      llvm-svn: 359526
      39084db3
    • Marshall Clow's avatar
      Mark LWG#2977 as 'Nothing to do'. NFC · fafbddc2
      Marshall Clow authored
      llvm-svn: 359525
      fafbddc2
    • JF Bastien's avatar
      [NFC] typo · ea51a8c1
      JF Bastien authored
      llvm-svn: 359524
      ea51a8c1
    • JF Bastien's avatar
      [NFC] typo · 0d702a7f
      JF Bastien authored
      llvm-svn: 359523
      0d702a7f
    • Don Hinton's avatar
      [CommandLine} Wire-up cl::list::setDefault() so it will work correctly with... · cabf1e22
      Don Hinton authored
      [CommandLine} Wire-up cl::list::setDefault() so it will work correctly with cl::ResetAllOptionOccurrences() in unittests.  Part 2 of 5
      
      Summary:
      With this change, cl::ResetAllOptionOccurrences() clears
      cl::list just like cl::opt, allowing users to call
      cl::ParseCommandLineOptions() multiple times without interference from
      previous calls.
      
      Reviewers: rnk
      
      Reviewed By: rnk
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61234
      
      llvm-svn: 359522
      cabf1e22
    • Lang Hames's avatar
      [ORC] Allow JITDylib definition generators to return Errors. · b1286723
      Lang Hames authored
      Background: A definition generator can be attached to a JITDylib to generate
      new definitions in response to queries. For example: a generator that forwards
      calls to dlsym can map symbols from a dynamic library into the JIT process on
      demand.
      
      If definition generation fails then the generator should be able to return an
      error. This allows the JIT API to distinguish between the case where a
      generator does not provide a definition, and the case where it was not able to
      determine whether it provided a definition due to an error.
      
      The immediate motivation for this is cross-process symbol lookups: If the
      remote-lookup generator is attached to a JITDylib early in the search list, and
      if a generator failure is misinterpreted as "no definition in this JITDylib" then
      lookup may continue and bind to a different definition in a later JITDylib, which
      is a bug.
      
      llvm-svn: 359521
      b1286723
    • David Bolvansky's avatar
      [PDB] Fixed null pointer dereference · 1a52eaf7
      David Bolvansky authored
      Reviewers: zturner, rnk
      
      Reviewed By: rnk
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61279
      
      llvm-svn: 359520
      1a52eaf7
    • Alina Sbirlea's avatar
      [MemorySSA] Invalidate MemorySSA if AA or DT are invalidated. · 9a1edd14
      Alina Sbirlea authored
      Summary:
      MemorySSA keeps internal pointers of AA and DT.
      If these get invalidated, so should MemorySSA.
      
      Reviewers: george.burgess.iv, chandlerc
      
      Subscribers: jlebar, Prazek, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61043
      
      llvm-svn: 359519
      9a1edd14
    • Nico Weber's avatar
      Add more lld release notes · 99bad370
      Nico Weber authored
      llvm-svn: 359518
      99bad370
    • Ahsan Saghir's avatar
      Add __builtin_dcbf support for PPC · 3962d6da
      Ahsan Saghir authored
      Summary:
      This patch adds support for __builtin_dcbf for PPC.
      
      __builtin_dcbf copies the contents of a modified block from the data cache
      to main memory and flushes the copy from the data cache.
      
      Differential revision: https://reviews.llvm.org/D59843
      
      llvm-svn: 359517
      3962d6da
    • David Bolvansky's avatar
      [Diagnostics] Support -Wtype-limits for GCC compatibility · efba22cb
      David Bolvansky authored
      Summary:
      GCC's  -Wtype-limits (part of -Wextra):
      Warn if a comparison is always true or always false due to the limited range of the data type
      
      Reviewers: rsmith, aaron.ballman, lebedev.ri, thakis
      
      Reviewed By: rsmith
      
      Subscribers: lebedev.ri, jdoerfert, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D58841
      
      llvm-svn: 359516
      efba22cb
    • Nico Weber's avatar
      [PDB] Fix hash function used to write /src/headerblock · e577be4e
      Nico Weber authored
      lld-link used to write PDB files that DIA couldn't recover natvis
      files from if:
      
      - The global strings table was > 64kiB
      - There were at least 3 natvis files
      
      The cause was that the hash function for the /src/headerblock stream
      was incorrect: It needs to be truncated to 16 bit.
      
      If the global strings table was <= 64kiB, truncating to 16 bit is a
      no-op, so this wasn't needed for small programs.
      
      If there are only 1 or 2 natvis files, then the growth strategy in
      HashTable::grow() would mean the hash table would have 2 buckets (for 1
      natvis file) or 4 buckets (for 4 natvis files), and since the hash
      function is used modulo number of buckets, and since 2 and 4 divide
      0x10000, the missing `% 0x10000` is a no-op there too. For 3 natvis
      files, the hash table grows to 6 buckets, which has a factor that's not
      common with 0x10000 and the difference starts to matter.
      
      Fixes PR41626.
      
      Differential Revision: https://reviews.llvm.org/D61277
      
      llvm-svn: 359515
      e577be4e
    • Nico Weber's avatar
      gn build: Merge r359252 · 8c474a38
      Nico Weber authored
      llvm-svn: 359514
      8c474a38
    • Reid Kleckner's avatar
      Re-land r359250, [COFF] Statically link certain runtime library functions · 1808c02c
      Reid Kleckner authored
      Reverts the revert of r359251, this time with fixed tests.
      
      Differential Revision: https://reviews.llvm.org/D55229
      
      llvm-svn: 359513
      1808c02c
    • Douglas Yung's avatar
      Make test more robust by writing stdout/stderr to different files. · 2ac6aca8
      Douglas Yung authored
      Our internal build bots were failing this test randomly as the stderr
      output was emitted to the file in the middle of the stdout output
      line that the test was checking.
      
      llvm-svn: 359512
      2ac6aca8
    • Lang Hames's avatar
      [ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities. · eb14dc75
      Lang Hames authored
      LLJITBuilder and LLLazyJITBuilder construct LLJIT and LLLazyJIT instances
      respectively. Over time these will allow more configurable options to be
      added while remaining easy to use in the default case, which for default
      in-process JITing is now:
      
      auto J = ExitOnErr(LLJITBuilder.create());
      
      llvm-svn: 359511
      eb14dc75
    • Lang Hames's avatar
      [JITLink] Move a typedef. · 6f3eeff7
      Lang Hames authored
      The FinalizeContinuation typedef belongs on the Allocation class, not the
      allocator.
      
      llvm-svn: 359510
      6f3eeff7
    • Dan Gohman's avatar
      [WebAssembly] Make an assertion message prettier. NFC. · 8d6e80f9
      Dan Gohman authored
      This is a follow-up to https://reviews.llvm.org/D59521.
      
      llvm-svn: 359509
      8d6e80f9
    • Steven Wu's avatar
      [ThinLTO] Adding architecture name into saved object filename · 6c9f6fd1
      Steven Wu authored
      Summary:
      For ThinLTOCodegenerator, it has an option to save the object file
      outputs into a directory which is essential for debug info. Tools like lldb
      and dsymutil will look for these object files for debug info.
      
      On Darwin platform, you can link fat binaries with one single clang
      driver invocation like:
       $ clang -arch x86_64 -arch i386 -Wl,-object_path_lto,$TMPDIR ...
      Unfornately, the output object files for one architecture is going to
      overwrite the previous ones and one architecture slice will end up with
      no debug info. One example for this is to turn on ThinLTO for sanitizer
      dylibs in compiler-rt project.
      
      To fix the issue, add the name for the architecture into the name of the
      output object file.
      
      rdar://problem/35482935
      
      Reviewers: tejohnson, bd1976llvm, dexonsmith, JDevlieghere
      
      Reviewed By: dexonsmith
      
      Subscribers: mehdi_amini, aprantl, inglorion, eraman, hiraditya, jkorous, dang, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60924
      
      llvm-svn: 359508
      6c9f6fd1
    • Reid Kleckner's avatar
      Simplify exclusion of nested classes from extern template instantiation, NFC · 5f789baf
      Reid Kleckner authored
      Summary:
      This simplifies three checks for MS ABI, Win Itanium, or Win GNU to just
      "is Windows".
      
      The question remains, however, if this is really the correct thing to
      do. We could, for example, only not consider inner classes to be
      externally available if the outer class has a dllexport annotation.
      However, I will leave that as future work.
      
      Reviewers: hans, mstorsjo
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D61278
      
      llvm-svn: 359507
      5f789baf
    • Mike Rice's avatar
      When skipping code at the start of a file during PCH use, Preprocessor::Lex · 5550aa00
      Mike Rice authored
      is not used since it consumes all preprocessor directives until it returns
      a real token. Using the specific Lexer (i.e. CurLexer->Lex) makes it
      possible to stop skipping after an #include or #pragma hdrstop. Previously
      the skipping code was only handling CurLexer, now all will be handled
      correctly.
      
      Fixes: llvm.org/PR41585
      
      Differential Revision: https://reviews.llvm.org/D61217
      
      llvm-svn: 359506
      5550aa00
    • Dan Gohman's avatar
      [WebAssembly] Define the signature for __stack_chk_fail · 8306cb57
      Dan Gohman authored
      The WebAssembly backend needs to know the signatures of all runtime
      libcall functions. This adds the signature for __stack_chk_fail which was
      previously missing.
      
      Also, make the error message for a missing libcall include the name of
      the function.
      
      Differential Revision: https://reviews.llvm.org/D59521
      
      Reviewed By: sbc100
      
      llvm-svn: 359505
      8306cb57
    • Roland Froese's avatar
      [PowerPC] Try harder to avoid load/move-to VSR for partial vector loads · 728e1397
      Roland Froese authored
      Change the PPCISelLowering.cpp function that decides to avoid update form in
      favor of partial vector loads to know about newer load types and to not be
      confused by the chain operand.
      
      Differential Revision: https://reviews.llvm.org/D60102
      
      llvm-svn: 359504
      728e1397
    • Jonas Devlieghere's avatar
      [lit] Check for the psutil module when setting a timeout · 58b16632
      Jonas Devlieghere authored
      Apparently setting the per-test-timeout and not having the psutil
      package constitutes to a fatal error. So only set the timeout when the
      module is available.
      
      llvm-svn: 359503
      58b16632
    • Raphael Isemann's avatar
      [ASTImporter] Add an ImportImpl method to allow customizing Import behavior. · e9bc35fe
      Raphael Isemann authored
      Summary:
      We are currently implementing support in LLDB that reconstructs the STL templates from
      the target program in the expression evaluator. This reconstruction happens during the
      import process from our debug info AST into the expression evaluation AST, which means
      we need a way to intercept the ASTImporter import process.
      
      This patch adds an protected ImportImpl method that we can overwrite in LLDB to implement
      our special importing logic (which is essentially just looking into a C++ module that is attached to
      the target context). Because ImportImpl has to call MapImported/AddToLookup for the decls it
      creates, this patch also exposes those via a new unified method and checks that we call it when
      importing decls.
      
      Reviewers: martong, balazske, a.sidorin, shafik, a_sidorin
      
      Reviewed By: martong, a_sidorin
      
      Subscribers: rnkovacs, cfe-commits, lldb-commits, aprantl
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D59485
      
      llvm-svn: 359502
      e9bc35fe
    • Jessica Paquette's avatar
      [GlobalISel][AArch64] Select llvm.aarch64.crypto.sha1h · 7f6fe7c0
      Jessica Paquette authored
      This was falling back and gives us a reason to create a selectIntrinsic function
      which we would need eventually anyway. Update arm64-crypto.ll to show that we
      correctly select it.
      
      Also factor out the code for finding an intrinsic ID.
      
      llvm-svn: 359501
      7f6fe7c0
    • Reid Kleckner's avatar
      Fix FIXME added in r359339 · bb92282b
      Reid Kleckner authored
      We have windows.h in asan_win.cc, so we can just use the correct
      prototypes for these EH-related interceptors without worrying.
      
      Also fix an unused variable warning while I'm here.
      
      llvm-svn: 359500
      bb92282b
    • Reid Kleckner's avatar
      Pacify sanitizer lint script after r359498 · c69cd304
      Reid Kleckner authored
      llvm-svn: 359499
      c69cd304
    • Matthew G McGovern's avatar
      [AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in asan_malloc_win.cc · d62416df
      Matthew G McGovern authored
      HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user.
      
      _recalloc previously did not zero new memory after reallocation.
      https://reviews.llvm.org/D61268
      
      llvm-svn: 359498
      d62416df
    • Martin Storsjo's avatar
      [UpdateTestChecks] Allow Lbegin_func without a leading period · 6da0989c
      Martin Storsjo authored
      On mingw/i686, local labels don't start with a leading period.
      
      Also escape the leading period, as it previously could match
      any char.
      
      Differential Revision: https://reviews.llvm.org/D61254
      
      llvm-svn: 359497
      6da0989c