1. Nov 23, 2019
    • Ehud Katz's avatar
      [PhiValues] Remove redundant map searches · 91aa5dae
      Ehud Katz authored
      Remove redundant map searches.
      For example, every call to "operator[]" is actually translated to a
      "find" call, and 2 consecutive calls to the operator, without changing
      the map in-between, is just redundant, and inefficient.
      
      Differential Revision: https://reviews.llvm.org/D69337
      91aa5dae
    • Dan Gohman's avatar
      [WebAssembly] Use wasm-opt and LTO libraries when available. · 81282898
      Dan Gohman authored
      When there's a wasm-opt in the PATH, run the it to optimize LLVM's
      output. This fixes PR43796.
      
      And, add an "llvm-lto" directory to the sysroot library search paths,
      so that sysroots can provide LTO-enabled system libraries.
      
      Differential Revision: https://reviews.llvm.org/D70500
      81282898
    • Sourabh Singh Tomar's avatar
      [DWARF] Support for loclist.dwo section in llvm and llvm-dwarfdump. · 81b0a328
      Sourabh Singh Tomar authored
      This patch adds support for debug_loclists.dwo section in llvm and llvm-dwarfdump.
      Also Fixes PR43622, PR43623.
      
      Reviewers: dblaikie, probinson, labath, aprantl, jini.susan.george
      
      https://reviews.llvm.org/D69462
      81b0a328
    • George Burgess IV's avatar
      [ASTMatchers] work around a miscompile; "NFC" · 380a6452
      George Burgess IV authored
      I chatted with Reid offline, and we agreed that having a workaround here
      would be appropriate until PR43879 is resolved.
      
      The given transformation Works On My Machine(TM), and should hopefully
      hold more broadly, but my fingers are crossed nonetheless. :)
      380a6452
    • Reid Kleckner's avatar
      [IR] Move global_objects and global_values out of line, NFC · 285cf9a8
      Reid Kleckner authored
      This saves 2.4% of CPU time compiling opt, according to
      ClangBuildAnalyzer. These helpers being inlined in the header was
      triggering the instantiation of concat_iterator in every TU using
      Module.h (~1118 TUs): https://reviews.llvm.org/P8171$35
      
      **** Templates that took longest to instantiate:
       76187 ms: llvm::AnalysisManager<llvm::Function>::getResult<llvm::TargetLibrary... (396 times, avg 192 ms)
       73609 ms: llvm::AnalysisManager<llvm::Function>::getResultImpl (420 times, avg 175 ms)
       49657 ms: llvm::detail::concat_range<llvm::GlobalValue, llvm::iterator_range<l... (1118 times, avg 44 ms)
       49376 ms: llvm::detail::concat_range<const llvm::GlobalValue, llvm::iterator_r... (1118 times, avg 44 ms)
       48167 ms: llvm::iterator_range<llvm::concat_iterator<llvm::GlobalValue, llvm::... (1118 times, avg 43 ms)
       48125 ms: llvm::iterator_range<llvm::concat_iterator<const llvm::GlobalValue, ... (1118 times, avg 43 ms)
       48061 ms: llvm::concat_iterator<llvm::GlobalValue, llvm::ilist_iterator<llvm::... (1118 times, avg 42 ms)
       48014 ms: llvm::concat_iterator<const llvm::GlobalValue, llvm::ilist_iterator<... (1118 times, avg 42 ms)
      ...
      
      I haven't measured, but I don't think these helpers are performance
      critical.  The iterator advance call can still be inlined, which is what
      matters for performance.
      
      Remove global_(objects|values)_(begin|end), since they were dead and
      would have to be out of line anyway.
      285cf9a8
    • Duncan P. N. Exon Smith's avatar
      clang/Modules: Rename CompilerInstance::ModuleManager, NFC · 20d51b2f
      Duncan P. N. Exon Smith authored
      Fix the confusing naming of `CompilerInstance::ModuleManager`.  This is
      actually an instance of `ASTReader`, which contains an instance of
      `ModuleManager`.  I have to assume there was a point in the past where
      they were just one class, but it's been pretty confusing for a while.  I
      think it's time to fix it.
      
      The new name is `TheASTReader`; the annoying `The` prefix is so that we
      don't shadow the `ASTReader` class.  I tried out `ASTRdr` but that
      seemed less clear, and this choice matches `ThePCHContainerOperations`
      just a couple of declarations below.
      
      Also rename `CompilerInstance::getModuleManager` and
      `CompilerInstance::createModuleManager` to `*ASTReader`, making some
      cases of `getModuleManager().getModuleManager()` a little more clear.
      
      https://reviews.llvm.org/D70583
      20d51b2f
    • Duncan P. N. Exon Smith's avatar
      clang/Modules: Refactor CompilerInstance::loadModule, NFC · 5cca6223
      Duncan P. N. Exon Smith authored
      Refactor the logic on CompilerInstance::loadModule and a couple of
      surrounding methods in order to clarify what's going on.
      
      - Rename ModuleLoader::loadModuleFromSource to compileModuleFromSource
        and fix its documentation, since it never loads a module.  It just
        creates/compiles one.
      - Rename one of the overloads of compileModuleImpl to compileModule,
        making it more obvious which one calls the other.
      - Rename compileAndLoadModule to compileModuleAndReadAST.  This
        clarifies the relationship between this helper and its caller,
        CompilerInstance::loadModule (the old name implied the opposite
        relationship).  It also (correctly) indicates that more needs to be
        done to load the module than this function is responsible for.
      - Split findOrCompileModuleAndReadAST out of loadModule.  Besides
        reducing nesting for this code thanks to early returns and the like,
        this refactor clarifies the logic in loadModule, particularly around
        calls to ModuleMap::cacheModuleLoad and
        ModuleMap::getCachedModuleLoad.  findOrCompileModuleAndReadAST also
        breaks early if the initial ReadAST call returns Missing or OutOfDate,
        allowing the last ditch call to compileModuleAndReadAST to come at the
        end of the function body.
          - Additionally split out selectModuleSource, clarifying the logic
            due to early returns.
          - Add ModuleLoadResult::isNormal and OtherUncachedFailure, so that
            loadModule knows whether to cache the result.
            OtherUncachedFailure was added to keep this patch NFC, but there's
            a chance that these cases were uncached by accident, through
            copy/paste/modify failures.  These should be audited as a
            follow-up (maybe we can eliminate this case).
          - Do *not* lift the setting of `ModuleLoadFailed = true` to
            loadModule because there isn't a clear pattern for when it's set.
            This should be reconsidered in a follow-up, in case it would be
            correct to set `ModuleLoadFailed` whenever no module is returned
            and the result is either Normal or OtherUncachedFailure.
      - Add some header documentation where it was missing, and fix it where
        it was wrong.
      
      This should have no functionality change.
      
      https://reviews.llvm.org/D70556
      5cca6223
    • Peter Collingbourne's avatar
      62335188
    • George Burgess IV's avatar
      clang-tidy: don't use an absolute path in a test · 9f13a032
      George Burgess IV authored
      `run_clang_tidy` takes a regular expression to match against
      compile_commands.json entries. If we pass "%t/test.cpp" and "%t" expands
      to anything that includes chars that a regex treats specially, like '+',
      this test starts failing.
      9f13a032
    • David Blaikie's avatar
      DebugInfo: Flag Dwarf Version metadata for merging during LTO · e956952e
      David Blaikie authored
      When the Dwarf Version metadata was initially added (r184276) there was
      no support for Module::Max - though the comment suggested that was the
      desired behavior. The original behavior was Module::Warn which would
      warn and then pick whichever version came first - which is pretty
      arbitrary/luck-based if the consumer has some need for one version or
      the other.
      
      Now that the functionality's been added (r303590) this change updates
      the implementation to match the desired goal.
      
      The general logic here is - if you compile /some/ of your program with a
      more recent DWARF version, you must have a consumer that can handle it,
      so might as well use it for /everything/.
      
      The only place where this might fall down is if you have a need to use
      an old tool (supporting only the older DWARF version) for some subset of
      your program. In which case now it'll all be the higher version. That
      seems pretty narrow (& the inverse could happen too - you specifically
      /need/ the higher DWARF version for some extra expressivity, etc, in
      some part of the program)
      e956952e
    • Reid Kleckner's avatar
      Remove needless Attr.h include from DeclCXX.h, NFC · 019779da
      Reid Kleckner authored
      This actually has no impact on the build, because TypeLoc.h includes
      Attr.h. However, DeclCXX.h has no need of it, so go ahead and remove it.
      The final step in this patch series is to split Attr.h and Attrs.h.
      019779da
    • Reid Kleckner's avatar
      Separate the MS inheritance model enum from the attribute, NFC · a9cc64e5
      Reid Kleckner authored
      This avoids the need to include Attr.h in DeclCXX.h for a four-value
      enum. Removing the include will be done separately, since it is large
      and risky change.
      a9cc64e5
    • Francis Visoiu Mistrih's avatar
      [Remarks] Allow empty temporary remark files · 4506afe3
      Francis Visoiu Mistrih authored
      When parsing bitstream remarks, allow external remark files to be
      empty, which means there are no remarks to be parsed.
      
      In the same way, dsymutil should not produce a remark file.
      4506afe3
    • Reid Kleckner's avatar
      Move vtordisp mode from Attr class to LangOptions.h, NFC · 2692eb0b
      Reid Kleckner authored
      This removes one of the two uses of Attr.h in DeclCXX.h, reducing the
      need to include Attr.h as widely. LangOptions is already very popular.
      2692eb0b
    • Jonas Devlieghere's avatar
      [Examples] Move structured-data unpacking out of the loop. (NFC) · b6ae524c
      Jonas Devlieghere authored
      There's no need to repeat this work in the loop.
      b6ae524c
    • Jonas Devlieghere's avatar
      [Examples] Add in_call_stack breakpoint function. · 1b099c1d
      Jonas Devlieghere authored
      The in_call_stack Python script makes it possible to modify the last
      breakpoint to only stop if a given function is present in the call
      stack. It will check both the symbol name and the function name (coming
      from the debug info, in case the binary is stripped).
      
      To use this, you have to:
      
      1. Import the script into lldb.
      
      (lldb) command script import in_call_stack.py
      
      2. Set a breakpoint and use the in_call_stack alias.
      
      (lldb) b foo
      (lldb) in_call_stack bar
      
      Note that this alias operates on the last set breakpoint. You can re-run
      the in_call_stack command to modify the condition.
      1b099c1d
    • Josh Kunz's avatar
      [Driver] Make -static-libgcc imply static libunwind · 6551ac74
      Josh Kunz authored
      In the GNU toolchain, `-static-libgcc` implies that the unwindlib will
      be linked statically. However, when `--unwindlib=libunwind`, this flag is
      ignored, and a bare `-lunwind` is added to the linker args.  Unfortunately,
      this means that if both `libunwind.so`, and `libunwind.a` are present
      in the library path, `libunwind.so` will be chosen in all cases where
      `-static` is not set.
      
      This change makes `-static-libgcc` affect the `-l` flag produced by
      `--unwindlib=libunwind`. After this patch, providing
      `-static-libgcc --unwindlib=libunwind` will cause the driver to explicitly
      emit `-l:libunwind.a` to statically link libunwind. For all other cases
      it will emit `-l:libunwind.so` matching current behavior with a more
      explicit link line.
      
      https://reviews.llvm.org/D70416
      6551ac74
    • Fangrui Song's avatar
      [MC] Reorder MCInst fields to make sizeof(MCInst) smaller · 16686851
      Fangrui Song authored
      sizeof(MCInst) is decreased from 168 to 160 on 64-bit systems.
      16686851
    • Evandro Menezes's avatar
      [MCA] Fix test cases (NFC) · ff0f407e
      Evandro Menezes authored
      Fix the test cases for Exynos M5 that break under Darwin.
      ff0f407e
    • LLVM GN Syncbot's avatar
      gn build: Merge 64ada7ac · 70580bb3
      LLVM GN Syncbot authored
      70580bb3
    • Jason Molenda's avatar
      Remove extraneous log enabling. · 45098b68
      Jason Molenda authored
      45098b68
    • Jonas Devlieghere's avatar
      [TableGen] Add backend to generate command guide for tools using libOption. · 64ada7ac
      Jonas Devlieghere authored
      For lldb and dsymutil, the command guide is essentially a copy of its
      help output generated by libOption. Making sure the two stay in sync is
      tedious and error prone. Given that we already generate the help from a
      tablegen file, we might as well generate the RST as well.
      
      This adds a tablegen backend for generating Sphinx/RST command guides
      from the tablegen file.
      
      Differential revision: https://reviews.llvm.org/D70610
      64ada7ac
    • Petr Hosek's avatar
      Reland "[CMake] Support installation of InstrProfData.inc" · f35032e0
      Petr Hosek authored
      This header fragment is useful on its own for any consumer that wants
      to use custom instruction profile runtime with the LLVM instrumentation.
      The concrete use case is in Fuchsia's kernel where we want to use
      instruction profile instrumentation, but we cannot use the compiler-rt
      runtime because it's not designed for use in the kernel environment.
      This change allows installing this header as part of compiler-rt.
      
      Differential Revision: https://reviews.llvm.org/D64532
      f35032e0
    • LLVM GN Syncbot's avatar
      gn build: Merge ae8a8c2d · 90f641f2
      LLVM GN Syncbot authored
      90f641f2
    • Akira Hatanaka's avatar
      Revert "[Sema] Use the canonical type in function isVector" · 825235c1
      Akira Hatanaka authored
      This reverts commit a6150b48.
      The commit broke a few neon CodeGen tests.
      825235c1
    • Dávid Bolvanský's avatar
      [Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copy · 9353c5dd
      Dávid Bolvanský authored
      Summary:
      GCC 9 added -Wdeprecated-copy (as part of -Wextra). This diagnostic is already implemented in Clang too, just hidden under -Wdeprecated (not on by default).
      This patch adds -Wdeprecated-copy and makes it compatible with GCC 9+.
      This diagnostic is heavily tested in deprecated.cpp, so I added simple tests just to check we warn when new flag/-Wextra is enabled.
      
      Reviewers: rsmith, dblaikie
      
      Reviewed By: dblaikie
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D70342
      9353c5dd
    • Davide Italiano's avatar
      [InstCombine] Fix call guard difference with dbg · c32f0ff9
      Davide Italiano authored
      Patch by Chris Ye!
      
      Differential Revision: https://reviews.llvm.org/D68004
      c32f0ff9
    • Tsang Whitney W.H's avatar
      [CodeMoverUtils] Added an API to check if an instruction can be safely · ae8a8c2d
      Tsang Whitney W.H authored
      moved before another instruction.
      Summary:Added an API to check if an instruction can be safely moved
      before another instruction. In future PRs, we will like to add support
      of moving instructions between blocks that are not control flow
      equivalent, and add other APIs to enhance usability, e.g. moving basic
      blocks, moving list of instructions...
      Loop Fusion will be its first user. When there is intervening code in
      between two loops, fusion is currently unable to fuse them. Loop Fusion
      can use this utility to check if the intervening code can be safely
      moved before or after the two loops, and move them, then it can
      successfully fuse them.
      Reviewer:kbarton,jdoerfert,Meinersbur,bmahjour,etiotto
      Reviewed By:bmahjour
      Subscribers:mgorny,hiraditya,llvm-commits
      Tag:LLVM
      Differential Revision:https://reviews.llvm.org/D70049
      ae8a8c2d
    • Evandro Menezes's avatar
      [AArch64] Add the pipeline model for Exynos M5 · 48b7fe02
      Evandro Menezes authored
      Add the scheduling and cost models for Exynos M5.
      48b7fe02
    • Siva Chandra Reddy's avatar
      [libc] Add a TableGen based header generator. · b47f9eb5
      Siva Chandra Reddy authored
      Summary:
      * The Python header generator has been removed.
      * Docs giving a highlevel overview of the header gen scheme have been
        added.
      
      Reviewers: phosek, abrachet
      
      Subscribers: mgorny, MaskRay, tschuett, libc-commits
      
      Tags: #libc-project
      
      Differential Revision: https://reviews.llvm.org/D70197
      b47f9eb5
    • Akira Hatanaka's avatar
      [Sema] Use the canonical type in function isVector · a6150b48
      Akira Hatanaka authored
      This fixes an assertion in Sema::CreateBuiltinBinOp that fails when one
      of the vector operand's element type is a typedef of __fp16.
      
      rdar://problem/55983556
      a6150b48
    • Bill Wendling's avatar
      2b795637
    • Bill Wendling's avatar
      Don't report "main" as missing a prototype in freestanding mode · 9180f8a5
      Bill Wendling authored
      Summary:
      A user may want to use freestanding mode with the standard "main" entry
      point. It's not useful to warn about a missing prototype as it's not
      typical to have a prototype for "main".
      
      Reviewers: efriedma, aaron.ballman
      
      Reviewed By: aaron.ballman
      
      Subscribers: aaron.ballman, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D70588
      9180f8a5
    • Kelvin Li's avatar
      [OPENMP] [DOCS] correct status for use_device_addr clause · 0c7a1c0c
      Kelvin Li authored
      The status of the use_device_addr clause feature is changed from 'done' to 'worked on`.
      
      Differential Revision: https://reviews.llvm.org/D70608
      0c7a1c0c
    • Edward Jones's avatar
      [RISCV] Use compiler-rt if no GCC installation detected · e0f22fe0
      Edward Jones authored
      If a GCC installation is not detected, then this attempts to
      use compiler-rt and the compiler-rt crtbegin/crtend
      implementations as a fallback.
      
      Differential Revision: https://reviews.llvm.org/D68407
      e0f22fe0
    • Petr Hosek's avatar
      Revert "[CMake] Support installation of InstrProfData.inc" · 262b10ba
      Petr Hosek authored
      This reverts commit f11bc177 since it's
      failing to build on some bots.
      262b10ba
    • Petr Hosek's avatar
      [CMake] Support installation of InstrProfData.inc · f11bc177
      Petr Hosek authored
      This header fragment is useful on its own for any consumer that wants
      to use custom instruction profile runtime with the LLVM instrumentation.
      The concrete use case is in Fuchsia's kernel where we want to use
      instruction profile instrumentation, but we cannot use the compiler-rt
      runtime because it's not designed for use in the kernel environment.
      This change allows installing this header as part of compiler-rt.
      
      Differential Revision: https://reviews.llvm.org/D64532
      f11bc177
    • Vedant Kumar's avatar
      [DWARF] Handle call sites with indirect call targets · 4fdbc072
      Vedant Kumar authored
      Split CallEdge into DirectCallEdge and IndirectCallEdge. Teach
      DWARFExpression how to evaluate entry values in cases where the current
      activation was created by an indirect call.
      
      rdar://57094085
      
      Differential Revision: https://reviews.llvm.org/D70100
      4fdbc072
    • Philip Reames's avatar
    • Reid Kleckner's avatar
      [clang-include-fixer] Suppress cmd prompt from Vim on Windows · e1e7b6f3
      Reid Kleckner authored
      Copied from the clang-format.py editor integration.
      
      Reviewers: bkramer
      
      Differential Revision: https://reviews.llvm.org/D70518
      e1e7b6f3