1. Jun 21, 2019
    • Rainer Orth's avatar
      [profile] Solaris ld supports __start___llvm_prof_data etc. labels · 6fde832b
      Rainer Orth authored
      Currently, many profiling tests on Solaris FAIL like
      
        Command Output (stderr):
        --
        Undefined                       first referenced
         symbol                             in file
        __llvm_profile_register_names_function /tmp/lit_tmp_Nqu4eh/infinite_loop-9dc638.o
        __llvm_profile_register_function    /tmp/lit_tmp_Nqu4eh/infinite_loop-9dc638.o
      
      Solaris 11.4 ld supports the non-standard GNU ld extension of adding
      __start_SECNAME and __stop_SECNAME labels to sections whose names are valid
      as C identifiers.  Given that we already use Solaris 11.4-only features
      like ld -z gnu-version-script-compat and fully working .preinit_array
      support in compiler-rt, we don't need to worry about older versions of
      Solaris ld.
      
      The patch documents that support (although the comment in
      lib/Transforms/Instrumentation/InstrProfiling.cpp
      (needsRuntimeRegistrationOfSectionRange) is quite cryptic what it's
      actually about), and adapts the affected testcase not to expect the
      alternativeq __llvm_profile_register_functions and __llvm_profile_init.
      It fixes all affected tests.
      
      Tested on amd64-pc-solaris2.11.
      
      Differential Revision: https://reviews.llvm.org/D41111
      
      llvm-svn: 363984
      6fde832b
    • Matt Arsenault's avatar
      AMDGPU: Add intrinsics for DS GWS semaphore instructions · 740322f1
      Matt Arsenault authored
      llvm-svn: 363983
      740322f1
    • Alina Sbirlea's avatar
      [LICM & MSSA] Limit unsafe sinking and hoisting. · d0b11698
      Alina Sbirlea authored
      Summary:
      The getClobberingMemoryAccess API checks for clobbering accesses in a loop by walking the backedge. This may check if a memory access is being
      clobbered by the loop in a previous iteration, depending how smart AA got over the course of the updates in MemorySSA (it does not occur when built from scratch).
      If no clobbering access is found inside the loop, it will optimize to an access outside the loop. This however does not mean that access is safe to sink.
      Given:
      ```
      for i
        load a[i]
        store a[i]
      ```
      The access corresponding to the load can be optimized to outside the loop, and the load can be hoisted. But it is incorrect to sink it.
      In order to sink the load, we'd need to check no Def clobbers the Use in the same iteration. With this patch we currently restrict sinking to either
      Defs not existing in the loop, or Defs preceding the load in the same block. An easy extension is to ensure the load (Use) post-dominates all Defs.
      
      Caught by PR42294.
      
      This issue also shed light on the converse problem: hoisting stores in this same scenario would be illegal. With this patch we restrict
      hoisting of stores to the case when their corresponding Defs are dominating all Uses in the loop.
      
      Reviewers: george.burgess.iv
      
      Subscribers: jlebar, Prazek, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63582
      
      llvm-svn: 363982
      d0b11698
    • Sanjay Patel's avatar
      [InstSimplify] add tests for known-not-a-power-of-2; NFC · 3207566d
      Sanjay Patel authored
      I added a canonicalization to create this general pattern in:
      rL363956
      
      But as noted in PR42314:
      https://bugs.llvm.org/show_bug.cgi?id=42314#c11
      
      ...we have a (potentially expensive) simplification for the version
      of the code that we just canonicalized away from, so we should
      add/adjust that code to match.
      
      llvm-svn: 363981
      3207566d
    • Richard Smith's avatar
      Rename CodeGenFunction::overlapFor* to getOverlapFor*. · 8cca3a5a
      Richard Smith authored
      llvm-svn: 363980
      8cca3a5a
    • Matt Arsenault's avatar
      AMDGPU: Insert mem_viol check loop around GWS pre-GFX9 · 8ad1decf
      Matt Arsenault authored
      It is necessary to emit this loop around GWS operations in case the
      wave is preempted pre-GFX9.
      
      llvm-svn: 363979
      8ad1decf
    • Cameron McInally's avatar
      9589db7a
    • Leonard Chan's avatar
      Update LLVM test to not check for the EliminateAvailableExternallyPass · 108a9463
      Leonard Chan authored
      for lto-pre-link O2 pipeline runs.
      
      llvm-svn: 363977
      108a9463
    • Richard Smith's avatar
      P0840R2: support for [[no_unique_address]] attribute · 78b239ea
      Richard Smith authored
      Summary:
      Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI.
      
      This depends on D63371.
      
      Reviewers: rjmccall, aaron.ballman
      
      Subscribers: dschuff, aheejin, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D63451
      
      llvm-svn: 363976
      78b239ea
    • Serge Guelton's avatar
      [clang-tidy] Fail gracefully upon empty database fields · 60ca31a7
      Serge Guelton authored
      Fix bz#42281
      
      Differential Revision: https://reviews.llvm.org/D63613
      
      llvm-svn: 363975
      60ca31a7
    • Sanjay Patel's avatar
      [InstCombine] fix typo in comment; NFC · 273d97e6
      Sanjay Patel authored
      llvm-svn: 363974
      273d97e6
    • Reid Kleckner's avatar
      Fix passing structs and AVX vectors through sysv_abi · 3fd3de14
      Reid Kleckner authored
      Do this the same way we did it for ms_abi in r324594.
      
      Fixes PR36806.
      
      llvm-svn: 363973
      3fd3de14
    • Richard Smith's avatar
      Fix crash and rejects-valid when a later template parameter or default · 07ed9cfc
      Richard Smith authored
      template argument contains a backreference to a dependently-typed
      earlier parameter.
      
      In a case like:
        template<typename T, T A, decltype(A) = A> struct X {};
        template<typename U> auto Y = X<U, 0>();
      we previously treated both references to `A` in the third parameter as
      being of type `int` when checking the template-id in `Y`. That`s wrong;
      the type of `A` in these contexts is the dependent type `U`.
      
      When we encounter a non-type template argument that we can't convert to
      the parameter type because of type-dependence, we now insert a dependent
      conversion node so that the SubstNonTypeTemplateParmExpr for the
      template argument will have the parameter's type rather than whatever
      type the argument had.
      
      llvm-svn: 363972
      07ed9cfc
    • Leonard Chan's avatar
      [clang][NewPM] Do not eliminate available_externally durng `-O2 -flto` runs · 97dc622a
      Leonard Chan authored
      This fixes CodeGen/available-externally-suppress.c when the new pass manager is
      turned on by default. available_externally was not emitted during -O2 -flto
      runs when it should still be retained for link time inlining purposes. This can
      be fixed by checking that we aren't LTOPrelinking when adding the
      EliminateAvailableExternallyPass.
      
      Differential Revision: https://reviews.llvm.org/D63580
      
      llvm-svn: 363971
      97dc622a
    • David Bolvansky's avatar
      [NFC] Add more tests for D46262 · 642ed40e
      David Bolvansky authored
      llvm-svn: 363970
      642ed40e
    • Leonard Chan's avatar
      [clang][NewPM] Move EntryExitInstrumenterPass to the start of the pipeline · b206513e
      Leonard Chan authored
      This fixes CodeGen/x86_64-instrument-functions.c when running under the new
      pass manager. The pass should go before any other pass to prevent
      `__cyg_profile_func_enter/exit()` from not being emitted by inlined functions.
      
      Differential Revision: https://reviews.llvm.org/D63577
      
      llvm-svn: 363969
      b206513e
    • Louis Dionne's avatar
      [libc++] Take 2: Implement CTAD for map and multimap · f2f7d72f
      Louis Dionne authored
      This is a re-application of r362986 (which was reverted in r363688) with fixes
      for the issue that caused it to be reverted.
      
      Thanks to Arthur O'Dwyer for the patch.
      
      Differential Revision: https://reviews.llvm.org/D58587
      
      llvm-svn: 363968
      f2f7d72f
    • David Bolvansky's avatar
      [NFC] Updated tests for D63546 · e0c1c3ba
      David Bolvansky authored
      llvm-svn: 363967
      e0c1c3ba
    • Aaron Ballman's avatar
    • Aaron Ballman's avatar
      7dbb3a8f
    • Philip Reames's avatar
      [LFTR] Fix a (latent?) bug related to nested loops · a7fd8a80
      Philip Reames authored
      I can't actually come up with a test case this triggers on without an out of tree change, but in theory, it's a bug in the recently added multiple exit LFTR support.  The root issue is that an exiting block common to two loops can (in theory) have computable exit counts for both loops.  Rewriting the exit of an inner loop in terms of the outer loops IV would cause the inner loop to either a) run forever, or b) terminate on the first iteration.
      
      In practice, we appear to get lucky and not have the exit count computable for the outer loop, except when it's trivially zero.  Given we bail on zero exit counts, we don't appear to ever trigger this.  But I can't come up with a reason we *can't* compute an exit count for the outer loop on the common exiting block, so this may very well be triggering in some cases.
      
      llvm-svn: 363964
      a7fd8a80
    • Puyan Lotfi's avatar
      [NFC] Fix for InterfaceStubs tests (adding REQUIRES: x86-registered-target). · 678e19d8
      Puyan Lotfi authored
      clang-hexagon-elf bot was failing with:
      
      'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
      
      Adding a "// REQUIRES: x86-registered-target" to these tests to quiet the bot.
      
      llvm-svn: 363963
      678e19d8
    • Nico Weber's avatar
      lld/elf: Deduplicate undefined symbol diagnostics · 2c450434
      Nico Weber authored
      Before:
      
      ```
      ld.lld: error: undefined symbol: f()
      >>> referenced by test.cc:3
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-9c0808.o:(g())
      
      ld.lld: error: undefined symbol: f()
      >>> referenced by test.cc:4
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-9c0808.o:(h())
      
      ld.lld: error: undefined symbol: f()
      >>> referenced by test.cc:5
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-9c0808.o:(j())
      
      ld.lld: error: undefined symbol: k()
      >>> referenced by test.cc:5
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-9c0808.o:(j())
      
      ld.lld: error: undefined symbol: f()
      >>> referenced by test2.cc:2
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test2-07b391.o:(asdf())
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      ```
      
      Now:
      
      ```
      ld.lld: error: undefined symbol: f()
      >>> referenced by test.cc:3
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-0e07ba.o:(g())
      >>> referenced by test.cc:4
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-0e07ba.o:(h())
      >>> referenced by test.cc:5
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-0e07ba.o:(j())
      >>> referenced by test2.cc:2
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test2-6bdb24.o:(asdf())
      
      ld.lld: error: undefined symbol: k()
      >>> referenced by test.cc:5
      >>>               /var/folders/c5/8d7sdn1x2mg92mj0rndghhdr0000gn/T/test-0e07ba.o:(j())
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      ```
      
      If there are more than 10 references to an undefined symbol, only the
      first 10 are printed.
      
      Fixes PR42260.
      
      Differential Revision: https://reviews.llvm.org/D63344
      
      llvm-svn: 363962
      2c450434
    • Craig Topper's avatar
      [X86] Make _mm_mask_cvtps_ph, _mm_maskz_cvtps_ph, _mm256_mask_cvtps_ph, and... · 6d9fb68c
      Craig Topper authored
      [X86] Make _mm_mask_cvtps_ph, _mm_maskz_cvtps_ph, _mm256_mask_cvtps_ph, and _mm256_maskz_cvtps_ph aliases for their corresponding cvt_roundps_ph intrinsic.
      
      These intrinsics should always take an immediate for the rounding mode.
      The base instruction comes from before EVEX embdedded rounding. The
      user should always provide the immediate rather than us assuming
      CUR_DIRECTION.
      
      Make the 512-bit versions also explicit aliases instead of copy
      pasting the code.
      
      llvm-svn: 363961
      6d9fb68c
    • Nico Weber's avatar
      gn build: Merge r363948 · 73dbe9d5
      Nico Weber authored
      llvm-svn: 363960
      73dbe9d5
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Add support for handling declare target to clause when unified memory is required · 0034e84a
      Gheorghe-Teodor Bercea authored
      Summary:
      This patch adds support for the handling of the variables under the declare target to clause.
      
      The variables in this case are handled like link variables are. A pointer is created on the host and then mapped to the device. The runtime will then copy the address of the host variable in the device pointer.
      
      Reviewers: ABataev, AlexEichenberger, caomhin
      
      Reviewed By: ABataev
      
      Subscribers: guansong, jdoerfert, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D63108
      
      llvm-svn: 363959
      0034e84a
    • Louis Dionne's avatar
      [pstl] Default to the serial backend when unspecified · 04c5bc98
      Louis Dionne authored
      This is a stopgap measure to make it easier to integrate the PSTL into
      libc++. In the future, we should have a system similar to what libc++
      does, where we specify settings at configuration time and generate a
      __config_site header that is part of the PSTL.
      
      llvm-svn: 363958
      04c5bc98
    • Craig Topper's avatar
      [X86] Add BLSI to isUseDefConvertible. · 9e1665f2
      Craig Topper authored
      Summary:
      BLSI sets the C flag is the input is not zero. So if its followed
      by a TEST of the input where only the Z flag is consumed, we can
      replace it with the opposite check of the C flag.
      
      We should be able to do the same for BLSMSK and BLSR, but the
      naive test case for those is being optimized to a subo by
      CodeGenPrepare.
      
      Reviewers: spatel, RKSimon
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63589
      
      llvm-svn: 363957
      9e1665f2
    • Sanjay Patel's avatar
      [InstCombine] canonicalize check for power-of-2 · 63311bfb
      Sanjay Patel authored
      The form that compares against 0 is better because:
      1. It removes a use of the input value.
      2. It's the more standard form for this pattern: https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
      3. It results in equal or better codegen (tested with x86, AArch64, ARM, PowerPC, MIPS).
      
      This is a root cause for PR42314, but probably doesn't completely answer the codegen request:
      https://bugs.llvm.org/show_bug.cgi?id=42314
      
      Alive proof:
      https://rise4fun.com/Alive/9kG
      
        Name: is power-of-2
        %neg = sub i32 0, %x
        %a = and i32 %neg, %x
        %r = icmp eq i32 %a, %x
        =>
        %dec = add i32 %x, -1
        %a2 = and i32 %dec, %x
        %r = icmp eq i32 %a2, 0
      
        Name: is not power-of-2
        %neg = sub i32 0, %x
        %a = and i32 %neg, %x
        %r = icmp ne i32 %a, %x
        =>
        %dec = add i32 %x, -1
        %a2 = and i32 %dec, %x
        %r = icmp ne i32 %a2, 0
      
      llvm-svn: 363956
      63311bfb
    • Simon Pilgrim's avatar
      [DAGCombiner] Use getAPIntValue() instead of getZExtValue() where possible. · 801c0f12
      Simon Pilgrim authored
      Better handling of out-of-i64-range values due to large integer types or from fuzz tests.
      
      llvm-svn: 363955
      801c0f12
    • Jordan Rupprecht's avatar
      [DAGCombiner][NFC] Remove unused var · 02508dec
      Jordan Rupprecht authored
      llvm-svn: 363954
      02508dec
    • Philip Reames's avatar
      [Tests] Add a tricky LFTR case for documentation purposes · 8c80d080
      Philip Reames authored
      Thought of this case while working on something else.  We appear to get it right in all of the variations I tried, but that's by accident.  So, add a test which would catch the potential bug.
      
      llvm-svn: 363953
      8c80d080
    • Amy Huang's avatar
      Store a pointer to the return value in a static alloca and let the debugger use that · 7fac5c8d
      Amy Huang authored
      as the variable address for NRVO variables.
      
      Subscribers: hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D63361
      
      llvm-svn: 363952
      7fac5c8d
    • David Bolvansky's avatar
      [InstCombine] cttz(-x) -> cttz(x) · 01511192
      David Bolvansky authored
      Summary: Signedness does not change number of trailing zeros.
      
      Reviewers: spatel, lebedev.ri, nikic
      
      Reviewed By: spatel
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63534
      
      llvm-svn: 363951
      01511192
    • Matt Arsenault's avatar
      AMDGPU: Eliminate test usage of legacy FP elim attributes · 5dbe4a99
      Matt Arsenault authored
      llvm-svn: 363950
      5dbe4a99
    • Matt Arsenault's avatar
      AMDGPU: Fix ignoring DisableFramePointerElim in leaf functions · 5dc457cb
      Matt Arsenault authored
      The attribute can specify elimination for leaf or non-leaf, so it
      should always be considered. I copied this bug from AArch64, which
      probably should also be fixed.
      
      llvm-svn: 363949
      5dc457cb
    • Puyan Lotfi's avatar
      [clang-ifs] Clang Interface Stubs, first version (second landing attempt). · 68f29dac
      Puyan Lotfi authored
      This change reverts r363649; effectively re-landing r363626. At this point
      clang::Index::CodegenNameGeneratorImpl has been refactored into
      clang::AST::ASTNameGenerator. This makes it so that the previous circular link
      dependency no longer exists, fixing the previous share lib
      (-DBUILD_SHARED_LIBS=ON) build issue which was the reason for r363649.
      
      Clang interface stubs (previously referred to as clang-ifsos) is a new frontend
      action in clang that allows the generation of stub files that contain mangled
      name info that can be used to produce a stub library. These stub libraries can
      be useful for breaking up build dependencies and controlling access to a
      library's internal symbols. Generation of these stubs can be invoked by:
      
      clang -fvisibility=<visibility> -emit-interface-stubs \
                                      -interface-stub-version=<interface format>
      
      Notice that -fvisibility (along with use of visibility attributes) can be used
      t...
      68f29dac
    • Evandro Menezes's avatar
      [CodeGen] Fix formatting and comments (NFC) · aa10f050
      Evandro Menezes authored
      llvm-svn: 363947
      aa10f050
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] gfx10 tests. NFC. · e917b3b4
      Stanislav Mekhanoshin authored
      llvm-svn: 363946
      e917b3b4
    • Sanjay Patel's avatar
      [InstCombine] add commuted variants for power-of-2 checks; NFC · d729ed8d
      Sanjay Patel authored
      llvm-svn: 363945
      d729ed8d