1. Nov 21, 2018
    • David Carlier's avatar
      [Sanitizer] Unbreak non NetBSD builds. · a1ea566f
      David Carlier authored
      llvm-svn: 347357
      a1ea566f
    • Sanjay Patel's avatar
      [DAGCombiner] look through bitcasts when trying to narrow vector binops · 357053f2
      Sanjay Patel authored
        
      This is another step in vector narrowing - a follow-up to D53784
      (and hoping to eventually squash potential regressions seen in
      D51553).
      
      The x86 test diffs are wins, but the AArch64 diff is probably not.
      That problem already exists independent of this patch (see PR39722), but it
      went unnoticed in the previous patch because there were no regression tests
      that showed the possibility.
      
      The x86 diff in i64-mem-copy.ll is close. Given the frequency throttling
      concerns with using wider vector ops, an extra extract to reduce vector
      width is the right trade-off at this level of codegen.
      
      Differential Revision: https://reviews.llvm.org/D54392
      
      llvm-svn: 347356
      357053f2
    • David Carlier's avatar
      [Sanitizer] intercept setvbuf on other platforms where it is supported · 5ffb47b3
      David Carlier authored
      Unit tests enabled only in platform tested.
      
      Reviewers: krytarowski, vitalybuka
      
      Reviewed By: krytarowski, vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D54739
      
      llvm-svn: 347355
      5ffb47b3
    • Zachary Turner's avatar
      [CodeView] Add support for ref-qualified member functions. · c68f8957
      Zachary Turner authored
      When you have a member function with a ref-qualifier, for example:
      
      struct Foo {
        void Func() &;
        void Func2() &&;
      };
      
      clang-cl was not emitting this information. Doing so is a bit
      awkward, because it's not a property of the LF_MFUNCTION type, which
      is what you'd expect. Instead, it's a property of the this pointer
      which is actually an LF_POINTER. This record has an attributes
      bitmask on it, and our handling of this bitmask was all wrong. We
      had some parts of the bitmask defined incorrectly, but importantly
      for this bug, we didn't know about these extra 2 bits that represent
      the ref qualifier at all.
      
      Differential Revision: https://reviews.llvm.org/D54667
      
      llvm-svn: 347354
      c68f8957
    • Zachary Turner's avatar
      [CodeView] Mark this pointers as const. · 3826566c
      Zachary Turner authored
      This is for compatibility with MSVC, which also marks this pointers
      as being const-qualified.
      
      Fixes llvm.org/pr36526
      
      Differential Revision: https://reviews.llvm.org/D54736
      
      llvm-svn: 347353
      3826566c
    • Sam McCall's avatar
      [CodeComplete] Penalize inherited ObjC properties for auto-completion · 8e9baa3f
      Sam McCall authored
      Summary:
      Similar to auto-completion for ObjC methods, inherited properties
      should be penalized / direct class and category properties should
      be prioritized.
      
      Note that currently, the penalty for using a result from a base class
      (CCD_InBaseClass) is equal to the penalty for using a method as a
      property (CCD_MethodAsProperty).
      
      Reviewers: jkorous, sammccall, akyrtzi, arphaman, benlangmuir
      
      Reviewed By: sammccall, akyrtzi
      
      Subscribers: arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D53900
      
      llvm-svn: 347352
      8e9baa3f
    • Joel E. Denny's avatar
      [OpenMP] Update CHECK-DAG usage in target_parallel_codegen.cpp · 435c739f
      Joel E. Denny authored
      This patch adjusts a test not to depend on deprecated FileCheck
      behavior that permits overlapping matches within a block of CHECK-DAG
      directives.  Thus, this patch also removes uses of FileCheck's
      -allow-deprecated-dag-overlap command-line option.
      
      There were two issues in this test:
      
      1. There were sets of patterns for store instructions in which a
      pattern X could match a superset of a pattern Y.  While X appeared
      before Y, Y's intended match appeared before X's intended match.  The
      result was that X matched Y's intended match.  Under the old
      overlapping behavior, Y also matched Y's intended match.  Under the
      new non-overlapping behavior, Y had nothing left to match.  This patch
      fixes this by gathering these sets in one place and putting the most
      specific patterns (Y) before the more general patterns (X).
      
      2. The CHECK-DAG patterns involving the variables CBPADDR3 and
      CBPADDR4 were the same, but there was only one match in the text, so
      CBPADDR4 patterns had nothing to match under the new non-overlapping
      behavior.  Moreover, a preceding related series of directives had
      variables (SADDR0, BPADDR0, etc.) numbered only 0 through 4, but this
      series had variables numbered 0 through 5.  Assuming CBPADDR4's
      directives were not intended, this patch removes them.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D54765
      
      llvm-svn: 347351
      435c739f
    • Joel E. Denny's avatar
      [OpenMP] Update CHECK-DAG usage in for_codegen.cpp · d586bc6d
      Joel E. Denny authored
      This patch adjusts a test not to depend on deprecated FileCheck
      behavior that permits overlapping matches within a block of CHECK-DAG
      directives.  Thus, this patch also removes uses of FileCheck's
      -allow-deprecated-dag-overlap command-line option.
      
      Specifically, the FileCheck variables DBG_LOC_START, DBG_LOC_END, and
      DBG_LOC_CANCEL were all set to the same value.  As a result, three
      TERM_DEBUG-DAG patterns, one for each variable, all matched the same
      text under the old overlapping behavior.  Under the new
      non-overlapping behavior, that's not permitted.  This patch's solution
      is to replace these variables with one variable and replace these
      patterns with one pattern.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D54764
      
      llvm-svn: 347350
      d586bc6d
    • Zachary Turner's avatar
      [CodeView] RelocPtr points to little endian data. · d16944ee
      Zachary Turner authored
      Don't use a uint32_t*, use a ulittle32_t* to make this correct
      on big endian systems.
      
      Patch by James Clarke
      Differential Revision: https://reviews.llvm.org/D54421
      
      llvm-svn: 347349
      d16944ee
    • Craig Topper's avatar
      [X86] Emit a single shuffle for the v16i8->v4i32 step of a... · 24b346da
      Craig Topper authored
      [X86] Emit a single shuffle for the v16i8->v4i32 step of a SIGN_EXTEND_VECTOR_INREG lowering on pre-sse4.1 targets.
      
      Previously we emitted to separate shuffles, one for unpcklbw and one for unpcklwd. Instead emit a single shuffle equivalent to both of the original shuffles. Shuffle lowering seems able to handle it. This avoids a bitcast between the two shuffles which seems helpful to DAG combine.
      
      Remove the custom type legalization for v8i8->v8i32. I had put that in to avoid some almost duplicate punpcklbw instructions I was seeing, but this lowering change seems to fix that. It also fixes some duplicate shuffles seen in vector-sext.ll
      
      llvm-svn: 347348
      24b346da
    • Louis Dionne's avatar
      [libcxx] Fix threads detection on GNU/Hurd · c2b375ad
      Louis Dionne authored
      GNU/Hurd provides standard Posix threads
      
      Reviewed as https://reviews.llvm.org/D54339.
      Thanks to Samuel Thibault for the patch.
      
      llvm-svn: 347347
      c2b375ad
    • Simon Atanasyan's avatar
      [unittests] Fix ExpandTilde test to match handling home dirs with trailing slash · 13cacb27
      Simon Atanasyan authored
      The `expandTildeExpr` routine just replaces a tilde by a home dir path.
      If the home dir has a trailing slash, the result of substitution will
      contain double slashes. For example, `HOME=/foo/ ~/bar` gives `/foo//bar`.
      That corresponds to (at least) Bash behaviour because the following
      command `$HOME=/foo/ echo ~/bar` prints `/foo//bar`.
      
      The `ExpandTilde` test constructs a path expected as the `fs::expand_tilde`
      call result by calling `path::append` and the expected path has a single
      slash. This patch fixes that and allows to pass the unittest on hosts where
      the `HOME` is `/`.
      
      Differential Revision: http://reviews.llvm.org/D54752
      
      llvm-svn: 347346
      13cacb27
    • Aaron Ballman's avatar
      Silence C4709 in MSVC because it is buggy. · 02e1f191
      Aaron Ballman authored
      The diagnostic will trigger on code that does not have any comma operator, but instead default-constructs an object with an explicitly defaulted constructor as the array index argument.
      
      llvm-svn: 347345
      02e1f191
    • Marshall Clow's avatar
      Note that P0899R1 requires no work. · 422c4295
      Marshall Clow authored
      llvm-svn: 347344
      422c4295
    • Marshall Clow's avatar
      859bf407
    • Alexey Bataev's avatar
      [OPENMP][NVPTX]Improved lock/critical constructs. · 8ab0924a
      Alexey Bataev authored
      Summary: Improved support for critical constructs + omp_..._lock... constructs.
      
      Reviewers: gtbercea, kkwli0, caomhin
      
      Subscribers: guansong, jfb, openmp-commits
      
      Differential Revision: https://reviews.llvm.org/D54766
      
      llvm-svn: 347342
      8ab0924a
    • Sanjay Patel's avatar
      [x86] add tests for 8-bit multiply with constant; NFC · fa78c228
      Sanjay Patel authored
      This is based on the existing file for 16-bit. We also already have 32-bit and 64-bit variants.
      
      llvm-svn: 347341
      fa78c228
    • Sam Clegg's avatar
      [WebAssembly] WebAssemblyLowerEmscriptenEHSjLj: use getter/setter for accessing tempRet0 · 4791a668
      Sam Clegg authored
      Rather than assuming that `tempRet0` exists in linear memory only assume
      the getter/setter functions exist.  This avoids conflicting with
      binaryen which declares a wasm global for this purpose and defines it's
      own getter and setter for that.
      
      The other advantage of doing things this way is that it leaving
      it up to the linker/finalizer to decide how to actually store this
      temporary.  As it happens binaryen uses a wasm global which is more
      appropriate since it is thread safe.
      
      This also allows us to change the way this is stored in the future
      (memory, TLS memory, wasm global) without modifying LLVM.
      
      This is part of a 4 part change:
      LLVM: https://reviews.llvm.org/D53240
      fastcomp: https://github.com/kripken/emscripten-fastcomp/pull/237
      emscripten: https://github.com/kripken/emscripten/pull/7358
      binaryen: https://github.com/WebAssembly/binaryen/pull/1709
      
      Differential Revision: https://reviews.llvm.org/D53240
      
      llvm-svn: 347340
      4791a668
    • Roman Lebedev's avatar
      [clang][Parse] Diagnose useless null statements / empty init-statements · 377748fd
      Roman Lebedev authored
      Summary:
      clang has `-Wextra-semi` (D43162), which is not dictated by the currently selected standard.
      While that is great, there is at least one more source of need-less semis - 'null statements'.
      Sometimes, they are needed:
      ```
      for(int x = 0; continueToDoWork(x); x++)
        ; // Ugly code, but the semi is needed here.
      ```
      
      But sometimes they are just there for no reason:
      ```
      switch(X) {
      case 0:
        return -2345;
      case 5:
        return 0;
      default:
        return 42;
      }; // <- oops
      
      ;;;;;;;;;;; <- OOOOPS, still not diagnosed. Clearly this is junk.
      ```
      
      Additionally:
      ```
      if(; // <- empty init-statement
         true)
        ;
      
      switch (; // empty init-statement
              x) {
        ...
      }
      
      for (; // <- empty init-statement
           int y : S())
        ;
      }
      
      As usual, things may or may not go sideways in the presence of macros.
      While evaluating this diag on my codebase of interest, it was unsurprisingly
      discovered that Google Test macros are *very* prone to this.
      And it seems many issues are deep within the GTest itself, not
      in the snippets passed from the codebase that uses GTest.
      
      So after some thought, i decided not do issue a diagnostic if the semi
      is within *any* macro, be it either from the normal header, or system header.
      
      Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=39111 | PR39111 ]]
      
      Reviewers: rsmith, aaron.ballman, efriedma
      
      Reviewed By: aaron.ballman
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D52695
      
      llvm-svn: 347339
      377748fd
    • Michal Gorny's avatar
      [cmake] Fix detecting terminfo library · 4b0b84f4
      Michal Gorny authored
      Copy the fix for determining the correct terminfo library from LLVM --
      use distinct variables for check_library_exists() calls.  Otherwise,
      the first check (for -ltinfo) populates the variable and no other checks
      are performed.  Effectively, systems with other libraries than the first
      one listed are presumed not to have terminfo routines at all.
      
      Also sync the check order to include the NetBSD fix from r347156.
      
      This partially fixes undefined symbols when linking XRay tests.  It's
      probably not the best solution to the problem there but as long
      as the terminfo check stays in config-ix, I thnk it's worth fixing.
      
      Differential Revision: https://reviews.llvm.org/D54641
      
      llvm-svn: 347338
      4b0b84f4
    • Michal Gorny's avatar
      [unittest] Skip W+X MappedMemoryTests when MPROTECT is enabled · 1b25ba07
      Michal Gorny authored
      Skip all MappedMemoryTest variants that rely on memory pages being
      mapped for MF_WRITE|MF_EXEC when MPROTECT is enabled on NetBSD.  W^X
      protection causes all those mmap() calls to fail, causing the tests
      to fail.
      
      Differential Revision: https://reviews.llvm.org/D54080
      
      llvm-svn: 347337
      1b25ba07
    • Vitaly Buka's avatar
      [tsan] Add __cxa_guard_acquire hooks to support cooperative scheduling · afedb893
      Vitaly Buka authored
      Reviewers: dvyukov
      
      Subscribers: krytarowski, kubamracek, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D54664
      
      llvm-svn: 347336
      afedb893
    • Simon Pilgrim's avatar
      [X86] Remove -verify-machineinstrs=0 now that PR38391 is fixed. · 368a1992
      Simon Pilgrim authored
      llvm-svn: 347335
      368a1992
    • Leonard Chan's avatar
      9ede953a
    • Sanjay Patel's avatar
      [InstCombine] add tests for funnel shifts; NFC · 96152dcb
      Sanjay Patel authored
      These are included in D54666, so adding them first with baseline results.
      
      Patch by: @nikic (Nikita Popov)
      
      llvm-svn: 347333
      96152dcb
    • Sanjay Patel's avatar
      [InstSimplify] fold funnel shifts with undef operands · 14ab9170
      Sanjay Patel authored
      Splitting these off from the D54666.
      
      Patch by: nikic (Nikita Popov)
      
      llvm-svn: 347332
      14ab9170
    • Sanjay Patel's avatar
      [InstSimplify] add tests for funnel shift with undef operands; NFC · 2778f56a
      Sanjay Patel authored
      These are part of D54666, so adding them here before the patch to
      show the baseline (currently unoptimized) results.
      
      Patch by: @nikic (Nikita Popov)
      
      llvm-svn: 347331
      2778f56a
    • Sanjay Patel's avatar
      [InstructionSimplify] Add support for saturating add/sub · eea21da1
      Sanjay Patel authored
      Add support for saturating add/sub in InstructionSimplify. In particular, the following simplifications are supported:
      
          sat(X + 0) -> X
          sat(X + undef) -> -1
          sat(X uadd MAX) -> MAX
          (and commutative variants)
      
          sat(X - 0) -> X
          sat(X - X) -> 0
          sat(X - undef) -> 0
          sat(undef - X) -> 0
          sat(0 usub X) -> 0
          sat(X usub MAX) -> 0
      
      Patch by: @nikic (Nikita Popov)
      
      Differential Revision: https://reviews.llvm.org/D54532
      
      llvm-svn: 347330
      eea21da1
    • Samuel Benzaquen's avatar
      Add benchmarks for sorting and heap functions. · 06a9b5a3
      Samuel Benzaquen authored
      Summary:
      Benchmarks for std::sort, std::stable_sort, std::make_heap,
      std::sort_heap, std::pop_heap and std::push_heap.
      
      The benchmarks are run with integers and strings, and with different
      sorted input.
      
      Reviewers: EricWF
      
      Subscribers: christof, mgrang, ldionne, libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D53978
      
      llvm-svn: 347329
      06a9b5a3
    • Sanjay Patel's avatar
      [ConstantFolding] Add support for saturating add/sub · efc3d1df
      Sanjay Patel authored
      Support saturating add/sub in constant folding, based on the APInt methods introduced in D54332.
      
      Patch by: @nikic (Nikita Popov)
      
      Differential Revision: https://reviews.llvm.org/D54531
      
      llvm-svn: 347328
      efc3d1df
    • Fangrui Song's avatar
      [ELF] Allow --noinhibit-exec to produce corrupted executable with relocation overflow · 537a5bfb
      Fangrui Song authored
      Summary:
      When --noinhibit-exec is used, ld.bfd/gold emit errors but allow to produce corrupted executable, which is handy for debugging purpose. lld's --noinhibit-exec has a different meaning and changes some errors to warnings. This patch replaces "error" with "errorOrWarn" to exploit that property.
      
      We may revisit this: if we should keep them as errors (as ld.bfd/gold do) but allow to produce a (corrupted) executable.
      
      Reviewers: ruiu, grimar, espindola
      
      Reviewed By: grimar
      
      Subscribers: Timmmm, jhenderson, emaste, arichardson, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D54651
      
      llvm-svn: 347327
      537a5bfb
    • Simon Pilgrim's avatar
      [AMDGPU] Regenerate weird stores tests. · bac49ac4
      Simon Pilgrim authored
      Makes an upcoming SimplifyDemandedBits optimization much easier to understand.
      
      llvm-svn: 347326
      bac49ac4
    • Guozhi Wei's avatar
      [LoopSink] Add preheader to alias set · c21fba1b
      Guozhi Wei authored
      This patch fixes PR39695.
      
      The original LoopSink only considers memory alias in loop body. But PR39695 shows that instructions following sink candidate in preheader should also be checked. This is a conservative patch, it simply adds whole preheader block to alias set. It may lose some optimization opportunity, but I think that is very rare because: 1 in the most common case st/ld to the same address, the load should already be optimized away. 2 usually preheader is not very large. 
      
      Differential Revision: https://reviews.llvm.org/D54659
      
      llvm-svn: 347325
      c21fba1b
    • Sanjay Patel's avatar
      [APInt] Add methods for saturated add and sub · 7ef0b313
      Sanjay Patel authored
      This adds the sadd_sat, uadd_sat, ssub_sat, usub_sat methods for performing saturating additions and subtractions to APInt.
      
      Split out from D54237.
      
      Patch by: nikic (Nikita Popov)
      
      Differential Revision: https://reviews.llvm.org/D54332
      
      llvm-svn: 347324
      7ef0b313
    • Stella Stamenova's avatar
      [lit] Build and link TestIRMemoryMapWindows explicitly · 8ce71fb2
      Stella Stamenova authored
      If we just invoke clang-cl without specifying the linker, the tests fail on Windows because they cannot find the correct linker to use, so it needs to be specified explicitly
      
      llvm-svn: 347323
      8ce71fb2
    • Erich Keane's avatar
      [NFC] Remove MS line endings in diagnostics file. · e6aad848
      Erich Keane authored
      Change-Id: I74704acf052e2e8fe707f18230bc5655c2bf2a91
      llvm-svn: 347322
      e6aad848
    • Stella Stamenova's avatar
      [lit] Disable the stop hook tests on Windows · 193aa967
      Stella Stamenova authored
      These tests are not able to pass on Windows as written as they don't even build
      
      llvm-svn: 347321
      193aa967
    • Bruno Ricci's avatar
      [AST] Store the expressions in ParenListExpr in a trailing array · f49e1ca0
      Bruno Ricci authored
      Use the newly available space in the bit-fields of Stmt
      and store the expressions in a trailing array. This saves
      2 pointer per ParenListExpr.
      
      Differential Revision: https://reviews.llvm.org/D54675
      
      Reviewed By: rjmccall
      
      llvm-svn: 347320
      f49e1ca0
    • Bruno Ricci's avatar
      [AST][NFC] Factor out some repeated code in ArraySubscriptExpr. · 855dfee2
      Bruno Ricci authored
      Factor out the test for whether the LHS is the base of the
      array subscript expression into a private method lhsIsBase.
      
      NFC.
      
      llvm-svn: 347319
      855dfee2
    • Sanjay Patel's avatar
      [PatternMatch] Handle undef vectors consistently · f5ead29b
      Sanjay Patel authored
      This patch fixes the issue noticed in D54532. 
      The problem is that cst_pred_ty-based matchers like m_Zero() currently do not match 
      scalar undefs (as expected), but *do* match vector undefs. This may lead to optimization 
      inconsistencies in rare cases.
      
      There is only one existing test for which output changes, reverting the change from D53205. 
      The reason here is that vector fsub undef, %x is no longer matched as an m_FNeg(). While I 
      think that the new output is technically worse than the previous one, it is consistent with 
      scalar, and I don't think it's really important either way (generally that undef should have 
      been folded away prior to reassociation.)
      
      I've also added another test case for this issue based on InstructionSimplify. It took some 
      effort to find that one, as in most cases undef folds are either checked first -- and in the 
      cases where they aren't it usually happens to not make a difference in the end. This is the 
      only case I was able to come up with. Prior to this patch the test case simplified to undef 
      in the scalar case, but zeroinitializer in the vector case.
      
      Patch by: @nikic (Nikita Popov)
      
      Differential Revision: https://reviews.llvm.org/D54631
      
      llvm-svn: 347318
      f5ead29b