1. Aug 09, 2017
    • Chandler Carruth's avatar
      [LCG] Completely remove the map-based association of post-order numbers · 2cd28b2b
      Chandler Carruth authored
      to Nodes when removing ref edges from a RefSCC.
      
      This map based association turns out to be pretty expensive for large
      RefSCCs and pointless as we already have embedded data members inside
      nodes that we use to track the DFS state. We can reuse one of those and
      the map becomes unnecessary.
      
      This also fuses the update of those numbers into the scan across the
      pending stack of nodes so that we don't walk the nodes twice during the
      DFS.
      
      With this I expect the new PM to be faster than the old PM for the test
      case I have been optimizing. That said, it also seems simpler and more
      direct in many ways. The side storage was always pretty awkward.
      
      The last remaining hot-spot in the profile of the LCG once this is done
      will be the edge iterator walk in the DFS. I'll take a look at improving
      that next.
      
      llvm-svn: 310456
      2cd28b2b
    • Michael Kruse's avatar
      [ZoneAlgo] Add motivation for exception. NFC. · 8756b3fb
      Michael Kruse authored
      
      
      Suggested-by: default avatarHongbin Zheng <etherzhhb@gmail.com>
      llvm-svn: 310455
      8756b3fb
    • Michael Kruse's avatar
      [ZoneAlgo] Consolditate condition. NFC. · a9033aab
      Michael Kruse authored
      No need to create an OptimizationRemarkMissed object if we are not going
      to use it anyway.
      
      llvm-svn: 310454
      a9033aab
    • Davide Italiano's avatar
      [GlobalOpt] Switch an explicit loop to llvm::all_of(). NFCI. · c163fac1
      Davide Italiano authored
      llvm-svn: 310453
      c163fac1
    • Vadim Macagon's avatar
      Expose active and available platform lists via SBDebugger API · c10e34d0
      Vadim Macagon authored
      Summary:
      The available platform list was previously only accessible via the
      `platform list` command, this patch makes it possible to access that
      list via the SBDebugger API. The active platform list has likewise
      been exposed via the SBDebugger API.
      
      Differential Revision: https://reviews.llvm.org/D35760
      
      llvm-svn: 310452
      c10e34d0
    • Chandler Carruth's avatar
      [LCG] Special case when removing a ref edge from a RefSCC leaves · 9c3deaa6
      Chandler Carruth authored
      that RefSCC still connected.
      
      This is common and can be handled much more efficiently. As soon as we
      know we've covered every node in the RefSCC with the DFS, we can simply
      reset our state and return. This avoids numerous data structure updates
      and other complexity.
      
      On top of other changes, this appears to get new PM back to parity with
      the old PM for a large protocol buffer message source code. The dense
      map updates are very hot in this function.
      
      llvm-svn: 310451
      9c3deaa6
    • Chandler Carruth's avatar
      [LCG] Switch one of the update methods for the LazyCallGraph to support · 23c2f44c
      Chandler Carruth authored
      limited batch updates.
      
      Specifically, allow removing multiple reference edges starting from
      a common source node. There are a few constraints that play into
      supporting this form of batching:
      
      1) The way updates occur during the CGSCC walk, about the most we can
         functionally batch together are those with a common source node. This
         also makes the batching simpler to implement, so it seems
         a worthwhile restriction.
      2) The far and away hottest function for large C++ files I measured
         (generated code for protocol buffers) showed a huge amount of time
         was spent removing ref edges specifically, so it seems worth focusing
         there.
      3) The algorithm for removing ref edges is very amenable to this
         restricted batching. There are just both API and implementation
         special casing for the non-batch case that gets in the way. Once
         removed, supporting batches is nearly trivial.
      
      This does modify the API in an interesting way -- now, we only preserve
      the target RefSCC when the RefSCC structure is unchanged. In the face of
      any splits, we create brand new RefSCC objects. However, all of the
      users were OK with it that I could find. Only the unittest needed
      interesting updates here.
      
      How much does batching these updates help? I instrumented the compiler
      when run over a very large generated source file for a protocol buffer
      and found that the majority of updates are intrinsically updating one
      function at a time. However, nearly 40% of the total ref edges removed
      are removed as part of a batch of removals greater than one, so these
      are the cases batching can help with.
      
      When compiling the IR for this file with 'opt' and 'O3', this patch
      reduces the total time by 8-9%.
      
      Differential Revision: https://reviews.llvm.org/D36352
      
      llvm-svn: 310450
      23c2f44c
    • Gabor Horvath's avatar
      [Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements · 64c32411
      Gabor Horvath authored
      Patch by: Reka Nikolett Kovacs
      
      Differential Revision: https://reviews.llvm.org/D36407
      
      llvm-svn: 310449
      64c32411
    • Siddharth Bhat's avatar
      [PPCGCodeGeneration] Compute element size in bytes for arrays correctly. · 34eeabbc
      Siddharth Bhat authored
      Previously, we used to compute this with `elementSizeInBits / 8`. This
      would yield an element size of 0 when the array had element size < 8 in
      bits.
      
      To fix this, ask data layout what the size in bytes should be.
      
      Differential Revision: https://reviews.llvm.org/D36459
      
      llvm-svn: 310448
      34eeabbc
    • Craig Topper's avatar
      [X86] Add the rest of the ADC and SBB instructions to isDefConvertible. · b049158a
      Craig Topper authored
      I don't know if this really affects anything. Just thought it was weird that we had all of the ADD/SUB/AND/OR/XOR instructions.
      
      llvm-svn: 310447
      b049158a
    • Craig Topper's avatar
      5706c01c
    • George Burgess IV's avatar
      Attempt #2 to appease buildbots · 2fd1ff81
      George Burgess IV authored
      "error: unable to create target: 'No available targets are compatible
      with this triple.'"
      
      llvm-svn: 310445
      2fd1ff81
    • George Burgess IV's avatar
      Attempt to appease msc buildbot · 8b928fee
      George Burgess IV authored
      It was timing out on this test, but for reasons unrelated to the
      specific bug it was testing for. Randomly breaking in gdb with `clang
      -target i686-windows -fmsc-version=1700` reveals *many* frames from
      MicrosoftCXXNameMangler. So, it would seem that some caching is needed
      there, as well...
      
      Fingers crossed that specifying a triple is sufficient to work around
      this.
      
      llvm-svn: 310444
      8b928fee
    • Serguei Katkov's avatar
      [ImplicitNullCheck] Fix the bug when dependent instruction accesses memory · 6ea2e81c
      Serguei Katkov authored
      It is possible that dependent instruction may access memory.
      In this case we must reject optimization because the memory change will
      be visible in null handler basic block. So we will execute an instruction which
      we must not execute if check fails.
      
      Reviewers: sanjoy, reames
      Reviewed By: sanjoy
      Subscribers: llvm-commits
      Differential Revision: https://reviews.llvm.org/D36392
      
      llvm-svn: 310443
      6ea2e81c
    • Zachary Turner's avatar
      Fix broken pdb test. · 2a77b266
      Zachary Turner authored
      For some reason I didn't see this failure the first time.  The
      output format changed slightly, so we just have to update the
      test for the new format.
      
      llvm-svn: 310442
      2a77b266
    • Vitaly Buka's avatar
      [clang-fuzzer] Resolve proto dependencies · f0ada558
      Vitaly Buka authored
      llvm-svn: 310441
      f0ada558
    • Zachary Turner's avatar
      Fix -Wreorder-fields warning. · e7a3463d
      Zachary Turner authored
      llvm-svn: 310440
      e7a3463d
    • Zachary Turner's avatar
      [PDB] Fix an issue writing the publics stream. · 5448dabb
      Zachary Turner authored
      In the refactor to merge the publics and globals stream, a bug
      was introduced that wrote the wrong value for one of the fields
      of the PublicsStreamHeader.  This caused debugging in WinDbg
      to break.
      
      We had no way of dumping any of these fields, so in addition to
      fixing the bug I've added dumping support for them along with a
      test that verifies the correct value is written.
      
      llvm-svn: 310439
      5448dabb
    • Zachary Turner's avatar
      [PDB] Merge Global and Publics Builders. · 946204c8
      Zachary Turner authored
      The publics stream and globals stream are very similar. They both
      contain a list of hash buckets that refer into a single shared stream,
      the symbol record stream. Because of the need for each builder to manage
      both an independent hash stream as well as a single shared record
      stream, making the two builders be independent entities is not the right
      design. This patch merges them into a single class, of which only a
      single instance is needed to create all 3 streams.  PublicsStreamBuilder
      and GlobalsStreamBuilder are now merged into the single GSIStreamBuilder
      class, which writes all 3 streams at once.
      
      Note that this patch does not contain any functionality change. So we're
      still not yet writing any records to the globals stream. All we're doing
      is making it so that when we do start writing records to the globals,
      this refactor won't have to be part of that patch.
      
      Differential Revision: https://reviews.llvm.org/D36489
      
      llvm-svn: 310438
      946204c8
    • George Burgess IV's avatar
      [AST] Cache intermediate visibility/linkage results · 35cb4f84
      George Burgess IV authored
      This is a follow-up to r310436 with actual functional changes. Please
      see that commit message for a description of why a cache is appearing
      here.
      
      Suggestions for less-bad ways of testing this are appreciated. :)
      
      This fixes PR29160.
      
      llvm-svn: 310437
      35cb4f84
    • George Burgess IV's avatar
      [AST] Move visibility computations into a class; NFC · 99db3ea6
      George Burgess IV authored
      This is patch 1 in a 2 patch series that aims to fix PR29160. Its goal
      is to cache decl visibility/linkage for the duration of each
      visibility+linkage query.
      
      The simplest way I can see to do this is to put the visibility
      calculation code that needs to (transitively) access this cache into a
      class, which is what this patch does. Actual caching will come in patch
      2. (Another way would be to keep the cache in ASTContext + manually
      invalidate it or something, but that felt way too subtle to me.)
      
      Caching visibility results across multiple queries seems a bit tricky,
      since the user can add visibility attributes ~whenever they want, and
      these attributes can apparently have far-reaching effects (e.g. class
      visibility extends to its members, ...). Because a cache that's dropped
      at the end of each top-level query seems to work nearly as well and
      doesn't require any eviction logic, I opted for that design.
      
      llvm-svn: 310436
      99db3ea6
    • Richard Trieu's avatar
      Allow operator delete to be an invalid Decl. · c06b35c9
      Richard Trieu authored
      Do not discard invalid Decl when searching for the operator delete function.
      The lookup for this function always expects to find a result, so sometimes the
      invalid Decl is the only choice possible.  This fixes PR34109.
      
      llvm-svn: 310435
      c06b35c9
    • Craig Topper's avatar
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Fix bug regarding cubin integration into host binary · 52898435
      Gheorghe-Teodor Bercea authored
      when a BindArchAction is used.
      
      This is not a functional change.
      
      Original Diff: D29654
      
      llvm-svn: 310433
      52898435
    • Vitaly Buka's avatar
      [asan] Refactor thread creation bookkeeping · 70303547
      Vitaly Buka authored
      Summary:
      This is a pure refactoring change.  It paves the way for OS-specific
      implementations, such as Fuchsia's, that can do most of the
      per-thread bookkeeping work in the creator thread before the new
      thread actually starts.  This model is simpler and cleaner, avoiding
      some race issues that the interceptor code for thread creation has
      to do for the existing OS-specific implementations.
      
      Submitted on behalf of Roland McGrath.
      
      Reviewers: vitalybuka, alekseyshl, kcc
      
      Reviewed By: alekseyshl
      
      Subscribers: phosek, filcab, llvm-commits, kubamracek
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36385
      
      llvm-svn: 310432
      70303547
    • Vitaly Buka's avatar
      [asan] Complete the Fuchsia port · 83832fe7
      Vitaly Buka authored
      Submitted on behalf of Roland McGrath.
      
      Reviewers: kcc, eugenis, alekseyshl, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: filcab, vitalybuka, srhines, kubamracek, mgorny, phosek, llvm-commits
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D35865
      
      llvm-svn: 310431
      83832fe7
    • Eugene Zelenko's avatar
      d8e3efd5
    • Eugene Zelenko's avatar
      [AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use... · d16eff81
      Eugene Zelenko authored
      [AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
      
      llvm-svn: 310429
      d16eff81
    • Kamil Rytarowski's avatar
      Try to appease compiler and break multiline comment. · e5a9d9f1
      Kamil Rytarowski authored
      llvm-svn: 310428
      e5a9d9f1
    • Tim Northover's avatar
      Sema: disable implicit conversion from _Complex to real types in C++. · 0241637c
      Tim Northover authored
      Converting a _Complex type to a real one simply discards the imaginary part.
      This can easily lead to loss of information so for safety (and GCC
      compatibility) this patch disallows that when the conversion would be implicit.
      
      The one exception is bool, which actually compares both real and imaginary
      parts and so is safe.
      
      llvm-svn: 310427
      0241637c
    • Tim Northover's avatar
      Revert "Lexer: always allow imaginary constants in GNU mode." · d1fafc8b
      Tim Northover authored
      This reverts r310423. It was committed by mistake, I intended to commit the
      improved diagnostics for implicit conversions instead.
      
      llvm-svn: 310426
      d1fafc8b
    • Quentin Colombet's avatar
      Revert "[GlobalISel] Remove the GISelAccessor API." · 8dd90fb5
      Quentin Colombet authored
      This reverts commit r310115.
      
      It causes a linker failure for the one of the unittests of AArch64 on one
      of the linux bot:
      http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/3429
      
      : && /home/fedora/gcc/install/gcc-7.1.0/bin/g++   -fPIC
      -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W
      -Wno-unused-parameter -Wwrite-strings -Wcast-qual
      -Wno-missing-field-initializers -pedantic -Wno-long-long
      -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
      -ffunction-sections -fdata-sections -O2
      -L/home/fedora/gcc/install/gcc-7.1.0/lib64 -Wl,-allow-shlib-undefined
      -Wl,-O3 -Wl,--gc-sections
      unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o  -o
      unittests/Target/AArch64/AArch64Tests
      lib/libLLVMAArch64CodeGen.so.6.0.0svn lib/libLLVMAArch64Desc.so.6.0.0svn
      lib/libLLVMAArch64Info.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn
      lib/libLLVMCore.so.6.0.0svn lib/libLLVMMC.so.6.0.0svn
      lib/libLLVMMIRParser.so.6.0.0svn lib/libLLVMSelectionDAG.so.6.0.0svn
      lib/libLLVMTarget.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn -lpthread
      lib/libgtest_main.so.6.0.0svn lib/libgtest.so.6.0.0svn -lpthread
      -Wl,-rpath,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
      && :
      unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x0):
      undefined reference to `vtable for llvm::LegalizerInfo'
      unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x8):
      undefined reference to `vtable for llvm::RegisterBankInfo'
      
      The particularity of this bot is that it is built with
      BUILD_SHARED_LIBS=ON
      
      However, I was not able to reproduce the problem so far.
      Reverting to unblock the bot.
      
      llvm-svn: 310425
      8dd90fb5
    • Nemanja Ivanovic's avatar
      3f98fb4a
    • Tim Northover's avatar
      Lexer: always allow imaginary constants in GNU mode. · 8fbb4c40
      Tim Northover authored
      llvm-svn: 310423
      8fbb4c40
    • Jessica Paquette's avatar
      [MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR · d36945bf
      Jessica Paquette authored
      Before, the outliner would mark all instructions that read from/modify LR as
      illegal. This doesn't handle W30, which overlaps with LR. This shouldn't be
      outlined.
      
      This commit fixes that by making modifiesRegister() and readsRegister() look at
      W30 + take in a TRI argument. This makes sure that modifiesRegister() and
      readsRegister() won't outline either of W30 and LR.
      
      https://reviews.llvm.org/D36435
      
      llvm-svn: 310422
      d36945bf
    • Wei Mi's avatar
      [GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE · bb9106ac
      Wei Mi authored
      When a new phi is generated for scalarpre of an expression, the phiTranslate cache
      will become stale: Before PRE, the candidate expression must not be available in a
      predecessor block, and phitranslate will cache the information. After PRE, the
      expression will become available in all predecessor blocks, so the related entries
      in phiTranslate cache becomes stale. The patch will simply remove the stale entries
      so phiTranslate can be recomputed next time.
      
      The stale entries in phitranslate cache will not affect correctness but will cause
      missing PRE opportunity for later instructions.
      
      Differential Revision: https://reviews.llvm.org/D36124
      
      llvm-svn: 310421
      bb9106ac
    • Nuno Lopes's avatar
      598d1632
    • Reid Kleckner's avatar
      [winasan] Fix hotpatching ntdll!strcpy for Win10 creators edition · c3fc3bc5
      Reid Kleckner authored
      The 9 byte nop is a suffix of the 10 byte nop, and we need at most 6
      bytes.
      
      ntdll's version of strcpy is written in assembly and is very clever.
      strcat tail calls strcpy but with a slightly different arrangement of
      argument registers at an alternate entry point. It looks like this:
      
        ntdll!strcpy:
        00007ffd`64e8a7a0 4c8bd9          mov     r11,rcx
        ntdll!__entry_from_strcat_in_strcpy:
        00007ffd`64e8a7a3 482bca          sub     rcx,rdx
        00007ffd`64e8a7a6 f6c207          test    dl,7
      
      If we overwrite more than two bytes in our interceptor, that label will
      no longer be a valid instruction boundary.
      
      By recognizing the 9 byte nop, we use the two byte backwards branch to
      start our trampoline, avoiding this issue.
      
      Fixes https://github.com/google/sanitizers/issues/829
      
      Patch by David Major
      
      llvm-svn: 310419
      c3fc3bc5
    • Simon Atanasyan's avatar
      [mips] Enable `long_call/short_call` attributes on MIPS64 · a92a8423
      Simon Atanasyan authored
      This change enables `long_call/short_call/far/near` attributes on
      MIPS64 targets.
      
      Differential revision: https://reviews.llvm.org/D36208
      
      llvm-svn: 310418
      a92a8423
    • Tim Hammerquist's avatar
      Add existing unit tests to Xcode project · 3666adf2
      Tim Hammerquist authored
      Summary:
      This adds gtest test files to the Xcode project which were
      previously only in the cmake config. This is the first of several
      planned merges.
      
      Reviewers: beanz, spyffe, jingham
      
      Reviewed By: jingham
      
      Subscribers: lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D36485
      
      llvm-svn: 310417
      3666adf2