1. Jan 25, 2018
    • Eugene Leviant's avatar
      [IRMover] Add comment and fix test case · 41e45955
      Eugene Leviant authored
      llvm-svn: 323407
      41e45955
    • Craig Topper's avatar
      [X86] Expand IMUL/MUL instregexs in Intel scheduler models. Add load latency... · b369cdba
      Craig Topper authored
      [X86] Expand IMUL/MUL instregexs in Intel scheduler models. Add load latency to some of them in SkylakeClient model.
      
      The regular expressions and the imul names caused some instructions to be matched by multiple regexs creating unpredictable results.
      
      This changes them all to use explicit instrs instead.
      
      While doing this I also found that some instructions in Skylake were missing load latency so I fixed that too.
      
      llvm-svn: 323406
      b369cdba
    • Craig Topper's avatar
      [X86] Expand IMUL/MUL instregexs in Znver1 scheduler to show what's actually implemented. · 795b17f4
      Craig Topper authored
      The IMUL instruction names mixed with the prefix matching of the instregex lead to some strange matches. The worst being that several memory instructions are using the register form latency.
      
      I don't know what the right answer is, so I've left TODOs and will try to work with the AMD folks to get this cleaned up.
      
      llvm-svn: 323405
      795b17f4
    • Don Hinton's avatar
      [cmake] Set cmake policy CMP0068 to suppress warnings on OSX · 32ff6599
      Don Hinton authored
      Set cmake policy CMP0068=NEW, if available, and set
      "CMAKE_BUILD_WITH_INSTALL_NAME_DIR=On" globally to
      maintain current behavior.
      
      This is needed to suppress warnings on OSX starting with cmake version
      3.9.6.
      
      Differential Revision: https://reviews.llvm.org/D42463
      
      llvm-svn: 323404
      32ff6599
    • Craig Topper's avatar
      066e7376
    • Craig Topper's avatar
      [X86] Remove 64/128/256 from MMX/SSE/AVX instruction names for overall consistency. NFC · dbddac09
      Craig Topper authored
      MMX instrutions all start with MMX_ so the 64 isn't needed for disambigutation.
      SSE/AVX1 instructions are assumed 128-bit so we don't need to say 128.
      AVX2 instructions should use a Y to indicate 256-bits.
      
      llvm-svn: 323402
      dbddac09
    • Craig Topper's avatar
      [X86] Remove unnecessary '_alt' and '_Int' from scheduler model regular expressions. · 81c87092
      Craig Topper authored
      These were treated as optional suffixes, but the regular expressions are already prefix matches so this is unnecessary. It breaks the binary search optimization in tablegen due to the top level question mark.
      
      llvm-svn: 323401
      81c87092
    • Aditya Nandakumar's avatar
      Add support for pattern matching MachineInsts. · 2036f446
      Aditya Nandakumar authored
      https://reviews.llvm.org/D42439
      
      Add Instcombine like matchers for MachineInstructions. There are only
      globalISel matchers for now.
      
      llvm-svn: 323400
      2036f446
    • Rafael Espindola's avatar
      Remove MemRegionOffset. NFC. · 490f0a4d
      Rafael Espindola authored
      We can just use a member variable in MemoryRegion.
      
      llvm-svn: 323399
      490f0a4d
    • Lang Hames's avatar
      [ORC] Refactor the various lookupFlags methods to return the flags map via the · c8a74a04
      Lang Hames authored
      first argument.
      
      This makes lookupFlags more consistent with lookup (which takes the query as the
      first argument) and composes better in practice, since lookups are usually
      linearly chained: Each lookupFlags can populate the result map based on the
      symbols not found in the previous lookup. (If the maps were returned rather than
      passed by reference there would have to be a merge step at the end).
      
      llvm-svn: 323398
      c8a74a04
    • Peter Collingbourne's avatar
      [libc++abi] Fix unused function when building with LIBCXXABI_SILENT_TERMINATE · a674a8fd
      Peter Collingbourne authored
      This fixes:
      src/cxa_default_handlers.cpp:25:13: error: unused function 'demangling_terminate_handler' [-Werror,-Wunused-function]
      
      Patch by Thomas Anderson!
      
      Differential Revision: https://reviews.llvm.org/D42399
      
      llvm-svn: 323397
      a674a8fd
    • Rafael Espindola's avatar
      Only lookup LMARegion once. NFC. · 567175f3
      Rafael Espindola authored
      This is similar to how we handle MemRegion.
      
      llvm-svn: 323396
      567175f3
    • 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