1. Mar 18, 2020
    • Jonas Devlieghere's avatar
      [lldb/PlatformDarwin] Be more robust in computing the SDK path with xcrun · 7aa28995
      Jonas Devlieghere authored
      The current implementation isn't very resilient when it comes to the
      output of xcrun. Currently it cannot deal with:
      
       - Trailing newlines.
       - Leading newlines and errors/warnings before the Xcode path.
       - Xcode not being named Xcode.app.
      
      This extract the logic into a helper in PlatformDarwin and fixes those
      issues. It's also the first step towards removing code duplication
      between the different platforms and downstream Swift.
      
      Differential revision: https://reviews.llvm.org/D76261
      7aa28995
    • Louis Dionne's avatar
      d177c36e
    • Simon Pilgrim's avatar
      [TargetLowering] Only demand a rotation's modulo amount bits · 68224c19
      Simon Pilgrim authored
      ISD::ROTL/ROTR rotation values are guaranteed to act as a modulo amount, so for power-of-2 bitwidths we only need the lowest bits.
      
      Differential Revision: https://reviews.llvm.org/D76201
      68224c19
    • Jon Chesterfield's avatar
      [Clang] Undef attribute for global variables · c45eaeab
      Jon Chesterfield authored
      Summary:
      [Clang] Attribute to allow defining undef global variables
      
      Initializing global variables is very cheap on hosted implementations. The
      C semantics of zero initializing globals work very well there. It is not
      necessarily cheap on freestanding implementations. Where there is no loader
      available, code must be emitted near the start point to write the appropriate
      values into memory.
      
      At present, external variables can be declared in C++ and definitions provided
      in assembly (or IR) to achive this effect. This patch provides an attribute in
      order to remove this reason for writing assembly for performance sensitive
      freestanding implementations.
      
      A close analogue in tree is LDS memory for amdgcn, where the kernel is
      responsible for initializing the memory after it starts executing on the gpu.
      Uninitalized variables in LDS are observably cheaper than zero initialized.
      
      Patch is loosely based on the cuda __shared__ and opencl __local variable
      implementation which also produces undef global variables.
      
      Reviewers: kcc, rjmccall, rsmith, glider, vitalybuka, pcc, eugenis, vlad.tsyrklevich, jdoerfert, gregrodgers, jfb, aaron.ballman
      
      Reviewed By: rjmccall, aaron.ballman
      
      Subscribers: Anastasia, aaron.ballman, davidb, Quuxplusone, dexonsmith, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D74361
      c45eaeab
    • Louis Dionne's avatar
      [lit] NFC: Fix typo in log statement · 1458bb92
      Louis Dionne authored
      1458bb92
    • Aaron Ballman's avatar
      83989e69
    • Mikhail Dvorskiy's avatar
      [pstl] A hot fix for exclusive_scan (+ lost enable_if in declaration) · 36b8d02c
      Mikhail Dvorskiy authored
      It fixes an ambiguity issue in case of a user has a custom policy and
      calls a version of exclusive_scan with binary operation.
      
      Differential Revision: https://reviews.llvm.org/D62719
      36b8d02c
    • Richard Smith's avatar
      PR45207: Fix crash if constrained-type-specifier annotation forms a · c48442c9
      Richard Smith authored
      template_id annotation when parsing a type.
      c48442c9
    • Florian Hahn's avatar
      [SCCP] Split up callsite handling, only propagate result on change (NFC) · a72ae99c
      Florian Hahn authored
      Functions include their arguments in the use-list. Changed function
      values mean that the result of the function changed. We only need
      to update the call sites with the new function result and do not
      have to propagate the call arguments.
      
      To do so, this patch splits up the visitCallSite into handleCallResult
      and handleCallArguments and updates markUsersAsChanged to only update
      call results for functions.
      
      Reviewers: efriedma, davide
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D75846
      a72ae99c
    • Paula Toth's avatar
      [libc] Resolve race condition in sub-process test runner. · 17566573
      Paula Toth authored
      Summary:
      There seems to be a race condition between the pipe closing and the child process death. Likely these two events are not atomic on some versions of linux.
      
      With the removal of `WNOHANG` we eliminate the race condition, however if the child closes the pipe intentionally then it could result in the test runner hanging. I find this situation less likely, where as I experience failures locally with this race condition rather consistently.
      
      Reviewers: sivachandra, abrachet
      
      Reviewed By: sivachandra, abrachet
      
      Subscribers: MaskRay, jfb, tschuett, libc-commits
      
      Tags: #libc-project
      
      Differential Revision: https://reviews.llvm.org/D76267
      17566573
    • Fangrui Song's avatar
      [ELF][test] Delete unneeded --no-threads · 2bd1ca28
      Fangrui Song authored
      2bd1ca28
    • Atmn Patel's avatar
      [libc++] Bugfix to std::binomial_distribution<int> · 51b78a3e
      Atmn Patel authored
      The current implementation of binomial_distribution is not guaranteed to
      converge for certain extreme configurations of the engine and distribution.
      This is due to a mistake in the implementation of the algorithm from the
      given reference paper. The algorithm in the paper is guaranteed to
      terminate but has redundant statements. The current implementation
      simplified away the redundancy into a while loop, but it excludes the
      return condition of the case where a good sample cannot be returned for
      the particular sample being used from the uniform distribution, which is
      what causes the infinite loop. This change guarantees termination by
      recognizing that a good sample cannot be returned and returning 0 after
      breaking the loop. This is also in contrast to the paper because the
      return value as specified in the paper violates basic checks in at least
      a subset of the extreme cases where the current implementation fails to
      terminate. This default return value of 0 is satisfactory for the
      extreme case known so far.
      
      Since this is only meant to affect extreme cases where the algorithm
      does not terminate anyways, the behavior is expected to remain exactly
      the same for all non-extreme cases that have been terminating so far.
      
      Fixes https://llvm.org/PR44847
      
      Differential Revision: https://reviews.llvm.org/D74997
      51b78a3e
    • Vedant Kumar's avatar
      [DwarfDebug] Fix an assertion error when emitting call site info that combines... · 526c51e6
      Vedant Kumar authored
      [DwarfDebug] Fix an assertion error when emitting call site info that combines two DW_OP_stack_values
      
      When compiling
      
      ```
      struct S {
        float w;
      };
      void f(long w, long b);
      void g(struct S s) {
        int w = s.w;
        f(w, w*4);
      }
      ```
      
      I get Assertion failed: ((!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid").
      
      That's because we combine two epxressions that both end in DW_OP_stack_value:
      
      ```
      (lldb) p Expr->dump()
      !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
      (lldb) p Param.Expr->dump()
      !DIExpression(DW_OP_constu, 4, DW_OP_mul, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
      (lldb) p CombinedExpr->isValid()
      (bool) $0 = false
      (lldb) p CombinedExpr->dump()
      !DIExpression(4097, 32, 5, 4097, 64, 5, 16, 4, 30, 4097, 32, 5, 4097, 64, 5, 159, 159)
      ```
      
      I believe that in this particular case combining two stack values is
      safe, but I didn't want to sink the special handling into
      DIExpression::append() because I do want everyone to think about what
      they are doing.
      
      Patch by Adrian Prantl.
      
      Fixes PR45181.
      rdar://problem/60383095
      
      Differential Revision: https://reviews.llvm.org/D76164
      526c51e6
    • LLVM GN Syncbot's avatar
      [gn build] Port 080dd10f · 5555c04b
      LLVM GN Syncbot authored
      5555c04b
    • Scott Constable's avatar
      Move RDF from Hexagon to Codegen · 080dd10f
      Scott Constable authored
      RDF is designed to be target agnostic. Therefore it would be useful to have it available for other targets, such as X86.
      
      Based on a previous patch by Krzysztof Parzyszek
      
      Differential Revision: https://reviews.llvm.org/D75932
      080dd10f
    • Louis Dionne's avatar
      3d9e6c42
    • Siva Chandra Reddy's avatar
      [libc] Add a new rule `add_object`. · 768ead0a
      Siva Chandra Reddy authored
      This rule can help add targets to generate special object files like the
      crt1.o on linux. Also, it can be used to add specially compiled object
      stubs which are to be linked into the entrypoint objects.
      
      Reviewers: abrachet
      
      Differential Revision: https://reviews.llvm.org/D76271
      768ead0a
    • Erich Keane's avatar
      [NFC][Attr TableGen] Emit Spelling Enum for Attr types if there >1 · 661c9506
      Erich Keane authored
      Discovered in a downstream, it is often useful to have slightly
      different semantics for an attribute based on its namespace, however our
      spelling infrastructure doesn't consider namespace when deciding to
      elide the enum list.  The result is that the solution for a case where
      an attribute has slightly different semantics based on a namespace
      requires checking against the integer value, which is fragile.
      
      This patch makes us always emit the spelling enum if there is more than
      1 and we're generating the header.
      
      Differential Revision: https://reviews.llvm.org/D76289
      661c9506
    • Sanjay Patel's avatar
      [InstCombine] reduce demand-limited bool math to logic, part 2 · be9e3d94
      Sanjay Patel authored
      Follow-on suggested in:
      D75961
      be9e3d94
    • Sanjay Patel's avatar
      [InstCombine] add tests for bool math; NFC · 586565c5
      Sanjay Patel authored
      586565c5
    • River Riddle's avatar
      [mlir] Add a hook to PatternRewriter to allow for patterns to notify why a match failed. · 5267f5e6
      River Riddle authored
      Summary:
      This revision adds a new hook, `notifyMatchFailure`, that allows for notifying the rewriter that a match failure is coming with the provided reason. This hook takes as a parameter a callback that fills a `Diagnostic` instance with the reason why the match failed. This allows for the rewriter to decide how this information can be displayed to the end-user, and may completely ignore it if desired(opt mode). For now, DialectConversion is updated to include this information in the debug output.
      
      Differential Revision: https://reviews.llvm.org/D76203
      5267f5e6
    • Huihui Zhang's avatar
      [ValueTracking][SVE] Fix isGEPKnownNonNull for scalable vector. · 1bf0c993
      Huihui Zhang authored
      Summary:
      DataLayout::getTypeAllocSize() return TypeSize. For cases where the
      scalable property doesn't matter, we should explicitly call getKnownMinSize()
      to avoid implicit type conversion to uint64_t, which is not valid for scalable
      vector type.
      
      Reviewers: sdesmalen, efriedma, apazos, reames
      
      Reviewed By: efriedma
      
      Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D76260
      1bf0c993
    • Alexey Bataev's avatar
      [OPENMP50]Mark expression in detach clause as firstprivate. · b6bcf728
      Alexey Bataev authored
      According to the standard, The event-handle will be considered as if it was specified on a firstprivate clause.
      b6bcf728
    • Craig Topper's avatar
      [SelectionDAGBuilder] Don't set MachinePointerInfo for gather when we find a uniform base · 98369178
      Craig Topper authored
      I believe we were previously calculating a pointer info with the scalar base and an offset of 0. But that's not really where the gather is pointing. The offset is a function of the indices of the GEP we looked through.
      
      Also set the size of the MachineMemOperand to UnknownSize
      
      Differential Revision: https://reviews.llvm.org/D76157
      98369178
    • shafik's avatar
      [lldb] Remove template parameters from FunctionTemplateDecl names · 9e2715aa
      shafik authored
      Fix to get the AST we generate for function templates closer to what clang generates and expects.
      We fix which FuntionDecl we are passing to CreateFunctionTemplateSpecializationInfo and we strip
      template parameters from the name when creating the FunctionDecl and FunctionTemplateDecl.
      
      These two fixes together fix asserts and ambiguous lookup issues for several cases which are added to the already existing small function template test.
      This fixes issues with overloads, overloads and ADL, variadic function templates and templated operator overloads.
      
      Differential Revision: https://reviews.llvm.org/D75761
      9e2715aa
    • Dimitry Andric's avatar
      Fix -Wdeprecated-copy-dtor and -Wdeprecated-dynamic-exception-spec warnings. · 585a3cc3
      Dimitry Andric authored
      Summary:
      The former are like:
      
      libcxx/include/typeinfo:322:11: warning: definition of implicit copy constructor for 'bad_cast' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor]
        virtual ~bad_cast() _NOEXCEPT;
                ^
      libcxx/include/typeinfo:344:11: note: in implicit copy constructor for 'std::bad_cast' first required here
          throw bad_cast();
                ^
      
      Fix these by adding an explicitly defaulted copy constructor.
      
      The latter are like:
      
      libcxx/include/codecvt:105:37: warning: dynamic exception specifications are deprecated [-Wdeprecated-dynamic-exception-spec]
          virtual int do_encoding() const throw();
                                          ^~~~~~~
      
      Fix these by using the _NOEXCEPT macro instead.
      
      Reviewers: EricWF, mclow.lists, ldionne, #libc
      
      Reviewed By: EricWF, #libc
      
      Subscribers: dexonsmith, libcxx-commits
      
      Tags: #libc
      
      Differential Revision: https://reviews.llvm.org/D76150
      585a3cc3
    • Nick Desaulniers's avatar
      [clang][AArch64] readd support for 'p' inline asm constraint · 5d90f886
      Nick Desaulniers authored
      Summary:
      Was accidentally removed by commit af64948e when it overrode
      TargetInfo::convertConstraint.
      
      Fixes: pr/45225
      
      Reviewers: eli.friedman, sdesmalen
      
      Reviewed By: sdesmalen
      
      Subscribers: echristo, sdesmalen, kristof.beyls, cfe-commits, kmclaughlin, srhines
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76297
      5d90f886
    • Jin Lin's avatar
      Revert "Support repeated machine outlining" · b9f1b8be
      Jin Lin authored
      This reverts commit 1f93b162.
      b9f1b8be
    • Sagar Jain's avatar
      [MLIR] Added llvm.fence · 76cf1403
      Sagar Jain authored
      This patch adds llvm.fence. I tried not to change the syntax much.
      
      syntax:
      
      LLVM IR
      `fence [syncscope("<target-scope>")] <ordering>`
      
      MLIR LLVM Dialect
      
      `llvm.fence [syncscope("<target-scope>")] <ordering>`
      
      example:
      LLVM IR: `fence syncscope("agent") seq_cst`
      MLIR: `llvm.fence syncscope("agent") seq_cst`
      
      Differential Revision: https://reviews.llvm.org/D75645
      76cf1403
    • Sebastian Neubauer's avatar
      [AMDGPU] Fix whole wavefront mode · 6e29846b
      Sebastian Neubauer authored
      We cannot move wwm over exec copies because the exec register needs an exact exec mask.
      
      Differential Revision: https://reviews.llvm.org/D76232
      6e29846b
    • Jin Lin's avatar
      Support repeated machine outlining · 1f93b162
      Jin Lin authored
      Summary: The following change is to allow the machine outlining can be applied for Nth times, where N is specified by the compiler option. By default the value of N is 1. The motivation is that the repeated machine outlining can further reduce code size.  Please refer to the presentation "Improving Swift Binary Size via Link Time Optimization" in LLVM Developers' Meeting in 2019.
      
      Reviewers: aschwaighofer, tellenbach, paquette
      
      Reviewed By: paquette
      
      Subscribers: tellenbach, hiraditya, llvm-commits, jinlin
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71027
      1f93b162
    • Yaxun (Sam) Liu's avatar
      [NFC] Add UsedDeclVisitor · 08ab8c9a
      Yaxun (Sam) Liu authored
      Differential Revision: https://reviews.llvm.org/D76262
      08ab8c9a
    • Sam McCall's avatar
      [clangd] Only minimally escape text when rendering to markdown. · 704cd4d5
      Sam McCall authored
      Summary:
      Conservatively escaping everything is bad in coc.nvim which shows the markdown
      to the user, and we have reports of it causing problems for other parsers.
      
      Fixes https://github.com/clangd/clangd/issues/301
      
      Reviewers: kadircet
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D75687
      704cd4d5
    • Simon Pilgrim's avatar
      [DAGCombiner] matchRotateSub - handle shift amount truncation · c9656a3b
      Simon Pilgrim authored
      Under certain circumstances we'll end up in the position where the negated shift amount will get truncated to the type specified getScalarShiftAmountTy(), so we need to test for a truncated version of the shift amount as well.
      
      This allows us to remove half of the remaining patterns tested for by X86ISelLowering's combineOrShiftToFunnelShift.
      c9656a3b
    • Simon Pilgrim's avatar
      [Verifier] Silence static analyzer null dereference warning (PR45118) · 34b8a0d5
      Simon Pilgrim authored
      As discussed on PR45118, getInlinedAtScope() shouldn't ever return null. So we can simplify the logic to an assertion and remove all other null tests.
      34b8a0d5
  2. Mar 17, 2020