1. Aug 09, 2017
    • 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
    • Dehao Chen's avatar
      Make ICP uses PSI to check for hotness. · 34cfcb29
      Dehao Chen authored
      Summary: Currently, ICP checks the count against a fixed value to see if it is hot enough to be promoted. This does not work for SamplePGO because sampled count may be much smaller. This patch uses PSI to check if the count is hot enough to be promoted.
      
      Reviewers: davidxl, tejohnson, eraman
      
      Reviewed By: davidxl
      
      Subscribers: sanjoy, llvm-commits, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D36341
      
      llvm-svn: 310416
      34cfcb29
    • Erik Pilkington's avatar
      [demangler] Rename some variables, NFC · 51225329
      Erik Pilkington authored
      llvm-svn: 310415
      51225329
    • Kamil Rytarowski's avatar
      Add NetBSD support in asan_malloc_linux.cc · a1e4edd1
      Kamil Rytarowski authored
      Summary:
      Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, kcc, fjricci, vitalybuka, filcab
      
      Reviewed By: fjricci
      
      Subscribers: llvm-commits, kubamracek, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36376
      
      llvm-svn: 310414
      a1e4edd1
    • Kamil Rytarowski's avatar
      Add NetBSD support in asan_symbolize.py · c5c9ba1c
      Kamil Rytarowski authored
      Summary:
      Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, filcab, vitalybuka, kcc, fjricci
      
      Reviewed By: fjricci
      
      Subscribers: kubamracek, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36484
      
      llvm-svn: 310413
      c5c9ba1c
    • Kamil Rytarowski's avatar
      Enable ubsan on NetBSD · c9bcc8dc
      Kamil Rytarowski authored
      Summary:
      Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, vitalybuka, kcc, filcab, fjricci
      
      Reviewed By: fjricci
      
      Subscribers: srhines, kubamracek, mgorny, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36483
      
      llvm-svn: 310412
      c9bcc8dc
    • Kamil Rytarowski's avatar
      Reuse sanitizer_linux for NetBSD · c187cabe
      Kamil Rytarowski authored
      Summary:
      Follow FreeBSD and reuse sanitizer_linux for NetBSD.
      
      Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, kcc, filcab, vitalybuka, fjricci, dvyukov
      
      Reviewed By: fjricci
      
      Subscribers: dvyukov, emaste, kubamracek, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36325
      
      llvm-svn: 310411
      c187cabe
    • Reid Kleckner's avatar
      [codeview] Emit nested enums and typedefs from classes · e2e82061
      Reid Kleckner authored
      Previously we limited ourselves to only emitting nested classes, but we
      need other kinds of types as well.
      
      This fixes the Visual Studio STL visualizers, so that users can
      visualize std::string and other objects.
      
      llvm-svn: 310410
      e2e82061
    • Kostya Serebryany's avatar
      [sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters · 9f338dcd
      Kostya Serebryany authored
      llvm-svn: 310409
      9f338dcd
    • Matt Morehouse's avatar
      Integrate Kostya's clang-proto-fuzzer with LLVM. · f051f5d1
      Matt Morehouse authored
      Summary:
      The clang-proto-fuzzer models a subset of C++ as a protobuf and
      uses libprotobuf-mutator to generate interesting mutations of C++
      programs.  Clang-proto-fuzzer has already found several bugs in
      Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
      https://bugs.llvm.org/show_bug.cgi?id=33749).
      
      As with clang-fuzzer, clang-proto-fuzzer requires the following
      cmake flags:
      - CMAKE_C_COMPILER=clang
      - CMAKE_CXX_COMPILER=clang++
      - LLVM_USE_SANITIZE_COVERAGE=YES  // needed for libFuzzer
      - LLVM_USE_SANITIZER=Address  // needed for libFuzzer
      
      In addition, clang-proto-fuzzer requires:
      - CLANG_ENABLE_PROTO_FUZZER=ON
      
      clang-proto-fuzzer also requires the following dependencies:
      - binutils  // needed for libprotobuf-mutator
      - liblzma-dev  // needed for libprotobuf-mutator
      - libz-dev  // needed for libprotobuf-mutator
      - docbook2x  // needed for libprotobuf-mutator
      - Recent version of protobuf [3.3.0 is known to work]
      
      A working version of libprotobuf-mutator will automatically be
      downloaded and built as an external project.
      
      Implementation of clang-proto-fuzzer provided by Kostya
      Serebryany.
      
      https://bugs.llvm.org/show_bug.cgi?id=33829
      
      Reviewers: kcc, vitalybuka, bogner
      
      Reviewed By: kcc, vitalybuka
      
      Subscribers: thakis, mgorny, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D36324
      
      llvm-svn: 310408
      f051f5d1
    • Craig Topper's avatar
      [InstCombine] Support pulling left shifts through a subtract with constant LHS · 364359e4
      Craig Topper authored
      We already support pulling through an add with constant RHS. We can do the same for subtract.
      
      Differential Revision: https://reviews.llvm.org/D36443
      
      llvm-svn: 310407
      364359e4
    • Eli Friedman's avatar
      [coverage] Special-case calls to noreturn functions. · 181dfe4c
      Eli Friedman authored
      The code after a noreturn call doesn't execute.
      
      The pattern in the testcase is pretty common in LLVM (a switch with
      a default case that calls llvm_unreachable).
      
      The original version of this patch was reverted in r309995 due to a
      crash. This version includes a fix for that crash (testcase in 
      test/CoverageMapping/md.cpp).
      
      Differential Revision: https://reviews.llvm.org/D36250
      
      llvm-svn: 310406
      181dfe4c
    • Nirav Dave's avatar
      [DAG] Introduce peekThroughBitcast function. NFCI. · 8a813cf6
      Nirav Dave authored
      llvm-svn: 310405
      8a813cf6
    • Nirav Dave's avatar
      [DAG] Update comments. NFC. · 515116d7
      Nirav Dave authored
      llvm-svn: 310404
      515116d7
    • Josh Gao's avatar
      Thread Safety Analysis: warn on nonsensical attributes. · b40c1770
      Josh Gao authored
      Add warnings in cases where an implicit `this` argument is expected to
      attributes because either `this` doesn't exist because the attribute is
      on a free function, or because `this` is on a type that doesn't have a
      corresponding capability/lockable/scoped_lockable attribute.
      
      Reviewers: delesley, aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D36237
      
      llvm-svn: 310403
      b40c1770
    • Josh Gao's avatar
      Reland "Thread Safety Analysis: fix assert_capability." · ec1369ed
      Josh Gao authored
      Delete the test that was broken by rL309725, and add it back in a
      follow up commit. Also, improve the tests a bit.
      
      Reviewers: delesley, aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D36237
      
      llvm-svn: 310402
      ec1369ed
    • Richard Smith's avatar
      PR19668, PR23034: Fix handling of move constructors and deleted copy · f1a425ed
      Richard Smith authored
      constructors when deciding whether classes should be passed indirectly.
      
      This fixes ABI differences between Clang and GCC:
      
       * Previously, Clang ignored the move constructor when making this
         determination. It now takes the move constructor into account, per
         https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may
         seem recent, but the ABI change was agreed on the Itanium C++ ABI
         list a long time ago).
      
       * Previously, Clang's behavior when the copy constructor was deleted
         was unstable -- depending on whether the lazy declaration of the
         copy constructor had been triggered, you might get different behavior.
         We now eagerly declare the copy constructor whenever its deletedness
         is unclear, and ignore deleted copy/move constructors when looking for
         a trivial such constructor.
      
      This also fixes an ABI difference between Clang and MSVC:
      
       * If the copy constructor would be implicitly deleted (but has not been
         lazily declared yet), for instance because the class has an rvalue
         reference member, we would pass it directly. We now pass such a class
         indirectly, matching MSVC.
      
      llvm-svn: 310401
      f1a425ed
    • Kamil Rytarowski's avatar
      Add NetBSD support in asan_interceptors.cc · f5266f03
      Kamil Rytarowski authored
      Summary:
      Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, kcc, vitalybuka, filcab, fjricci
      
      Reviewed By: vitalybuka
      
      Subscribers: kubamracek, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36470
      
      llvm-svn: 310400
      f5266f03
    • Connor Abbott's avatar
      [AMDGPU] Add llvm.amdgpu.update.dpp intrinsic · 249fc7bd
      Connor Abbott authored
      Summary:
      Now that we've made all the necessary backend changes, we can add a new
      intrinsic which exposes the new capabilities to IR producers. Since
      llvm.amdgpu.update.dpp is a strict superset of llvm.amdgpu.mov.dpp, we
      should deprecate the former. We also add tests for all the functionality
      that was added in previous changes, now that we can access it via an IR
      construct.
      
      Reviewers: tstellar, arsenm
      
      Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye
      
      Differential Revision: https://reviews.llvm.org/D34718
      
      llvm-svn: 310399
      249fc7bd
    • Chad Rosier's avatar
      [NewGVN] Use a cast instead of a dyn_cast. · 4d852597
      Chad Rosier authored
      Differential Revision: https://reviews.llvm.org/D36478
      
      llvm-svn: 310397
      4d852597
    • Zachary Turner's avatar
      [PDB] Fix linking of function symbols and local variables. · 59e3ae82
      Zachary Turner authored
      The compiler outputs PROC32_ID symbols into the object files
      for functions, and these symbols have an embedded type index
      which, when copied to the PDB, refer to the IPI stream.  However,
      the symbols themselves are also converted into regular symbols
      (e.g. S_GPROC32_ID -> S_GPROC32), and type indices in the regular
      symbol records refer to the TPI stream.  So this patch applies
      two fixes to function records.
        1. It converts ID symbols to the proper non-ID record type.
        2. After remapping the type index from the object file's index
           space to the PDB file/IPI stream's index space, it then
           remaps that index to the TPI stream's index space by.
      
      Besides functions, during the remapping process we were also
      discarding symbol record types which we did not recognize.
      In particular, we were discarding S_BPREL32 records, which is
      what MSVC uses to describe local variables on the stack.  So
      this patch fixes that as well by copying them to the PDB.
      
      Differential Revision: https://reviews.llvm.org/D36426
      
      llvm-svn: 310394
      59e3ae82
    • Adrian Prantl's avatar
      dsymutil: support dwarf version mismatches between object and clang module · e502f005
      Adrian Prantl authored
      This adds a missing call to maybeUpdateMaxDwarfVersion when visitng a
      clang module. Failing to do so will cause a failure when emitting
      DWARF 4 forms into a CU that AsmPrinter believes to be DWARF 2.
      
      rdar://problem/33666528
      
      llvm-svn: 310392
      e502f005
    • Kamil Rytarowski's avatar
      NetBSD compatibility nit in asan_test_utils.h · 367c63dc
      Kamil Rytarowski authored
      Summary:
      Do not include <malloc.h> on NetBSD, as this header
      serves on this OS backward compatibility with K&R alias
      for <stdlib.h>.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: vitalybuka, kcc, joerg, filcab, fjricci
      
      Reviewed By: vitalybuka
      
      Subscribers: kubamracek, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D36469
      
      llvm-svn: 310391
      367c63dc
    • Anna Thomas's avatar
      [LoopVectorize] Fix assertion failure in Fcmp vectorization · 9b6e12f3
      Anna Thomas authored
      Summary:
      When vectorizing fcmps we can trip on incorrect cast assertion when setting the
      FastMathFlags after generating the vectorized FCmp.
      This can happen if the FCmp can be folded to true or false directly. The fix
      here is to set the FastMathFlag using the FastMathFlagBuilder *before* creating
      the FCmp Instruction. This is what's done by other optimizations such as
      InstCombine.
      Added a test case which trips on cast assertion without this patch.
      
      Reviewers: Ayal, mssimpso, mkuper, gilr
      
      Reviewed by: Ayal, mssimpso
      
      Subscribers: llvm-commits, mzolotukhin
      
      Differential Revision: https://reviews.llvm.org/D36244
      
      llvm-svn: 310389
      9b6e12f3
    • Aaron Ballman's avatar
      Restore previous structure ABI behavior for bit-fields with the packed attribute for PS4 targets. · b6fd726f
      Aaron Ballman authored
      An ABI change was introduced in r254596 that modified structure layouts when the 'packed' attribute was used on one-byte bitfields. Since the PS4 target needs to maintain backwards compatibility for all structure layouts, this change reintroduces the old behavior for PS4 targets only. It also introduces PS4 specific cases to the relevant test.
      
      Patch by Matthew Voss.
      
      llvm-svn: 310388
      b6fd726f
    • Alexey Bataev's avatar
      [OPENMP][DEBUG] Set proper address space info if required by target. · 3b8d5586
      Alexey Bataev authored
      Arguments, passed to the outlined function, must have correct address
      space info for proper Debug info support. Patch sets global address
      space for arguments that are mapped and passed by reference.
      
      Also, cuda-gdb does not handle reference types correctly, so reference
      arguments are represented as pointers.
      
      llvm-svn: 310387
      3b8d5586
    • Craig Topper's avatar
      [X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports. · 41a550cc
      Craig Topper authored
      They still need to be implemented in the intrinsics, the command line, and the backend. But this change isn't dependent on any of that and resolves a TODO.
      
      llvm-svn: 310386
      41a550cc