1. Apr 17, 2019
    • Simon Pilgrim's avatar
      [CostModel][X86] Add bool anyof/allof reduction costs · 9daacec8
      Simon Pilgrim authored
      On pre-AVX512 targets we can use MOVMSK to extract reduced boolean results. This is properly optimized, annoyingly AVX512 isn't and produces code that is almost as bad as the (unchanged) costs suggest......
      
      Differential Revision: https://reviews.llvm.org/D60403
      
      llvm-svn: 358574
      9daacec8
    • Andrey Churbanov's avatar
      Fixed memory leak reported in Bugzilla: · cf5bdb83
      Andrey Churbanov authored
      https://bugs.llvm.org/show_bug.cgi?id=41494
      
      Freed th_cg_roots structure at exit from uber thread.
      
      Differential Revision: https://reviews.llvm.org/D60729
      
      llvm-svn: 358572
      cf5bdb83
    • Sam McCall's avatar
      [clangd] Include insertion: require header guards, drop other heuristics, treat .def like .inc. · 62e24723
      Sam McCall authored
      Summary:
      We do have some reports of include insertion behaving badly in some
      codebases. Requiring header guards both makes sense in principle, and is
      likely to disable this "nice-to-have" feature in codebases where headers don't
      follow the expected pattern.
      
      With this we can drop some other heuristics, such as looking at file
      extensions to detect known non-headers - implementation files have no guards.
      
      One wrinkle here is #import - objc headers may not have guards because
      they're intended to be used via #import. If the header is the main file
      or is #included, we won't collect locations - merge should take care of
      this if we see the file #imported somewhere. Seems likely to be OK.
      
      Headers which have a canonicalization (stdlib, IWYU) are exempt from this check.
      *.inc files continue to be handled by looking up to the including file.
      This patch also adds *.def here - tablegen wants this pattern too.
      
      In terms of code structure, the division between SymbolCollector and
      CanonicalIncludes has shifted: SymbolCollector is responsible for more.
      This is because SymbolCollector has all the SourceManager/HeaderSearch access
      needed for checking for guards, and we interleave these checks with the *.def
      checks in a loop (potentially).
      We could hand all the info into CanonicalIncludes and put the logic there
      if that's preferable.
      
      Reviewers: ioeric
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D60316
      
      llvm-svn: 358571
      62e24723
    • Hans Wennborg's avatar
      clang-cl: Parse /openmp:experimental · 6fe637c6
      Hans Wennborg authored
      It was added to the MS docs recently here:
      https://github.com/MicrosoftDocs/cpp-docs/commit/3951085ab722fbb488ca40864f4a0553f7b71855
      
      llvm-svn: 358570
      6fe637c6
    • Fangrui Song's avatar
      [DWARF] llvm::Error -> Error. NFC · a364d599
      Fangrui Song authored
      The unqualified name is more common and is used in the file as well.
      
      llvm-svn: 358567
      a364d599
    • Sven van Haastregt's avatar
      [libclang] Expose ext_vector_type · c9945cca
      Sven van Haastregt authored
      Differential Revision: https://reviews.llvm.org/D60775
      
      llvm-svn: 358566
      c9945cca
    • Fangrui Song's avatar
      [ELF] Use llvm::bsearch. NFC · 2bc3a19a
      Fangrui Song authored
      Differential Revision: https://reviews.llvm.org/D60813
      
      llvm-svn: 358565
      2bc3a19a
    • Fangrui Song's avatar
      Change some llvm::{lower,upper}_bound to llvm::bsearch. NFC · c82e92bc
      Fangrui Song authored
      llvm-svn: 358564
      c82e92bc
    • Jordan Rupprecht's avatar
      [llvm-objcopy] Support full list of bfd targets that lld uses. · b0b65cae
      Jordan Rupprecht authored
      Summary:
      This change takes the full list of bfd targets that lld supports (see `ScriptParser.cpp`), including generic handling for `*-freebsd` targets (which uses the same settings but with a FreeBSD OSABI). In particular this adds mips support for `--output-target` (but not yet via `--binary-architecture`).
      
      lld and llvm-objcopy use their own different custom data structures, so I'd prefer to check this in as-is (add support directly in llvm-objcopy, including all the test coverage) and do a separate NFC patch(s) that consolidate the two by putting this mapping into libobject.
      
      See [[ https://bugs.llvm.org/show_bug.cgi?id=41462 | PR41462 ]].
      
      Reviewers: jhenderson, jakehehrlich, espindola, alexshap, arichardson
      
      Reviewed By: arichardson
      
      Subscribers: fedor.sergeev, emaste, sdardis, krytarowski, atanasyan, llvm-commits, MaskRay, arichardson
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60773
      
      llvm-svn: 358562
      b0b65cae
    • Sam McCall's avatar
      [clangd] lower_bound -> bsearch, NFC · 277754c7
      Sam McCall authored
      llvm-svn: 358561
      277754c7
    • Roman Lebedev's avatar
      [CVP] processOverflowIntrinsic(): don't crash if constant-holding happened · 00806458
      Roman Lebedev authored
      As reported by Mikael Holmén in post-commit review in
      https://reviews.llvm.org/D60791#1469765
      
      llvm-svn: 358559
      00806458
    • Fangrui Song's avatar
      [DWARF] Pass ReferenceToDIEOffsets elements by reference · df44ff1b
      Fangrui Song authored
      llvm-svn: 358558
      df44ff1b
    • Dmitri Gribenko's avatar
      Fixed error message printing in write_cmake_config.py · b9b35fd1
      Dmitri Gribenko authored
      Summary:
      Previously, write_cmake_config.py would raise an error while printing
      the error, because `leftovers` in "'\n'.join(leftovers)" is a tuple.
      
      Subscribers: mgorny, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60766
      
      llvm-svn: 358557
      b9b35fd1
    • Craig Topper's avatar
      [X86] Autogenerate complete checks. NFC · 5ca2e04c
      Craig Topper authored
      llvm-svn: 358556
      5ca2e04c
    • Craig Topper's avatar
      [X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for... · 6bf08027
      Craig Topper authored
      [X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for GR32<->XMM register copies.
      
      We have two versions of some instructions, VR128 versions and FR32 versions that
      are marked as CodeGenOnly.
      
      This change switches to using the VR128 versions for these copies. It's after
      register allocation so the class size no longer matters. This matches how GR64
      works.
      
      llvm-svn: 358555
      6bf08027
    • Andrea Di Biagio's avatar
      [MCA] Moved the bottleneck analysis to its own file. NFCI · 57cef586
      Andrea Di Biagio authored
      llvm-svn: 358554
      57cef586
    • Eric Christopher's avatar
      Revert "Add basic loop fusion pass." Per request. · e29874ea
      Eric Christopher authored
      This reverts commit r358543/ab70da07.
      
      llvm-svn: 358553
      e29874ea
    • Eric Christopher's avatar
      Revert "Temporarily Revert "Add basic loop fusion pass."" · cee313d2
      Eric Christopher authored
      The reversion apparently deleted the test/Transforms directory.
      
      Will be re-reverting again.
      
      llvm-svn: 358552
      cee313d2
    • Eric Fiselier's avatar
      Fix visibility for coroutine types on Windows · c3d6a929
      Eric Fiselier authored
      llvm-svn: 358551
      c3d6a929
    • Aaron Smith's avatar
      Clear the output string passed to GetHostName() · b8ec7eee
      Aaron Smith authored
      LLVM's wchar to UTF8 conversion routine expects an empty string to store the output.
      GetHostName() on Windows is sometimes called with a non-empty string which triggers
      an assert. The simple fix is to clear the output string before the conversion.
      
      llvm-svn: 358550
      b8ec7eee
    • Peter Collingbourne's avatar
      clangd: Change Windows.h to windows.h. · 990514ce
      Peter Collingbourne authored
      This makes the file more cross compilation friendly.
      
      llvm-svn: 358549
      990514ce
    • Eric Christopher's avatar
      Remove the run-slp-after-loop-vectorization option. · 0ebbf72a
      Eric Christopher authored
      It's been on by default for 4 years and cleans up the pass
      hierarchy.
      
      llvm-svn: 358548
      0ebbf72a
    • Rui Ueyama's avatar
      Fix a crash bug caused by a nested call of parallelForEach. · 5081e41b
      Rui Ueyama authored
      parallelForEach is not reentrant. We use parallelForEach to call
      each section's writeTo(), so calling the same function within writeTo()
      is not safe.
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=41508
      
      Differential Revision: https://reviews.llvm.org/D60757
      
      llvm-svn: 358547
      5081e41b
    • Eric Christopher's avatar
      Temporarily Revert "Add basic loop fusion pass." · a8634351
      Eric Christopher authored
      As it's causing some bot failures (and per request from kbarton).
      
      This reverts commit r358543/ab70da07.
      
      llvm-svn: 358546
      a8634351
    • Rui Ueyama's avatar
      lld: Fix initial Mach-O load commands size calculation omitting LC_FUNCTION_STARTS · 7f8ca6e3
      Rui Ueyama authored
      Patch by Nicholas Allegra.
      
      The Mach-O writer calculates the size of load commands multiple times.
      
      First, Util::assignAddressesToSections() (in MachONormalizedFileFromAtoms.cpp)
      calculates the size using headerAndLoadCommandsSize() (in
      MachONormalizedFileBinaryWriter.cpp), which creates a temporary
      MachOFileLayout for the NormalizedFile, only to retrieve its
      headerAndLoadCommandsSize.  Later, writeBinary() (in
      MachONormalizedFileBinaryWriter.cpp) creates a new layout and uses the offsets
      from that layout to actually write out everything in the NormalizedFile.
      
      But the NormalizedFile changes between the first computation and the second.
      When Util::assignAddressesToSections is called, file.functionStarts is always
      empty because Util::addFunctionStarts has not yet been called. Yet
      MachOFileLayout decides whether to include a LC_FUNCTION_STARTS command based
      on whether file.functionStarts is nonempty. Therefore, the initial computation
      always omits it.
      
      Because padding for the __TEXT segment (to make its size a multiple of the
      page size) is added between the load commands and the first section, LLD still
      generates a valid binary as long as the amount of padding happens to be large
      enough to fit LC_FUNCTION_STARTS command, which it usually is.
      
      However, it's easy to reproduce the issue by adding a section of a precise
      size. Given foo.c:
      
        __attribute__((section("__TEXT,__foo")))
        char foo[0xd78] = {0};
      
      Run:
      
        clang -dynamiclib -o foo.dylib foo.c -fuse-ld=lld -install_name
        /usr/lib/foo.dylib
        otool -lvv foo.dylib
      
      This should produce:
      
        truncated or malformed object (offset field of section 1 in LC_SEGMENT_64
        command 0 not past the headers of the file)
      
      This commit:
      
       - Changes MachOFileLayout to always assume LC_FUNCTION_STARTS is present for
         the initial computation, as long as generating LC_FUNCTION_STARTS is
         enabled. It would be slightly better to check whether there are actually
         any functions, since no LC_FUNCTION_STARTS will be generated if not, but it
         doesn't cause a problem if the initial computation is too high.
      
       - Adds a test.
      
       - Adds an assert in MachOFileLayout::writeSectionContent() that we are not
         writing section content into the load commands region (which would happen
         if the offset was calculated too low due to the initial load commands size
         calculation being too low).  Adds an assert in
         MachOFileLayout::writeLoadCommands to validate a similar situation where
         two size-of-load-commands computations are expected to be equivalent.
      
      llvm-svn: 358545
      7f8ca6e3
    • Fangrui Song's avatar
      [Driver] Simplify -g level computation and its interaction with -gsplit-dwarf · e3576b0a
      Fangrui Song authored
      Summary:
      When -gsplit-dwarf is used together with other -g options, in most cases
      the computed debug info level is decided by the last -g option, with one
      special case (see below). This patch drops that special case and thus
      makes it easy to reason about:
      
      // If a lower debug level -g comes after -gsplit-dwarf, in some cases
      // -gsplit-dwarf is cancelled.
      -gsplit-dwarf -g0 => 0
      -gsplit-dwarf -gline-directives-only => DebugDirectivesOnly
      -gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1
      -gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split
      
      // If -gsplit-dwarf comes after -g options, with this patch, the net
      // effect is 2 + split for all combinations
      -g0 -gsplit-dwarf => 2 + split
      -gline-directives-only -gsplit-dwarf => 2 + split
      -gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split
      -gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after)
      
      The last case has been changed. In general, if the user intends to lower
      debug info level, place that -g option after -gsplit-dwarf.
      
      Some context:
      
      In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*
      ... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2).
      It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in
      the level computation but that is the status quo.
      
      Reviewers: dblaikie, echristo, probinson
      
      Reviewed By: dblaikie, probinson
      
      Subscribers: probinson, aprantl, jdoerfert, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D59923
      
      llvm-svn: 358544
      e3576b0a
    • Kit Barton's avatar
      Add basic loop fusion pass. · ab70da07
      Kit Barton authored
      This patch adds a basic loop fusion pass. It will fuse loops that conform to the
      following 4 conditions:
        1. Adjacent (no code between them)
        2. Control flow equivalent (if one loop executes, the other loop executes)
        3. Identical bounds (both loops iterate the same number of iterations)
        4. No negative distance dependencies between the loop bodies.
      
      The pass does not make any changes to the IR to create opportunities for fusion.
      Instead, it checks if the necessary conditions are met and if so it fuses two
      loops together.
      
      The pass has not been added to the pass pipeline yet, and thus is not enabled by
      default. It can be run stand alone using the -loop-fusion option.
      
      Phabricator: https://reviews.llvm.org/D55851
      llvm-svn: 358543
      ab70da07
    • Yi Kong's avatar
      [builtins] Add __cmpsf2 for ARM version of comparesf2 · 64c32362
      Yi Kong authored
      The generic version of comparesf2 defines __cmpsf2 alias for libgcc
      compatibility, but the ARM overlay is missing the alias.
      
      Differential Revision: https://reviews.llvm.org/D60805
      
      llvm-svn: 358542
      64c32362
    • Marshall Clow's avatar
      Add tests for stability to list::sort and forward_list::sort. Thanks to... · 83465c79
      Marshall Clow authored
      Add tests for stability to list::sort and forward_list::sort. Thanks to Jonathan Wakely for the notice
      
      llvm-svn: 358541
      83465c79
    • Sam McCall's avatar
      [ADT] llvm::bsearch, binary search for mere mortals · 6b44291b
      Sam McCall authored
      Summary:
      Add to STLExtras a binary search function with a simple mental model:
      You provide a range and a predicate which is true above a certain point.
      bsearch() tells you that point.
      Overloads are provided for integers, iterators, and containers.
      
      This is more suitable than std:: alternatives in many cases:
       - std::binary_search only indicates presence/absence
       - upper_bound/lower_bound give you the opportunity to pick the wrong one
       - all of the options have confusing names and definitions when your predicate
         doesn't have simple "less than" semantics
       - all of the options require iterators
       - we plumb around a useless `value` parameter that should be a lambda capture
      
      The API is inspired by Go's standard library, but we add an extra parameter as
      well as some overloads and templates to show how clever C++ is.
      
      Reviewers: ilya-biryukov, gribozavr
      
      Subscribers: dexonsmith, kristina, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60779
      
      llvm-svn: 358540
      6b44291b
    • Sanjay Patel's avatar
      [x86] adjust LEA tests for better coverage; NFC · d5bc5ca3
      Sanjay Patel authored
      The scale can 1, 2, or 3.
      
      llvm-svn: 358539
      d5bc5ca3
    • Leonard Chan's avatar
      [NFC] Remove unused function (Sema::pushExternalDeclIntoScope) · 5c09f8d6
      Leonard Chan authored
      llvm-svn: 358538
      5c09f8d6
    • Douglas Yung's avatar
      Modify test to use -S instead of -c so that it works when an external... · 1925f418
      Douglas Yung authored
      Modify test to use -S instead of -c so that it works when an external assembler is used that is not present.
      
      llvm-svn: 358537
      1925f418
    • Peter Collingbourne's avatar
      ELF: Move build id computation to Writer. NFCI. · 97d25e06
      Peter Collingbourne authored
      With partitions, each partition should have the same build id. This means
      that the build id needs to be only computed once, otherwise we will end up
      with different build ids in each partition as a result of the file contents
      changing. This change moves the computation of the build id into Writer so
      that it only happens once.
      
      Differential Revision: https://reviews.llvm.org/D60342
      
      llvm-svn: 358536
      97d25e06
    • Mitch Phillips's avatar
      [HWASan] Fixed slow DWARF unwinding. · 8f9d95d9
      Mitch Phillips authored
      Summary: CFA was setup incorrectly, as there is an 8-byte gap at the top of the stack for SP 16-byte alignment purposes.
      
      Reviewers: eugenis
      
      Reviewed By: eugenis
      
      Subscribers: kubamracek, javed.absar, #sanitizers, llvm-commits, pcc
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D60798
      
      llvm-svn: 358535
      8f9d95d9
    • Marshall Clow's avatar
      Fix list/forward_list implementations of remove_if and unique to deal with... · 896b0c7b
      Marshall Clow authored
      Fix list/forward_list implementations of remove_if and unique to deal with predicates that are part of the sequence passed in. We already do this for remove.
      
      llvm-svn: 358534
      896b0c7b
    • Davide Italiano's avatar
      [tools] Only build lldb-test when needed. · b2930b86
      Davide Italiano authored
      llvm-svn: 358533
      b2930b86
    • Robert Widmann's avatar
      [LLVM-C] Add Accessors For Global Variable Metadata Properties · d6eb4bb8
      Robert Widmann authored
      Summary: Metadata for a global variable is really a  (GlobalVariable, Expression) tuple.  Allow access to these, then allow retrieving the file, scope, and line for a DIVariable, whether global or local.  This should be the last of the accessors required for uniform access to location and file information metadata.
      
      Reviewers: jberdine, whitequark, deadalnix
      
      Reviewed By: jberdine, whitequark
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D60725
      
      llvm-svn: 358532
      d6eb4bb8
    • Ali Tamur's avatar
      Fix a typo in comments. [NFC] · e8de5cd6
      Ali Tamur authored
      llvm-svn: 358531
      e8de5cd6
    • Alex Langford's avatar
      [Process] Fix linux arm64 single step compilation failure · 7603bd52
      Alex Langford authored
      This was updated in r356703 to use llvm::sys::RetryAfterSignal, which
      comes from llvm/Support/Errno.h. The header wasn't added, so it fails if
      you compile for arm64/aarch64.
      
      llvm-svn: 358530
      7603bd52