1. Jan 25, 2018
    • Rafael Espindola's avatar
      Use lookup instead of find. NFC, just simpler. · 9e333e97
      Rafael Espindola authored
      llvm-svn: 323395
      9e333e97
    • Aditya Nandakumar's avatar
      [GISel]: Fix modules build by including <cassert> · 7cff1908
      Aditya Nandakumar authored
      llvm-svn: 323394
      7cff1908
    • Lang Hames's avatar
    • Aditya Nandakumar's avatar
      [GISel]: Implement GlobalISel combiner API. · 81c81b64
      Aditya Nandakumar authored
      https://reviews.llvm.org/D41373
      
      The various components are
      
      GICombinerHelper contains transformations that are common to all
      targets. Targets can pick and choose which transformations (at
      function/opcode granularity) each pass uses via configuring a
      GICombinerInfo.
      
      GICombiner contains some common code and it does the traversal,
      driving of combines, worklist management and iterating until
      convergence.
      
      GICombinerInfo is an interface with a virtual method called combine.
      The combiner info will allow targets to pick and choose (or
      implement their own specific combines). CombineInfos can make
      use of available combines in GICombineHelper to configure the
      transformations for a particular pass. Currently this approach allows
      cherry picking transformations from helpers (at function/opcode
      granularity) and also allows early returning on specific
      transformations. Targets also get to prioritize whether target specific
      combines run before/after the opt-in generic combines. Ideally we would
      like this part to be configured by both C++ and Tablegen. The
      CombinerInfo also has a field which indicates how to deal with
      IllegalOps (ie - should we allow to create them/or legalize them?).
      
      A CombinerPass would configure a CombinerInfo, create the GICombiner
      with the Info, and call
      GICombiner::combineMachineInstrs(MachineFunction&).
      This organization is very similar to the GISelLegalizer.
      
      llvm-svn: 323392
      81c81b64
    • Volkan Keles's avatar
      [GlobalISel][TableGen] Fix the statistics for emitted patters · 4f3fa798
      Volkan Keles authored
      Collected statistics for the number of patterns emitted can be
      incorrect because rules can be grouped if OptimizeMatchTable
      is enabled. Increase the counter in RuleMatcher::emit(...)
      to avoid that.
      
      llvm-svn: 323391
      4f3fa798
    • Eric Fiselier's avatar
      Fix PR35564 - std::list splice/erase incorrectly throw in debug mode. · d053b597
      Eric Fiselier authored
      There was a bug in the implementation of splice where the container
      sizes were updated before decrementing one of the iterators. Afterwards,
      the result of decrementing the iterator was flagged as UB by the debug
      implementation because the container was reported to be empty.
      
      This patch fixes that bug by delaying the updating of the container
      sizes until after the iterators have been correctly constructed.
      
      llvm-svn: 323390
      d053b597
    • Eric Fiselier's avatar
      Fix missing return in __tuple_leaf::__can_bind_reference when... · b1539e0a
      Eric Fiselier authored
      Fix missing return in __tuple_leaf::__can_bind_reference when __reference_binds_to_temporary added in r323380.
      
      llvm-svn: 323389
      b1539e0a
    • Lang Hames's avatar
      [ORC] Add helpers for building orc::SymbolResolvers from legacy findSymbol-style · d78ba0d4
      Lang Hames authored
      functions/methods that return JITSymbols.
      
      lookupFlagsWithLegacyFn takes a SymbolNameSet and a legacy lookup function and
      returns a LookupFlagsResult. It uses the legacy lookup function to search for
      each symbol. If found, getFlags is called on the symbol and the flags added to
      the SymbolFlags map. If not found, the symbol is added to the SymbolsNotFound
      set.
      
      lookupWithLegacyFn takes an AsynchronousSymbolQuery, a SymbolNameSet and a
      legacy lookup function. Each symbol in the SymbolNameSet is searched for via the
      legacy lookup function. If it is found, its getAddress function is called
      (triggering materialization if it has not happened already) and the resulting
      mapping stored in the query. If it is not found the symbol is added to the
      unresolved symbols set which is returned at the end of the function. If an
      error occurs during legacy lookup or materialization it is passed to the
      query via setFailed and the function returns immediately.
      
      llvm-svn: 323388
      d78ba0d4
    • Kamil Rytarowski's avatar
      FreeBSD needs also execinfo (in sanitizers) · a7ef6a65
      Kamil Rytarowski authored
      Summary: As NetBSD, FreeBSD needs execinfo for backtrace's matters.
      
      Patch by: David CARLIER.
      
      Reviewers: joerg, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: emaste, krytarowski, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D42467
      
      llvm-svn: 323387
      a7ef6a65
    • Kostya Kortchinsky's avatar
      [scudo] Remove SANITIZER_LINUX requirement for the malloc interceptors · fc45e4a3
      Kostya Kortchinsky authored
      Summary:
      Currently all platforms are using the `scudo_interceptors.cpp` interceptors.
      
      We might to come up with platform specific interceptors when/if we get Apple &
      Windows, but as of now, that allows for Fuchsia to use them.
      
      `scudo_new_delete.cpp` didn't have the `#if SANITIZER_LINUX` so it's good to go.
      
      Reviewers: alekseyshl, flowerhack
      
      Reviewed By: flowerhack
      
      Subscribers: delcypher, #sanitizers, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D42506
      
      llvm-svn: 323386
      fc45e4a3
    • Marshall Clow's avatar
    • Amara Emerson's avatar
      [GlobalISel] Add a requires: asserts to a test. · 5ee03988
      Amara Emerson authored
      llvm-svn: 323384
      5ee03988
    • Benjamin Kramer's avatar
      [TableGen] Add a way of getting the number of generic opcodes without... · 4890a71f
      Benjamin Kramer authored
      [TableGen] Add a way of getting the number of generic opcodes without including modular CodeGen headers.
      
      This is a bit of a hack, but removes a cycle that broke modular builds
      of LLVM. Of course the cycle is still there in form of a dependency
      on the .def file.
      
      llvm-svn: 323383
      4890a71f
    • Alexander Shaposhnikov's avatar
      [analyzer] Do not attempt to get the pointee of void* · 0c352b15
      Alexander Shaposhnikov authored
      Do not attempt to get the pointee of void* while generating a bug report 
      (otherwise it will trigger an assert inside RegionStoreManager::getBinding 
      assert(!T->isVoidType() && "Attempting to dereference a void pointer!")).
      
      Test plan: make check-all
      
      Differential revision: https://reviews.llvm.org/D42396
      
      llvm-svn: 323382
      0c352b15
    • Brian Gesiak's avatar
      [coroutines] Pass coro func args to promise ctor · 61f4ac98
      Brian Gesiak authored
      Summary:
      Use corutine function arguments to initialize a promise type, but only
      if the promise type defines a constructor that takes those arguments.
      Otherwise, fall back to the default constructor.
      
      Test Plan: check-clang
      
      Reviewers: rsmith, GorNishanov, eric_niebler
      
      Reviewed By: GorNishanov
      
      Subscribers: toby-allsopp, lewissbaker, EricWF, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D41820
      
      llvm-svn: 323381
      61f4ac98
    • Eric Fiselier's avatar
      [libc++] Fix PR20855 -- libc++ incorrectly diagnoses illegal reference binding in std::tuple. · 292617e7
      Eric Fiselier authored
      Summary:
      See https://bugs.llvm.org/show_bug.cgi?id=20855
      
      Libc++ goes out of it's way to diagnose `std::tuple` constructions which are UB due to lifetime bugs caused by reference creation. For example:
      
      ```
      // The 'const std::string&' is created *inside* the tuple constructor, and its lifetime is over before the end of the constructor call.
      std::tuple<int, const std::string&> t(std::make_tuple(42, "abc"));
      ```
      
      However, we are over-aggressive and we incorrectly diagnose cases such as:
      
      ```
      void foo(std::tuple<int const&, int const&> const&);
      foo(std::make_tuple(42, 42));
      ```
      
      This patch fixes the incorrectly diagnosed cases, as well as converting the diagnostic to use the newly added Clang trait `__reference_binds_to_temporary`. The new trait allows us to diagnose cases we previously couldn't such as:
      
      ```
      std::tuple<int, const std::string&> t(42, "abc");
      ```
      
      Reviewers: rsmith, mclow.lists
      
      Reviewed By: rsmith
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D41977
      
      llvm-svn: 323380
      292617e7
    • Sam Clegg's avatar
      [WebAssembly] Don't duplicate functions in table output · 67abf539
      Sam Clegg authored
      Previously, we were ensuring that the "output index" for
      InputFunctions was unique across all symbols that referenced
      a function body, but allowing the same function body to have
      multiple table indexes.
      
      Now, we use the same mechanism for table indexes as we already
      do for output indexes, ensuring that each InputFunction is only
      placed in the table once.
      
      This makes the LLD output table denser and smaller, but should
      not change the behaviour.
      
      Note that we still need the `Symbol::TableIndex` member, to
      store the table index for function Symbols that don't have an
      InputFunction, i.e. for address-taken imports.
      
      Patch by Nicholas Wilson!
      
      Differential Revision: https://reviews.llvm.org/D42476
      
      llvm-svn: 323379
      67abf539
    • Sam Clegg's avatar
      [WebAssembly] Always start table index at 1, even for relocatable output · 48bbd63f
      Sam Clegg authored
      Previously llvm was using 0 as the first table index for wasm object
      files but now that has switched to 1 we can have the output of lld
      do the same and simplify the code.
      
      Patch by Nicholas Wilson!
      
      Differential Revision: https://reviews.llvm.org/D42096
      
      llvm-svn: 323378
      48bbd63f
    • Sanjay Patel's avatar
      [InstCombine] fix datalayout in test file · 60c13c77
      Sanjay Patel authored
      The only part of the datalayout that should matter for these tests
      is the part that specifies the legal int widths ('n*'). But there
      was a bug - that part of the string was not correctly separated with
      the expected '-' character, so we were testing as if there were no
      legal int widths at all. Removed the leading cruft so we have some 
      legal ints to test with.
      
      I noticed this while testing a potential change to the way we 
      transform shifts and sexts in D42424.
      
      llvm-svn: 323377
      60c13c77
    • Artem Dergachev's avatar
      [analyzer] NFC: Run many existing C++ tests with a custom operator new(). · d3c54313
      Artem Dergachev authored
      In order to provide more test coverage for inlined operator new(), add more
      run-lines to existing test cases, which would trigger our fake header
      to provide a body for operator new(). Most of the code should still behave
      reasonably. When behavior intentionally changes, #ifs are provided.
      
      Differential Revision: https://reviews.llvm.org/D42221
      
      llvm-svn: 323376
      d3c54313
    • Lang Hames's avatar
      [ORC] Add a LambdaSymbolResolver convenience class and docs for SymbolResolver. · 7f20eacf
      Lang Hames authored
      This patch adds a LambdaSymbolResolver convenience utility that can create an
      orc::SymbolResolver from a pair of function objects that supply the behavior for
      the lookupFlags and lookup methods.
      
      This class plays the same role for orc::SymbolResolver as the legacy
      LambdaResolver class plays for LegacyJITSymbolResolver, and will replace the
      latter class once all ORC APIs are migrated to orc::SymbolResolver.
      
      This patch also adds some documentation for the orc::SymbolResolver class as
      this was left out of the original commit.
      
      llvm-svn: 323375
      7f20eacf
    • Krzysztof Parzyszek's avatar
      [Hexagon] Replace EmitFunctionEntryCode with a DAG preprocessing code · 14f3ef1f
      Krzysztof Parzyszek authored
      The code in EmitFunctionEntryCode needs to know the maximum stack
      alignment, but it runs very early in the selection process (before
      lowering). The final stack alignment may change during lowering, so
      the code needs to be moved to where the alignment is known.
      
      llvm-svn: 323374
      14f3ef1f
    • Artem Dergachev's avatar
      [analyzer] Enable c++-allocator-inlining by default. · a396df34
      Artem Dergachev authored
      This allows the analyzer to analyze ("inline") custom operator new() calls and,
      even more importantly, inline constructors of objects that were allocated
      by any operator new() - not necessarily a custom one.
      
      All changes in the tests in the current commit are intended improvements,
      even if they didn't carry any explicit FIXME flag.
      
      It is possible to restore the old behavior via
      
        -analyzer-config c++-allocator-inlining=false
      
      (this flag is supported by scan-build as well, and it can be into a clang
      --analyze invocation via -Xclang .. -Xclang ..). There is no intention to
      remove the old behavior for now.
      
      Differential Revision: https://reviews.llvm.org/D42219
      rdar://problem/12180598
      
      llvm-svn: 323373
      a396df34
    • Daniel Sanders's avatar
      [globalisel] Fix long lines from r323342 · 538921dc
      Daniel Sanders authored
      They would be fixed in a later patch but they shouldn't have been introduced.
      
      llvm-svn: 323372
      538921dc
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Fall back during AArch64 isel if we have a volatile load. · 4f84f886
      Amara Emerson authored
      The tablegen imported patterns for sext(load(a)) don't check for single uses
      of the load or delete the original after matching. As a result two loads are
      left in the generated code. This particular issue will be fixed by adding
      support for a G_SEXTLOAD opcode in future.
      
      There are however other potential issues around this that wouldn't be fixed by
      a G_SEXTLOAD, so until we have a proper solution we don't try to handle volatile
      loads at all in the AArch64 selector.
      
      Fixes/works around PR36018.
      
      llvm-svn: 323371
      4f84f886
    • Artem Dergachev's avatar
      [analyzer] Assume that the allocated value is non-null before construction. · 50e0372f
      Artem Dergachev authored
      I.e. not after. In the c++-allocator-inlining=true mode, we need to make the
      assumption that the conservatively evaluated operator new() has returned a
      non-null value. Previously we did this on CXXNewExpr, but now we have to do that
      before calling the constructor, because some clever constructors are sometimes
      assuming that their "this" is null and doing weird stuff. We would also crash
      upon evaluating CXXNewExpr when the allocator was inlined and returned null and
      had a throw specification; this is UB even for custom allocators, but we still
      need not to crash.
      
      Added more FIXME tests to ensure that eventually we fix calling the constructor
      for null return values.
      
      Differential Revision: https://reviews.llvm.org/D42192
      
      llvm-svn: 323370
      50e0372f
    • Amara Emerson's avatar
      [GlobalISel] Don't fall back to FastISel. · f386e2b0
      Amara Emerson authored
      Apparently checking the pass structure isn't enough to ensure that we don't fall
      back to FastISel, as it's set up as part of the SelectionDAGISel.
      
      llvm-svn: 323369
      f386e2b0
    • Vassil Vassilev's avatar
      Revert r323051 "[cmake] Use CLANG_BINARY_DIR to determine the build directory." · e1515016
      Vassil Vassilev authored
      This broke swift builds.
      
      Thanks for the post-commit review of Chris Bieneman and Davide Italiano!
      
      llvm-svn: 323368
      e1515016
    • Simon Pilgrim's avatar
      [X86][SSE] Aggressively use PMADDWD for v4i32 multiplies with 17 or more leading zeros · 9f551ad6
      Simon Pilgrim authored
      As discussed in D41484, PMADDWD for 'zero extended' vXi32 is nearly always a better option than PMULLD:
      On SNB it will result in code that isn't any faster, but not any slower so we may as well keep it.
      On KNL it only has half the throughput, so I've disabled it on there - ideally there'd be a better way than this.
      
      Differential Revision: https://reviews.llvm.org/D42258
      
      llvm-svn: 323367
      9f551ad6
    • Rafael Espindola's avatar
      Fix lld crash introduced by r321154. · a9263c89
      Rafael Espindola authored
      Since SyntheticSection::getParent() may return null, dereferencing
      this pointer in ARMExidxSentinelSection::empty() call from
      removeUnusedSyntheticSections() results in crashes when linking ARM
      binaries.
      
      Patch by vit9696!
      
      llvm-svn: 323366
      a9263c89
    • Rafael Espindola's avatar
      Simplify. NFC. · 349fe0aa
      Rafael Espindola authored
      Thanks to Teresa Johnson for the suggestion.
      
      llvm-svn: 323365
      349fe0aa
    • Simon Pilgrim's avatar
      [X86][SSE] Add slow-pmulld attribute (silvermont-style) test · 21f17d40
      Simon Pilgrim authored
      Requested by @zvi on D42258
      
      llvm-svn: 323364
      21f17d40
    • Saleem Abdulrasool's avatar
      www: update lldb architecture doc · be86661c
      Saleem Abdulrasool authored
      ArchSpec was moved from Core to Utility, so I modified the docs to
      reflect that.
      
      Patch by Alex Langford <apl@fb.com>!
      
      llvm-svn: 323363
      be86661c
    • Peter Collingbourne's avatar
      IRGen: Emit an inline implementation of __builtin_wmemcmp on MSVCRT platforms. · 9e31f0a3
      Peter Collingbourne authored
      The MSVC runtime library does not provide a definition of wmemcmp,
      so we need an inline implementation.
      
      Differential Revision: https://reviews.llvm.org/D42441
      
      llvm-svn: 323362
      9e31f0a3
    • Rafael Espindola's avatar
      Don't create hidden dllimport global values. · 123ce97f
      Rafael Espindola authored
      Hidden visibility is almost the opposite of dllimport. We were
      producing them before (dllimport wins in the existing llvm
      implementation), but now the llvm verifier produces an error.
      
      llvm-svn: 323361
      123ce97f
    • Krzysztof Parzyszek's avatar
      7c2031fb
    • Alexey Bataev's avatar
      Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle." · 0affccc8
      Alexey Bataev authored
      This reverts commit r323348 because of the broken buildbots.
      
      llvm-svn: 323359
      0affccc8
    • Easwaran Raman's avatar
      Revert "[ThinLTO] Add call edges' relative block frequency to per-module summary." · bf38deef
      Easwaran Raman authored
      Causes buildbot regressions.
      
      llvm-svn: 323358
      bf38deef
    • Paul Robinson's avatar
      Fix up and document controlling ccache via CMake options. · 052f14ef
      Paul Robinson authored
      Patch by Matthew Davis!
      
      Differential Revision: https://reviews.llvm.org/D41757
      
      llvm-svn: 323357
      052f14ef
    • Geoff Berry's avatar
      [AMDGPU] Make sure all super regs of reserved regs are marked reserved. · c4796d47
      Geoff Berry authored
      Summary:
      Move reserveRegisterTuples into AMDGPURegisterInfo and use it in
      R600RegisterInfo::getReservedRegs and
      R600InstrInfo::reserveIndirectRegisters to ensure that all super
      registers of reserved registers are also marked as reserved.
      
      Before this change, under certain circumstances, the registers %t1_x and
      %t1_xyzw would be marked as reserved, but %t1_xy and %t1_xyz would not
      be, leading to the register allocator sometimes assigning a register to
      %t1_xy, which is invalid since %t1_x is reserved.
      
      Reviewers: arsenm, tstellar, MatzeB, qcolombet
      
      Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, mcrosier, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D42448
      
      llvm-svn: 323356
      c4796d47