1. Mar 31, 2021
  2. Mar 30, 2021
    • Nikita Popov's avatar
      [FastISel] Don't trivially kill extractvalues (PR49467) · f05b6496
      Nikita Popov authored
      All extractvalues of the same value at the same index will map to
      the same register, so even if one specific extractvalue only has
      one use, we should not mark it as a trivial kill, as there may be
      more extractvalues later.
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=49467.
      
      Differential Revision: https://reviews.llvm.org/D98145
      
      (cherry picked from commit 55ae279b)
      f05b6496
    • Joseph Huber's avatar
      [OpenMP] Restore backwards compatibility for libomptarget · e89cdf89
      Joseph Huber authored
      Summary:
      The changes introduced in D87946 changed the API for libomptarget
      functions. `__kmpc_push_target_tripcount` was a function in Clang 11.x
      but was not given a backward-compatible interface. This change will
      require people using Clang 13.x or 12.x to recompile their offloading
      programs.
      
      Reviewed By: jdoerfert cchen
      
      Differential Revision: https://reviews.llvm.org/D98358
      
      (cherry picked from commit 807466ef)
      e89cdf89
    • Nikita Popov's avatar
      [PowerPC] Fix infinite loop in peephole CR optimization (PR49509) · 8ca56905
      Nikita Popov authored
      If we encounter a degenerate select node where both operands are
      the same, then we can continue negating the condition while swapping
      operands, resulting in an infinite loop. Avoid this by bailing out
      if both operands are the same.
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=49509.
      
      Differential Revision: https://reviews.llvm.org/D98340
      
      (cherry picked from commit 2489cbaa)
      8ca56905
    • Shilei Tian's avatar
      [OpenMP] Fixed a crash in hidden helper thread · f43958b7
      Shilei Tian authored
      It is reported that after enabling hidden helper thread, the program
      can hit the assertion `new_gtid < __kmp_threads_capacity` sometimes. The root
      cause is explained as follows. Let's say the default `__kmp_threads_capacity` is
      `N`. If hidden helper thread is enabled, `__kmp_threads_capacity` will be offset
      to `N+8` by default. If the number of threads we need exceeds `N+8`, e.g. via
      `num_threads` clause, we need to expand `__kmp_threads`. In
      `__kmp_expand_threads`, the expansion starts from `__kmp_threads_capacity`, and
      repeatedly doubling it until the new capacity meets the requirement. Let's
      assume the new requirement is `Y`.  If `Y` happens to meet the constraint
      `(N+8)*2^X=Y` where `X` is the number of iterations, the new capacity is not
      enough because we have 8 slots for hidden helper threads.
      
      Here is an example.
      ```
      #include <vector>
      
      int main(int argc, char *argv[]) {
        constexpr const size_t N = 1344;
        std::vector<int> data(N);
      
      #pragma omp parallel for
        for (unsigned i = 0; i < N; ++i) {
          data[i] = i;
        }
      
      #pragma omp parallel for num_threads(N)
        for (unsigned i = 0; i < N; ++i) {
          data[i] += i;
        }
      
        return 0;
      }
      ```
      My CPU is 20C40T, then `__kmp_threads_capacity` is 160. After offset,
      `__kmp_threads_capacity` becomes 168. `1344 = (160+8)*2^3`, then the assertions
      hit.
      
      Reviewed By: protze.joachim
      
      Differential Revision: https://reviews.llvm.org/D98838
      
      (cherry picked from commit 2df65f87)
      f43958b7
    • Sanjay Patel's avatar
      [SimplifyCFG] avoid sinking insts within an infinite-loop · e94372d1
      Sanjay Patel authored
      The test is reduced from a C source example in:
      https://llvm.org/PR49541
      
      It's possible that the test could be reduced further or
      the predicate generalized further, but it seems to require
      a few ingredients (including the "late" SimplifyCFG options
      on the RUN line) to fall into the infinite-loop trap.
      
      (cherry picked from commit bd197ed0)
      e94372d1
    • Alexandre Ganea's avatar
      [Support] Fix 'keeping' temporary files on Windows 7 · f4c01f33
      Alexandre Ganea authored
      As reported here: https://bugs.llvm.org/show_bug.cgi?id=48378#c0
      and here: https://github.com/rust-lang/rust/issues/81051
      since 79657e23, some programs such as llvm-ar
      don't work properly on Windows 7.
      
      The issue is shown in the snippet by Oleksandr Prodan:
      https://pastebin.com/v51m3uBU
      
      In essence, once the 'DeleteFile' flag has been set on FILE_DISPOSITION_INFO,
      the file path can't be queried anymore with GetFinalPathNameByHandleW. This
      however works on Windows 10, GetFinalPathNameByHandleW would return sucessfully.
      
      To workaround the issue, we simply reset the 'DeleteFile' flag before even
      checking if we're dealing with a network file.
      
      Tested with `llvm-ar r empty.a a.obj` ran on a network mount. At the moment, we
      cannot specifically add a test coverage for this, since it requres mounting a
      network drive.
      
      (cherry picked from commit 64ab2b68)
      f4c01f33
  3. Mar 20, 2021
  4. Mar 19, 2021
  5. Mar 16, 2021
  6. Mar 13, 2021
  7. Mar 09, 2021
    • Raul Tambre's avatar
      [CMake][compiler-rt] Use copying instead of symlinking for LSE builtins on non-Unix-likes · 15d1ee36
      Raul Tambre authored
      As reported in D93278 post-review symlinking requires privilege escalation on Windows.
      Copying is functionally same, so fallback to it for systems that aren't Unix-like.
      This is similar to the solution in AddLLVM.cmake.
      
      Reviewed By: ikudrin
      
      Differential Revision: https://reviews.llvm.org/D98111
      
      (cherry picked from commit ba860963)
      15d1ee36
    • Craig Topper's avatar
      [TargetLowering] Use HandleSDNodes to prevent nodes from being deleted by... · bff59aca
      Craig Topper authored
      [TargetLowering] Use HandleSDNodes to prevent nodes from being deleted by recursive calls in getNegatedExpression.
      
      For binary or ternary ops we call getNegatedExpression multiple
      times and then compare costs. While we're doing this we need to
      hold a node from the first call across the second call, but its
      not yet attached to the DAG. Its possible the second call creates
      an identical node and then decides it didn't need it so will try
      to delete it if it has no uses. This can cause a reference to the
      node we're holding further up the call stack to become invalidated.
      
      To prevent this, we can use a HandleSDNode to artifically give
      the node a use without connecting it to the DAG.
      
      I've used a std::list of HandleSDNodes so we can create handles
      only when we have a node to hold. HandleSDNode does not have
      default constructor and cannot be copied or moved.
      
      Fixes PR49393.
      
      Reviewed By: spatel
      
      Differential Revision: https://reviews.llvm.org/D97914
      
      (cherry picked from commit 74e6030b)
      bff59aca
    • Juneyoung Lee's avatar
      [LoopVectorize] Fix VPRecipeBuilder::createEdgeMask to correctly generate the mask · a123beac
      Juneyoung Lee authored
      This patch fixes pr48832 by correctly generating the mask when a poison value is involved.
      
      Consider this CFG (which is a part of the input):
      
      ```
      for.body:                                         ; preds = %for.cond
        br i1 true, label %cond.false, label %land.rhs
      
      land.rhs:                                         ; preds = %for.body
        br i1 poison, label %cond.end, label %cond.false
      
      cond.false:                                       ; preds = %for.body, %land.rhs
        br label %cond.end
      
      cond.end:                                         ; preds = %land.rhs, %cond.false
        %cond = phi i32 [ 0, %cond.false ], [ 1, %land.rhs ]
      
      ```
      
      The path for.body -> land.rhs -> cond.end should be taken when 'select i1 false, i1 poison, i1 false' holds (which means it's never taken); but VPRecipeBuilder::createEdgeMask was emitting 'and i1 false, poison' instead.
      The former one successfully blocks poison propagation whereas the latter one doesn't, making the condition poison and thus causing the miscompilation.
      
      SimplifyCFG has a similar bug (which didn't expose a real-world bug yet), and a patch for this is also ongoing (see https://reviews.llvm.org/D95026).
      
      Reviewed By: bjope
      
      Differential Revision: https://reviews.llvm.org/D95217
      
      (cherry picked from commit ed253ef7)
      a123beac
    • Nathan James's avatar
      [clang-tidy] Deprecate readability-deleted-default check · f8b32989
      Nathan James authored
      ... For removal in next release cycle.
      The clang warning that does the same thing is enabled by default and typically emits better diagnostics making this check surplus to requirements.
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D97491
      
      (cherry picked from commit 19aefd2d)
      f8b32989
    • LemonBoy's avatar
      [AArch64] Legalize horizontal fmax/fmin reductions on f16 vectors · 46a1b065
      LemonBoy authored
      Expand the horizontal reduction during the instruction selection phase, but only if the target doesn't support the full fp16 instruction set.
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=49401
      
      Reviewed By: aemerson
      
      Differential Revision: https://reviews.llvm.org/D97840
      
      (cherry picked from commit 8725b24c)
      46a1b065
  8. Mar 06, 2021
  9. Mar 04, 2021
  10. Mar 03, 2021
  11. Mar 02, 2021
  12. Feb 25, 2021
  13. Feb 24, 2021
  14. Feb 23, 2021