1. Mar 21, 2019
    • Billy Robert O'Neal III's avatar
      [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings... · 49fc2655
      Billy Robert O'Neal III authored
      [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
      
      This allows these tests to pass when compiled by MSVC++.
      
      llvm-svn: 356632
      49fc2655
    • Craig Topper's avatar
      [X86] Add CMPXCHG8B feature flag. Set it for all CPUs except i386/i486... · 8d46403b
      Craig Topper authored
      [X86] Add CMPXCHG8B feature flag. Set it for all CPUs except i386/i486 including 'generic'. Disable use of CMPXCHG8B when this flag isn't set.
      
      CMPXCHG8B was introduced on i586/pentium generation.
      
      If its not enabled, limit the atomic width to 32 bits so the AtomicExpandPass will expand to lib calls. Unclear if we should be using a different limit for other configs. The default is 1024 and experimentation shows that using an i256 atomic will cause a crash in SelectionDAG.
      
      Differential Revision: https://reviews.llvm.org/D59576
      
      llvm-svn: 356631
      8d46403b
    • Douglas Yung's avatar
      Revert "Reland r356547 after fixing the tests for Linux." · 6452ba47
      Douglas Yung authored
      This reverts commit 538fb722 (r356565).
      
      This is still breaking a build bot:
      http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/45557
      
      llvm-svn: 356630
      6452ba47
    • Michael Trent's avatar
      Fix Mach-O bind and rebase validation errors in libObject · 02a2ce9a
      Michael Trent authored
      Summary:
      llvm-objdump (via libObject) validates DYLD_INFO rebase and bind
      entries against the basic structure found in the Mach-O file before
      evaluating the contents of those entries. Certain malformed Mach-Os can
      defeat the validation check and force llvm-objdump (libObject) to crash.
      
      The previous logic verified a rebase or bind started in a valid Mach-O
      section, but did not verify that the section wholely contained the
      fixup. It also generally allows rebases or binds to start immediately
      after a valid section even if that range is not itself part of a valid
      section. Finally, bind and rebase opcodes that indicate more than one
      fixup (apply N times...) are not completely validated: only the first
      and final fixups are checked.
      
      The previous logic also rejected certain binaries as false positives.
      Some bind and rebase opcodes can modify the state machine such that the
      next bind or rebase will fail. libObject will reject these opcodes as
      invalid in order to be helpful and print an error message associated
      with the instruction that caused the problem, even though the binary is
      not actually illegal until it consumes the invalid state in the state
      machine. In other words, libObject may reject a Mach-O binary that
      Apple's dynamic linker may consider legal. The original version of
      macho-rebase-add-addr-uleb-too-big is an example of such a binary.
      
      I have replaced the existing checkSegAndOffset and checkCountAndSkip
      functions with a single function, checkSegAndOffsets, which validates
      all of the fixups realized by a DYLD_INFO opcode. checkSegAndOffsets
      verifies that a Mach-O section fully contains each fixup. Every fixup
      realized by an opcode is validated, and some (but not all!)
      inconsistencies in the state machine are allowed until a fixup is
      realized. This means that libObject may fail on an opcode that realizes
      a fixup, not on the opcode that introduced the arithmetic error.
      
      Existing test cases have been modified to reflect the changes in error
      messages returned by libObject. What's more, the test case for 
      macho-rebase-add-addr-uleb-too-big has been modified so that it actually
      triggers the error condition; the new code in libObject considers the
      original test binary "legal".
      
      rdar://47797757
      
      Reviewers: lhames, pete, ab
      
      Reviewed By: pete
      
      Subscribers: rupprecht, jdoerfert, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D59574
      
      llvm-svn: 356629
      02a2ce9a
    • Jennifer Yu's avatar
      Remove extra white spaces · 506d74c8
      Jennifer Yu authored
      llvm-svn: 356628
      506d74c8
    • Stephane Moore's avatar
      [clang-tidy] Disable google-runtime-int in Objective-C++ 🔓 · 5f70c473
      Stephane Moore authored
      Summary:
      In contrast to Google C++, Objective-C often uses built-in integer types
      other than `int`. In fact, the Objective-C runtime itself defines the
      types NSInteger¹ and NSUInteger² which are variant types depending on
      the target architecture. The Objective-C style guide indicates that
      usage of system types with variant sizes is appropriate when handling
      values provided by system interfaces³. Objective-C++ is commonly the
      result of conversion from Objective-C to Objective-C++ for the purpose
      of integrating C++ functionality. The opposite of Objective-C++ being
      used to expose Objective-C functionality to C++ is less common,
      potentially because Objective-C has a signficantly more uneven presence
      on different platforms compared to C++. This generally predisposes
      Objective-C++ to commonly being more Objective-C than C++. Forcing
      Objective-C++ developers to perform conversions between variant system types
      and fixed size integer types depending on target architecture when
      Objective-C++ commonly uses variant system types from Objective-C is
      likely to lead to more bugs and overhead than benefit. For that reason,
      this change proposes to disable google-runtime-int in Objective-C++.
      
      [1] https://developer.apple.com/documentation/objectivec/nsinteger?language=objc
      [2] https://developer.apple.com/documentation/objectivec/nsuinteger?language=objc
      [3] "Types long, NSInteger, NSUInteger, and CGFloat vary in size between
      32- and 64-bit builds. Use of these types is appropriate when handling
      values exposed by system interfaces, but they should be avoided for most
      other computations."
      https://github.com/google/styleguide/blob/gh-pages/objcguide.md#types-with-inconsistent-sizes
      
      Subscribers: xazax.hun, jdoerfert, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D59336
      
      llvm-svn: 356627
      5f70c473
    • Jason Molenda's avatar
      Change the logging on ptrace(PT_KILL) in MachProcess::Kill to log · 9d760a0a
      Jason Molenda authored
      if LOG_PROCESS is enabled or if there was an error making that call.
      
      <rdar://problem/49036508> 
      
      llvm-svn: 356626
      9d760a0a
    • Jason Molenda's avatar
      Update DWARF files. · db5edebe
      Jason Molenda authored
      llvm-svn: 356625
      db5edebe
    • Nico Weber's avatar
      libc++/win: Make once_flag have the same size as a pointer. · 0fd00a58
      Nico Weber authored
      `unsigned long` is 32-bit on 32-bit systems and 64-bit on 64-bit systems
      on LP64 systems -- which most Unix systems are, but Windows isn't.
      Windows is LLP64, which means unsigned long is 32-bit even on 64-bit
      systems.
      
      pplwin.h contains
      
          static_assert(alignof(void *) == alignof(::std::once_flag), ...)
      
      which fails due to this problem.
      
      Instead of unsigned long, use uintptr_t, which consistently is 32-bit
      on 32-bit systems and 64-bit on 64-bit systems.
      
      No functional change except on 64-bit Windows.
      
      Differential Revision: https://reviews.llvm.org/D59607
      
      llvm-svn: 356624
      0fd00a58
    • Jordan Rupprecht's avatar
      Revert "[clangd] Print arguments in template specializations" · ce3d6700
      Jordan Rupprecht authored
      This reverts commit 44a63f6a. It segfaults on an internal test case (will follow up off thread).
      
      llvm-svn: 356623
      ce3d6700
    • Thomas Lively's avatar
      [WebAssembly][NFC] Fix formatting error from rL356610 · 5098f858
      Thomas Lively authored
      llvm-svn: 356622
      5098f858
    • Tim Renouf's avatar
      [AMDGPU] Do not generate spurious PAL metadata · 2327c231
      Tim Renouf authored
      My previous fix rL356591 "[AMDGPU] Added MsgPack format PAL metadata"
      accidentally caused a spurious PAL metadata .note record to be emitted
      for any AMDGPU output. That caused failures in the lld test
      amdgpu-relocs.s. Fixed.
      
      Differential Revision: https://reviews.llvm.org/D59613
      
      Change-Id: Ie04a2aaae890dcd490f22c89edf9913a77ce070e
      llvm-svn: 356621
      2327c231
    • Nikita Popov's avatar
      [InstCombine] Add additional sub nsw inference tests; NFC · 03dbfc2e
      Nikita Popov authored
      nsw can be determined based on known bits here, but currently
      isn't.
      
      llvm-svn: 356620
      03dbfc2e
    • Stanislav Mekhanoshin's avatar
      Allow machine dce to remove uses in the same instruction · 0a11829a
      Stanislav Mekhanoshin authored
      Machine DCE cannot remove a dead definition if there are non-dbg uses.
      A use however can be in the same instruction:
      
        dead %0 = INST %0
      
      Such instructions sometimes created by Detect dead lanes pass.
      
      Allow this instruction to be deleted despite the use if the only use
      belongs to the same instruction.
      
      Differential Revision: https://reviews.llvm.org/D59565
      
      llvm-svn: 356619
      0a11829a
    • Craig Topper's avatar
      [X86] Call lowerShuffleAsBitMask for 512-bit vectors in lowerShuffleAsBlend. · 03675533
      Craig Topper authored
      This patch enables the use of lowerShuffleAsBitMask for 512-bit blends before
      falling back to move immedate, GPR to k-register, and masked op.
      
      I had to make some changes to support v8i64 when i64 is not a legal type. And to
      support floating point types.
      
      This trades a load for the move immediate and GPR move which is higher latency.
      But its probably better for register pressure not having to hop through other
      register classes. The load+and should play better with LICM and
      rematerialization I think.
      
      Differential Revision: https://reviews.llvm.org/D59479
      
      llvm-svn: 356618
      03675533
    • Michael Liao's avatar
      [AMDGPU] Fix dependency on `BinaryFormat` · bbcb95a6
      Michael Liao authored
      Summary: - The linking is broken when this library is built as shared one.
      
      Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D59610
      
      llvm-svn: 356617
      bbcb95a6
    • Louis Dionne's avatar
      [libc++] Mark <filesystem> as unavailable on Apple platforms using pragmas · fa057302
      Louis Dionne authored
      Summary:
      Also add the corresponding XFAILs to tests that require filesystem.
      The approach taken to mark <filesystem> as unavailable in this patch
      is to mark all the header as unavailable using #pragma clang attribute.
      Marking each declaration using the attribute is more intrusive and
      does not provide a lot of value right now because pretty much everything
      in <filesystem> requires dylib support, often transitively.
      
      This is an alternative to https://reviews.llvm.org/D59093.
      A similar (but partial) patch was already applied in r356558.
      
      Reviewers: mclow.lists, EricWF, serge-sans-paille
      
      Subscribers: christof, jkorous, dexonsmith, libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D59224
      
      llvm-svn: 356616
      fa057302
    • Paul Hoad's avatar
      [clang-format][NFC] fix release notes build issue · 7c6ce35c
      Paul Hoad authored
      build issue from r356613
      
      llvm-svn: 356615
      7c6ce35c
    • Jordan Rupprecht's avatar
      [clang][OpenMP] Fix build when using libgomp · bcb8316d
      Jordan Rupprecht authored
      Summary: rL356570 introduced a test which only passes with the default openmp library, libomp, and fails with other openmp libraries, such as libgomp. Explicitly choose libomp.
      
      Reviewers: lebedev.ri
      
      Subscribers: guansong, jdoerfert, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D59609
      
      llvm-svn: 356614
      bcb8316d
    • Paul Hoad's avatar
      [clang-format] BeforeHash added to IndentPPDirectives · 701a0d7e
      Paul Hoad authored
      Summary:
      The option BeforeHash added to IndentPPDirectives.
      Fixes Bug 36019. https://bugs.llvm.org/show_bug.cgi?id=36019
      
      Reviewers: djasper, klimek, krasimir, sammccall, mprobst, Nicola, MyDeveloperDay
      
      Reviewed By: klimek, MyDeveloperDay
      
      Subscribers: kadircet, MyDeveloperDay, mnussbaum, geleji, ufna, cfe-commits
      
      Patch by to-mix.
      
      Differential Revision: https://reviews.llvm.org/D52150
      
      llvm-svn: 356613
      701a0d7e
    • Zachary Turner's avatar
      Introduce DWARFContext. · 6e665127
      Zachary Turner authored
      LLVM's DWARF parsing library has a class called DWARFContext which holds
      all of the various DWARF data sections and lots of other information.
      LLDB's on the other hand stores all of this directly in SymbolFileDWARF
      / SymbolFileDWARFDwo and passes this interface around through the
      parsing library. Obviously this is incompatible with a world where the
      low level interface does not depend on the high level interface, so we
      need to move towards a model similar to LLVM's - i.e. all of the context
      needed for low level parsing should be in a single class, and that class
      gets passed around.
      
      This patch is a small incremental step towards achieving this. The
      interface and internals deviate from LLVM's for technical reasons, but
      the high level idea is the same. The goal is, eventually, to remove all
      occurrences of SymbolFileDWARF from the low level parsing code.
      
      For now I've chosen a very simple section - the .debug_aranges section
      to move into DWARFContext while leaving everything else unchanged. In
      the short term this is a bit confusing because now the information you
      need might come from either of 2 different locations. But it's a huge
      refactor to do this all at once and runs a much higher risk of breaking
      things. So I think it would be wise to do this in very small pieces.
      
      TL;DR - No functional change
      
      Differential Revision: https://reviews.llvm.org/D59562
      
      llvm-svn: 356612
      6e665127
    • Matt Arsenault's avatar
      AMDGPU: Don't look for constant in insert/extract_vector_elt regbankselect · 2065206a
      Matt Arsenault authored
      The constantness shouldn't change the register bank choice. We also
      don't need to restrict this to only indexing VGPRs, since it's
      possible to index SGPRs (but SelectionDAG made using this
      difficult). Allow directly indexing SGPRs when appropriate.
      
      llvm-svn: 356611
      2065206a
    • Thomas Lively's avatar
      [WebAssembly] Target features section · f6f4f843
      Thomas Lively authored
      Summary:
      Implements a new target features section in assembly and object files
      that records what features are used, required, and disallowed in
      WebAssembly objects. The linker uses this information to ensure that
      all objects participating in a link are feature-compatible and records
      the set of used features in the output binary for use by optimizers
      and other tools later in the toolchain.
      
      The "atomics" feature is always required or disallowed to prevent
      linking code with stripped atomics into multithreaded binaries. Other
      features are marked used if they are enabled globally or on any
      function in a module.
      
      Future CLs will add linker flags for ignoring feature compatibility
      checks and for specifying the set of allowed features, implement using
      the presence of the "atomics" feature to control the type of memory
      and segments in the linked binary, and add front-end flags for
      relaxing the linkage policy for atomics.
      
      Reviewers: aheejin, sbc100, dschuff
      
      Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D59173
      
      llvm-svn: 356610
      f6f4f843
    • Craig Topper's avatar
      [X86] Add __crc32b/__crc32w/__crc32d/__crc32q intrinsics to match gcc and icc. · e0941cb3
      Craig Topper authored
      gcc has these intrinsics in ia32intrin.h as well. And icc implements them
      though they aren't documented in the Intel Intrinsics Guide.
      
      Differential Revision: https://reviews.llvm.org/D59533
      
      llvm-svn: 356609
      e0941cb3
    • Michael Liao's avatar
      [AMDGPU] Fix clamp bit DAG operand · eea5177d
      Michael Liao authored
      Summary:
      - Should use `targetconstant` instead of `constant` operand for clamp
        bit, which is expected as an immediate operand. Under certain
        conditions, such as a common `i1 false` constant is used in other
        place and selected before the instruction with clamp bit, register
        operand may be added instead of immediate one. Use `targetcosntant` to
        enforce that.
      
      Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D59608
      
      llvm-svn: 356608
      eea5177d
    • Alexey Bataev's avatar
      [OPENMP]Improve detection of omp_allocator_handle_t type and predefined · 27ef9518
      Alexey Bataev authored
      allocators.
      
      It is better to deduce omp_allocator_handle_t type from the predefined
      allocators, because omp.h header might not define it explicitly. Plus,
      it allows to identify the predefined allocators correctly when trying to
      build the allcoator for the global variables.
      
      llvm-svn: 356607
      27ef9518
    • Pete Couperus's avatar
      [ARC] Add ARCOptAddrMode pass to generate postincrement loads/stores. · b062239d
      Pete Couperus authored
      Build on newly introduced ARC postincrement loads/stores from r356200.
      
      Patch By Denis Antrushin! <denis@synopsys.com>
      
      Differential Revision: https://reviews.llvm.org/D59409
      
      llvm-svn: 356606
      b062239d
    • Alex Lorenz's avatar
      Fix implicit ios -> watchOS availability version mapping for · 0b436484
      Alex Lorenz authored
      versions that have the major number only
      
      rdar://48018651
      
      llvm-svn: 356605
      0b436484
    • Evandro Menezes's avatar
      [AArch64] Fix formatting (NFC) · f7522cab
      Evandro Menezes authored
      Indent macro instances properly.
      
      llvm-svn: 356604
      f7522cab
    • Konstantin Zhuravlyov's avatar
    • Marshall Clow's avatar
      Mark <charconv> tests as unsupported for C++11 and C++14 if you're not testing... · 61914dc2
      Marshall Clow authored
      Mark <charconv> tests as unsupported for C++11 and C++14 if you're not testing libc++. Thanks to Louis for the suggestion.
      
      llvm-svn: 356602
      61914dc2
    • Eli Friedman's avatar
      [ARM] Eliminate redundant "mov rN, sp" instructions in Thumb1. · 638be660
      Eli Friedman authored
      This takes sequences like "mov r4, sp; str r0, [r4]", and optimizes them
      to something like "str r0, [sp]".
      
      For regular stack variables, this optimization was already implemented:
      we lower loads and stores using frame indexes, which are expanded later.
      However, when constructing a call frame for a call with more than four
      arguments, the existing optimization doesn't apply.  We need to use
      stores which are actually relative to the current value of sp, and don't
      have an associated frame index.
      
      This patch adds a special case to handle that construct.  At the DAG
      level, this is an ISD::STORE where the address is a CopyFromReg from SP
      (plus a small constant offset).
      
      This applies only to Thumb1: in Thumb2 or ARM mode, a regular store
      instruction can access SP directly, so the COPY gets eliminated by
      existing code.
      
      The change to ARMDAGToDAGISel::SelectThumbAddrModeSP is a related
      cleanup: we shouldn't pretend that it can select anything other than
      frame indexes.
      
      Differential Revision: https://reviews.llvm.org/D59568
      
      llvm-svn: 356601
      638be660
    • Erik Pilkington's avatar
      Add a __has_extension check for '#pragma clang attribute' as an external-declaration · 8ca6ab33
      Erik Pilkington authored
      This was added in r356075.
      
      llvm-svn: 356600
      8ca6ab33
    • Erik Pilkington's avatar
      [Sema] Deduplicate some availability checking logic · 13ee62f7
      Erik Pilkington authored
      Before this commit, we emit unavailable errors for calls to functions during
      overload resolution, and for references to all other declarations in
      DiagnoseUseOfDecl. The early checks during overload resolution aren't as good as
      the DiagnoseAvailabilityOfDecl based checks, as they error on the code from
      PR40991. This commit fixes this by removing the early checking.
      
      llvm.org/PR40991
      rdar://48564179
      
      Differential revision: https://reviews.llvm.org/D59394
      
      llvm-svn: 356599
      13ee62f7
    • Rafael Auler's avatar
      Recommit "Support attribute used in member funcs of class templates" · 9dde31ec
      Rafael Auler authored
      This diff previously exposed a bug in LLVM's IRLinker, breaking
      buildbots that tried to self-host LLVM with monolithic LTO.
      The bug is now in LLVM by D59552
      
      Original commit message:
      As PR17480 describes, clang does not support the used attribute
      for member functions of class templates. This means that if the member
      function is not used, its definition is never instantiated. This patch
      changes clang to emit the definition if it has the used attribute.
      
      Test Plan: Added a testcase
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D56928
      
      llvm-svn: 356598
      9dde31ec
    • Rafael Auler's avatar
      [Linker] Fix crash handling appending linkage · 6dc53ccb
      Rafael Auler authored
      Summary:
      When linking two llvm.used arrays, if the resulting merged
      array ends up with duplicated elements (with the same name) but with
      different types, the IRLinker was crashing. This was supposed to be
      legal, as the IRLinker bitcasts elements to match types in these
      situations.
      
      This bug was exposed by D56928 in clang to support attribute used
      in member functions of class templates. Crash happened when self-hosting
      with LTO. Since LLVM depends on attribute used to generate code
      for the dump() method, ubiquitous in the code base, many input bc
      had a definition of this method referenced in their llvm.used array.
      Some of these classes got optimized, changing the type of the first
      parameter (this) in the dump method, leading to a scenario with a
      pool of valid definitions but some with a different type, triggering
      this bug.
      
      This is a memory bug: ValueMapper depends on (calls) the materializer
      provided by IRLinker, and this materializer was freely calling RAUW
      methods whenever a global definition was updated in the temporary merged
      output file. However, replaceAllUsesWith may or may not destroy
      constants that use this global. If the linked definition has a type
      mismatch regarding the new def and the old def, the materializer would
      bitcast the old type to the new type and the elements of the llvm.used
      array, which already uses bitcast to i8*, would end up with elements
      cascading two bitcasts. RAUW would then indirectly call the
      constantfolder to update the constant to the new ref, which would,
      instead of updating the constant, destroy it to be able to create
      a new constant that folds the two bitcasts into one. The problem is that
      ValueMapper works with pointers to the same constants that may be
      getting destroyed by RAUW. Obviously, RAUW can update references in the
      Module to do not use the old destroyed constant, but it can't update
      ValueMapper's internal pointers to these constants, which are now
      invalid.
      
      The approach here is to move the task of RAUWing old definitions
      outside of the materializer.
      
      Test Plan:
      Added LIT test case, tested clang self-hosting with D56928 and
      verified it works
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D59552
      
      llvm-svn: 356597
      6dc53ccb
    • Alina Sbirlea's avatar
      [NFC] Fix brace indentation. · f69f8073
      Alina Sbirlea authored
      llvm-svn: 356596
      f69f8073
    • Louis Dionne's avatar
    • Robert Lougher's avatar
      Resubmit r356511 "[TailCallElim] Add tailcall elimination pass to LTO pipelines" · f2158a8e
      Robert Lougher authored
      Failing LLD tests have been fixed in r356593.
      
      llvm-svn: 356594
      f2158a8e
    • Robert Lougher's avatar
      [TailCallElim] Update tests for LTO pipeline change · 364cb6b5
      Robert Lougher authored
      D58391 changed the LTO pipelines to add the tailcall elimination pass.
      This caused three LLD tests to fail.
      
      Differential Revision: https://reviews.llvm.org/D59604
      
      llvm-svn: 356593
      364cb6b5