1. Apr 08, 2023
    • Zain Jaffal's avatar
      Recommit "Add an option to print out annotation remark count." · db01cf7b
      Zain Jaffal authored
      Add missing new line for `llvm/docs/CommandGuide/llvm-remarkutil.rst`
      
      This reverts commit 0f7fcb4c.
      db01cf7b
    • Zain Jaffal's avatar
      Revert "Add an option to print out annotation remark count." · 0f7fcb4c
      Zain Jaffal authored
      This reverts commit 7cc80ef5.
      0f7fcb4c
    • Amaury Séchet's avatar
      5aa7ad36
    • Xiang Li's avatar
      [clang:diagnostics] Turning off warn_self_assignment_overloaded for... · c5302325
      Xiang Li authored
      [clang:diagnostics] Turning off warn_self_assignment_overloaded for user-defined compound assignments
      
      Fixes 42469 https://github.com/llvm/llvm-project/issues/42469
      
      Only check self assignment on BO_Assign when BuildOverloadedBinOp.
      c5302325
    • Zain Jaffal's avatar
      Add an option to print out annotation remark count. · 7cc80ef5
      Zain Jaffal authored
      This adds a `annotation-count` option to llvm-remarkutil.
      
      ```
      llvm-remarkutil annotation-count -remark=REMARK
      ```
      This will print out the remark count for a pass that uses annotation remarks.
      
      Differential Revision: https://reviews.llvm.org/D147710
      7cc80ef5
    • MalavikaSamak's avatar
      [-Wunsafe-buffer-usage] FixableGadget for handling stand alone pointers under UPC · a046d187
      MalavikaSamak authored
      This patch introduces UPCStandalonePointerGadget, a FixableGadget that emits fixits to
      handle cases where a pointer identified as unsafe is simply referenced. An example of
      such a case is when the pointer is input as an argument to a method call, where we can
      not change the type of the argument. For cases where the strategy for the unsafe pointer is
      to use std::span, the idea is to extract the underlying pointer by invoking the "data()"
      method on the span instance.
      
      For example, the gadget emits a fixit for S3, where S1, S2 are handled by other gadgets:
        S1: int *ptr = new int[10];
        S2: int val1 = ptr[k]; // Unsafe operation on ptr
        S3: foo(ptr); // Some method that accepts raw pointer => FIXIT: foo(ptr.data());
      
      Reviewed by: NoQ, ziqingluo-90, jkorous
      
      Differential revision: https://reviews.llvm.org/D143676
      a046d187
    • Balaji V. Iyer's avatar
      [mlir][math]Expand Fused math.fmaf to a multiply-add · a7c2102d
      Balaji V. Iyer authored
      Fused multiply and add are being pushed directly to the libm. This is problematic
      for situations where libm is not available. This patch will break down a fused multiply and
      add into a multiply followed by an add.
      
      Reviewed By: rsuderman
      
      Differential Revision: https://reviews.llvm.org/D147811
      a7c2102d
    • David Blaikie's avatar
    • Ben Hamilton's avatar
      [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser · 00ea6798
      Ben Hamilton authored
      Apple added a new NS_ERROR_ENUM macro to help define enums for
      NSError codes.
      
      This updates libformat's Objective-C language-guessing heuristic
      to detect the new macro as well as related NSError types.
      
      Tested: New tests added.
      
      Reviewed By: MyDeveloperDay
      
      Differential Revision: https://reviews.llvm.org/D147577
      00ea6798
    • Blue Gaston's avatar
      [Sanitizers][Atos] Remove null-ing of atos process pointer · 0f9bfe0a
      Blue Gaston authored
      Currently, when we send an address to atos to be symbolized, it is
      expected that atos returns with more than it was sent, i.e. symbol
      information for that address. In the case where only the address is
      returned, we currently null the pointer to the atos process. Typically,
      for modules where no symbolication is expected, we do not send the
      address to atos.
      
      However, in new simulators there is an early call that atos does not
      return any symbol information for. And in this case, because we have
      gotten rid of the pointer to the process, no subsequent frames are
      symbolicated, even tho atos is still working/running.
      
      This patch removes the nulling of the pointer to the process. This
      allows subsequent calls to atos even after an unexpected result.
      It also now Reports what has happened and the address this occurred.
      
      This will improve symbolication in cases where we get an unepxected
      result, and will make it easier to diagnose atos if it is not
      symbolicating as expected.
      
      Filed a radar about the change of behavior 107621524
      
      rdar://107169715
      
      Differential Revision: https://reviews.llvm.org/D147725
      0f9bfe0a
    • Valentin Clement's avatar
      [flang][NFC] Add select type test to check correct ordering · 5315ca69
      Valentin Clement authored
      Somehow this test has been left behind in my sandbox. This
      patch adds a lowering test for fir.select_type operation and
      makes sure the dynamic type comaparison is done in the right
      order when we have multiple CLASS IS type guard statement
      for types that are linked.
      
      This should have been posted with D138280.
      
      Reviewed By: PeteSteinfeld
      
      Differential Revision: https://reviews.llvm.org/D147807
      5315ca69
    • Eli Friedman's avatar
      [COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols · fffdb7ea
      Eli Friedman authored
      This is mostly useful for ARM64EC, which uses such symbols extensively.
      
      One interesting quirk of ARM64EC is that we need to be able to emit weak
      symbols that point at each other (so if either symbol is defined
      elsewhere, both symbols point at the definition).  This required a few
      changes to the way we handle weak symbols on Windows.
      
      Differential Revision: https://reviews.llvm.org/D145208
      fffdb7ea
    • Jonas Devlieghere's avatar
      [JSON] Fix uninitialized variable warning · 4b465094
      Jonas Devlieghere authored
      Fix uninitialized variable warning when deserializing a std::optional<E>
      where is an enum type.
      
      JSON.h:771:20: warning: variable 'Result' is uninitialized when used here [-Wuninitialized]
        if (!fromJSON(E, Result, P))
                         ^~~~~~
      4b465094
    • Alex Langford's avatar
      [lldb] Add unittests for a few FileSpec methods · de5f96e9
      Alex Langford authored
      This adds tests for:
      - FileSpec::TestFileNameExtensions
      - FileSpec::TestFileNameStrippingExtension
      - FileSpec::IsSourceImplementationFile
      
      This additionally updates incorrect documentation.
      
      Differential Revision: https://reviews.llvm.org/D147801
      de5f96e9
    • Manna, Soumi's avatar
      [NFC][clang] Fix static analyzer tool remarks about large copies by values · 33cf2a39
      Manna, Soumi authored
              Reported by Coverity:
      
              Big parameter passed by value
              Copying large values is inefficient, consider passing by reference; Low, medium, and high size thresholds for detection can be adjusted.
      
             1. Inside "SemaConcept.cpp" file, in subsumes<clang::Sema::MaybeEmitAmbiguousAtomicConstraintsDiagnostic(clang::NamedDecl *, llvm::ArrayRef<clang::Expr const *>, clang::NamedDecl *, llvm::ArrayRef<clang::Expr const *>)::[lambda(clang::AtomicConstraint const &, clang::AtomicConstraint const &) (instance 2)]>(llvm::SmallVector<llvm::SmallVector<clang::AtomicConstraint *, 2u>, 4u>, llvm::SmallVector<llvm::SmallVector<clang::AtomicConstraint *, 2u>, 4u>, T1): A large function call parameter exceeding the low threshold is passed by value.
      
              i. pass_by_value: Passing parameter PDNF of type NormalForm (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.
      
              ii. pass_by_value: Passing parameter QCNF of type NormalForm (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.
      
              2. Inside "CodeGenAction.cpp" file, in clang::reportOptRecordError(llvm::Error, clang::DiagnosticsEngine &, clang::CodeGenOptions): A very large function call parameter exceeding the high threshold is passed by value.
      
              i. pass_by_value: Passing parameter CodeGenOpts of type clang::CodeGenOptions const (size 1560 bytes) by value, which exceeds the high threshold of 512 bytes.
      
              3. Inside "SemaCodeComplete.cpp" file, in HandleCodeCompleteResults(clang::Sema *, clang::CodeCompleteConsumer *, clang::CodeCompletionContext, clang::CodeCompletionResult *, unsigned int): A large function call parameter exceeding the low threshold is passed by value.
      
              i. pass_by_value: Passing parameter Context of type clang::CodeCompletionContext (size 200 bytes) by value, which exceeds the low threshold of 128 bytes.
      
              4. Inside "SemaConcept.cpp" file, in <unnamed>::SatisfactionStackRAII::SatisfactionStackRAII(clang::Sema &, clang::NamedDecl const *, llvm::FoldingSetNodeID): A large function call parameter exceeding the low threshold is passed by value.
      
              i. pass_by_value: Passing parameter FSNID of type llvm::FoldingSetNodeID (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.
      
              Reviewed By: erichkeane, aaron.ballman
      
              Differential Revision: https://reviews.llvm.org/D147708
      33cf2a39
    • Alexey Bataev's avatar
      85327f30
    • Noah Goldstein's avatar
      [InstCombine] Improve transforms for `(mul X, Y)` -> `(shl X, log2(Y)` · 513251b7
      Noah Goldstein authored
      Using the more robust log2 search allows us to fold more cases (same
      logic as exists for idiv/irem).
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D146347
      513251b7
    • Noah Goldstein's avatar
      40b637f4
    • Alexander Shaposhnikov's avatar
      [Clang][Sema] Add MultiLevelTemplateArgumentList::dump · f799901c
      Alexander Shaposhnikov authored
      Add MultiLevelTemplateArgumentList::dump
      (similarly to TemplateArgument::dump).
      
      Differential revision: https://reviews.llvm.org/D147744
      f799901c
    • wren romano's avatar
      [mlir][sparse] Simplifying Merger::expContainsTensor · 686ef4b4
      wren romano authored
      `expContainsTensor` used to call `expIsTensor` to short-circuit the recursive calls; however, the very first thing `expContainsTensor` does is to check `expIsTensor`, so the short-circuiting code just causes the function to check that condition redundantly.
      
      Depends On D146684
      
      Reviewed By: aartbik
      
      Differential Revision: https://reviews.llvm.org/D146688
      686ef4b4
    • Alex Brachet's avatar
      [libc] Add baremetal abort · d159c372
      Alex Brachet authored
      Differential Revision: https://reviews.llvm.org/D147795
      d159c372
    • Jim Ingham's avatar
      [lldb] Move "SelectMostRelevantFrame" from Thread::WillStop · 730c8e16
      Jim Ingham authored
      SelectMostRelevantFrame triggers the StackFrameRecognizer construction,
      which can run arbitrary Python code, call expressions etc. WillStop gets
      called on every private stop while the recognizers are a user-facing
      feature, so first off doing this work on every stop is inefficient. But
      more importantly, you can get in to situations where the recognizer
      causes an expression to get run, then when we fetch the stop event at
      the end of the expression evaluation, we call WillStop again on the
      expression handling thread, which will do the same StackFrameRecognizer
      work again. If anyone is locking along that path, you will end up with a
      deadlock between the two threads.
      
      The example that brought this to my attention was the
      objc_exception_throw recognizer which can cause the objc runtime
      introspection functions to get run, and those take a lock in
      AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap
      along this path, so the second thread servicing the expression deadlocks
      against the first thread waiting for the expression to complete.
      
      It makes more sense to have the frame recognizers run on demand, either
      when someone asks for the variables for the frame, or when someone does
      GetSelectedFrame. The former already worked that way, the only reason
      this was being done in WillStop was because the StackFrameRecognizers
      can change the SelectedFrame, so you needed to run them before the
      anyone requested the SelectedFrame.
      
      This patch moves SelectMostRelevantFrame to StackFrameList, and runs it
      when GetSelectedFrame is called for the first time on a given stop. If
      you call SetSelectedFrame before GetSelectedFrame, then you should NOT
      run the recognizer & change the frame out from under you. This patch
      also makes that work. There were already tests for this behavior, and
      for the feature that caused the hang, but the hang is racy, and it
      doesn't trigger all the time, so I don't have a way to test that
      explicitly.
      
      One more detail: it's actually pretty easy to end up calling
      GetSelectedFrame, for instance if you ask for the best ExecutionContext
      from an ExecutionContextRef it will fill the StackFrame with the result
      of GetSelectedFrame and that would still have the same problems if this
      happens on the Private State Thread. So this patch also short-circuits
      SelectMostRelevantFrame if run on the that thread. I can't think of any
      reason the computations that go on on the Private State Thread would
      actually want the SelectedFrame - that's a user-facing concept, so
      avoiding that complication is the best way to go.
      
      rdar://107643231
      
      Differential revision: https://reviews.llvm.org/D147753
      730c8e16
    • Alexey Bataev's avatar
      [SLP][NFC]Improve SLP time by precomputing value<->gather nodes · 6ff177d9
      Alexey Bataev authored
      dependencies.
      
      Improved compiled time by the precomputing the mapping between gathered
      scalars and their gather/buildvector nodes for later use in
      isGatherShuffledEntry to avoid recomputing this map each time this
      function is called.
      6ff177d9
    • Nikolas Klauser's avatar
      [libc++] Reject standard attributes which are extensions in libcpp-uglify-attributes · c6afeda8
      Nikolas Klauser authored
      This adds a list of attributes which can be pretty to be able to reject attributes which were introduced in a later C++ standard.
      Fixes #61196
      
      Reviewed By: Mordante, #libc
      
      Spies: mikhail.ramalho, jdoerfert, libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D145508
      c6afeda8
    • Michael Jones's avatar
      d92b5852
    • Valentin Clement's avatar
      [flang] Handle correctly user defined assignment for allocatable component · 3acdd596
      Valentin Clement authored
      In the Fortran standard 2018 section 10.2.1.3 (13), it is mentioned
      that all noncoarray allocatable component must follow this sequence of
      operations:
      
      1) If the component of the variable is allocated, it is deallocated.
      2) If the component of the value of expr is allocated, the corresponding
         component of the variable is allocated with the same dynamic type and
         type parameters as the component of the value of expr. If it is an
         array, it is allocated with the same bounds. The value of the
         component of the value of expr is then assigned to the corresponding
         component of the variable using defined assignment if the declared type
         of the component has a type-bound defined assignment consistent with the
         component, and intrinsic assignment for the dynamic type of that component
         otherwise.
      
      This patch updates the code to make use of the user defined assignment for
      allocatable component and make sure the component is allocated correctly.
      
      Reviewed By: klausler
      
      Differential Revision: https://reviews.llvm.org/D147797
      3acdd596
    • Alexander Shaposhnikov's avatar
      Revert "[Clang][Sema] Fix comparison of constraint expressions" · 13d44a8f
      Alexander Shaposhnikov authored
      This temporarily reverts commit
      60bee9ff.
      The diff will be recommitted once the newly discovered
      regressions are fixed.
      13d44a8f
    • Bill Wendling's avatar
      [Clang] Improve designated inits diagnostic location · 2cbf5127
      Bill Wendling authored
      A "null" designator won't have a valid location. Try to approximate this
      location as best we can in that situation.
      
      Closes 61118
      Closes 46132
      
      Reviewed By: shafik
      
      Differential Revision: https://reviews.llvm.org/D147673
      2cbf5127
    • Robert Suderman's avatar
      [mlir] Add tests accidentally removed from arith expand-ops · d585a8af
      Robert Suderman authored
      Some tests were accidentally removed due to debug code being included.
      Readding the tests to guarantee coverage.
      
      Reviewed By: NatashaKnk
      
      Differential Revision: https://reviews.llvm.org/D147796
      d585a8af
    • LLVM GN Syncbot's avatar
      [gn build] Port 376168ba · 0f9842c2
      LLVM GN Syncbot authored
      0f9842c2
    • Nathan James's avatar
      [clang-tidy] Add modernize-type-traits check · 376168ba
      Nathan James authored
      This check will look for usages of standard library type traits of the form `traits<...>::type` and `traits<...>::value` and convert them into `traits_t<...>` and `traits_v<...>` respectively.
      This expands on the work in D135404 by supporting dependent traits with no instantiations as well as types.
      
      Differential Revision: https://reviews.llvm.org/D137302
      376168ba
    • Paul Kirth's avatar
      [support] Revise ScopedPrinter formatting tests for floats · f331e13d
      Paul Kirth authored
      Previously there were several attempts to make the format checks for NaN
      and Inf work across platforms, like AIX and Solaris, that print these
      values slightly differently. This resulted in a number of forward fixes,
      until we finally disabled the tests for NaN and Inf. This change should
      make the test robust across different platforms, and reduce the overall
      amount of code by delegating to helper functions that use the same
      format strings as the implementations used by PrintNumber().
      
      This additionally reverts commit 5a9bad17
      and fa56e362.
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D146851
      f331e13d
    • Mark de Wever's avatar
      [libc++] Module fixes for __synth_three_way. · 9c0efc8a
      Mark de Wever authored
      These changes make it possible to use __synth_three_way in modules. The
      change from a lambda to a function is a Clang issue.
      
      The change is list was needed since the compiler couldn't deduce the
      comparison template argument.
      
      Adds a few missing includes too.
      
      Reviewed By: #libc, ldionne
      
      Differential Revision: https://reviews.llvm.org/D146545
      9c0efc8a
    • Shafik Yaghmour's avatar
      [Clang] Fix buildbots after Fix filtering of inline namespaces for friend functions commit · f9b854bc
      Shafik Yaghmour authored
      In commit cffadbd951e9 the test I added was using a C++17 feature and this
      breaking some build bots. I don't need the feature and so I will modify
      the test to not use it.
      f9b854bc
  2. Apr 07, 2023