1. Sep 23, 2022
    • Jan Svoboda's avatar
      [clang][modules][deps] Preserve module map load order · 20fa87c7
      Jan Svoboda authored
      In `ASTWriter`, input files are sorted based on whether they are system or user. The current implementation used single `std::queue` with `push_back` and `push_front`. This resulted in the user files being reversed.
      
      This patch fixes that by keeping the system/user distinction, but otherwise serializing files in the order they were loaded by the `SourceManager`. This is then used in the dependency scanner to report module map dependencies in the correct order.
      
      Depends on D134224.
      
      Reviewed By: Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D134248
      20fa87c7
    • Teresa Johnson's avatar
      [MemProf] Memprof profile matching and annotation · a212d8da
      Teresa Johnson authored
      Profile matching and IR annotation for memprof profiles.
      
      See also related RFCs:
      RFC: Sanitizer-based Heap Profiler [1]
      RFC: A binary serialization format for MemProf [2]
      RFC: IR metadata format for MemProf [3]*
      
      * Note that the IR metadata format has changed from the RFC during
      implementation, as described in the preceeding patch adding the basic
      metadata and verification support.
      
      The matching is performed during the normal PGO annotation phase, to
      ensure that the inlines applied in the IR at that point are a subset
      of the inlines in the profiled binary and thus reflected in the
      profile's call stacks. This is important because the call frames are
      associated with functions in the profile based on the inlining in the
      symbolized call stacks, and this simplifies locating the subset of
      profile data relevant for matching onto each function's IR.
      
      The PGOInstrumentationUse pass is enhanced to perform matching for
      whatever combination of memprof and regular PGO profile data exists in
      the profile.
      
      Using the utilities introduced in D128854:
      The memprof profile data for each context is converted to "cold" or
      "notcold" based on parameterized thresholds for size, access count, and
      lifetime. The memprof allocation contexts are trimmed to the minimal
      amount of context required to uniquely identify whether the context is
      cold or not cold. For allocations where all profiled contexts have the
      same allocation type, no memprof metadata is attached and instead the
      allocation call is directly annotated with an attribute specifying the
      alloction type. This is the same attributed that will be applied to
      allocation calls once cloned for different contexts, and later used
      during LibCall simplification to emit allocation hints [4].
      
      Depends on D128141 and D128854.
      
      [1] https://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html
      [2] https://lists.llvm.org/pipermail/llvm-dev/2021-September/153007.html
      [3] https://discourse.llvm.org/t/rfc-ir-metadata-format-for-memprof/59165
      [4] https://github.com/google/tcmalloc/commit/ab87cf382dc56784f783f3aaa43d6d0465d5f385
      
      Differential Revision: https://reviews.llvm.org/D128142
      a212d8da
    • Simon Pilgrim's avatar
      [CostModel][X86] Tidyup sdiv/srem/udiv/urem by constant cost tables · 98907f86
      Simon Pilgrim authored
      Preparation for adding cost kinds handling
      
      This is necessary to eventually unblock D111968
      98907f86
    • Jan Svoboda's avatar
      [clang][modules][deps] Report modulemaps describing excluded headers · f35230ae
      Jan Svoboda authored
      Module map files describing excluded headers do affect compilation. Track them in the compiler, serialize them into the PCM file and report them in the scanner.
      
      Depends on D134222.
      
      Reviewed By: Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D134224
      f35230ae
    • Philip Reames's avatar
      [DAGCombine] Check both forms of a commutative transform · 46525fee
      Philip Reames authored
      The transform to fold an add into the base of a scatter/gather was only checking to see if the LHS was a splat.  Included test change indicates that splats are not canonicalized to LHS, and that we need to check both sides.
      46525fee
    • Philip Reames's avatar
      779ccaea
    • Yitzhak Mandelbaum's avatar
      [clang][dataflow] Add support for nested method calls. · 0b12efc7
      Yitzhak Mandelbaum authored
      Extend the context-sensitive analysis to handle a call to a method (of the same
      class) from within a method. That, is a member-call expression through `this`.
      
      Differential Revision: https://reviews.llvm.org/D134432
      0b12efc7
    • Quentin Colombet's avatar
      [mlir][MemRef] Simplify extract_strided_metadata(expand_shape) · d0aeb74e
      Quentin Colombet authored
      Add a pattern to the pass that simplifies
      extract_strided_metadata(other_op(memref)).
      
      The new pattern gets rid of the expand_shape operation while
      materializing its effects on the sizes, and the strides of
      the base object.
      
      In other words, this simplification replaces:
      ```
      baseBuffer, offset, sizes, strides =
                   extract_strided_metadata(expand_shape(memref))
      ```
      
      With
      
      ```
      baseBuffer, offset, baseSizes, baseStrides =
          extract_strided_metadata(memref)
      sizes#reassIdx =
          baseSizes#reassDim / product(expandShapeSizes#j,
                                       for j in group excluding
                                         reassIdx)
      strides#reassIdx =
          baseStrides#reassDim * product(expandShapeSizes#j,
                                         for j in
                                           reassIdx+1..
                                             reassIdx+group.size-1)
      ```
      
      Where `reassIdx` is a reassociation index for the group at
      `reassDim` and `expandShapeSizes#j` is either:
      - The constant size at dimension j, derived directly from the
        result type of the expand_shape op, or
      - An affine expression: baseSizes#reassDim / product of all
        constant sizes in expandShapeSizes.
      
      Note: baseBuffer and offset are unaffected by the expand_shape
      operation.
      
      Differential Revision: https://reviews.llvm.org/D133625
      d0aeb74e
    • Jan Svoboda's avatar
      [clang][deps] Report module map describing compiled module · 9dc0b167
      Jan Svoboda authored
      This patch fixes compilation failure with explicit modules caused by scanner not reporting the module map describing the module whose implementation is being compiled.
      
      Below is a breakdown of the attached test case. Note the VFS that makes frameworks "A" and "B" share the same header "shared/H.h".
      
      In non-modular build, Clang skips the last import, since the "shared/H.h" header has already been included.
      
      During scan (or implicit build), the compiler handles "tu.m" as follows:
        * `@import B` imports module "B", as expected,
        * `#import <A/H.h>` is resolved textually (due to `-fmodule-name=A`) to "shared/H.h" (due to the VFS remapping),
        * `#import <B/H.h>` is resolved to import module "A_Private", since the header "shared/H.h" is already known to be part of that module, and the import is skipped.
      In the end, the only modular dependency of the TU is "B".
      
      In explicit modular build without `-fmodule-name=A`, TU does depend on module "A_Private" properly, not just textually. Clang therefore builds & loads its PCM, and knows to ignore the last import, since "shared/H.h" is known to be part of "A_Private".
      
      But with current scanner behavior and `-fmodule-name=A` present, the last import fails during explicit build. Clang doesn't know about "A_Private" (it's included textually) and tries to import "B_Private" instead, which it doesn't know about either (the scanner correctly didn't report it as dependency). This is fixed by reporting the module map describing "A" and matching the semantics of implicit build.
      
      Reviewed By: Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D134222
      9dc0b167
    • Alex Brachet's avatar
      [ELF] Fix std::min error on MacOs · 38b20a02
      Alex Brachet authored
      38b20a02
    • Xiang Li's avatar
      [HLSL] Add resource binding attribute for HLSL. · e3fd0b20
      Xiang Li authored
      The resource binding attribute is to set the virtual registers and logical register spaces resources in HLSL are bound to.
      Format is ''register(ID,  space)'' like register(t3,  space1).
      ID must be start with
      t – for shader resource views (SRV),
      s – for samplers,
      u – for unordered access views (UAV),
      b – for constant buffer views (CBV).
      
      Register space is default to space0.
      
      The full documentation is available here: https://docs.microsoft.com/en-us/windows/win32/direct3d12/resource-binding-in-hlsl
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D130033
      e3fd0b20
    • Oleg Shyshkov's avatar
      [mlir] Modify LinalgStructuredInterface to allow the computation block to have... · 91563c41
      Oleg Shyshkov authored
      [mlir] Modify LinalgStructuredInterface to allow the computation block to have arguments only for a subset of operands.
      
      Summary:
      Currently there is an expectations that there is a corresponsing block argument
      for each operand. For some operation, it leads to unused arguments. For example,
      in `map`, only input operands are used for the computation.
      
      Differential Revision: https://reviews.llvm.org/D134444
      91563c41
    • Leonard Chan's avatar
      [llvm] Handle dso_local_equivalent in FunctionComparator · 21b03bf9
      Leonard Chan authored
      This addresses https://github.com/llvm/llvm-project/issues/51066.
      
      Prior to this, dso_local_equivalent would lead to an llvm_unreachable in
      a switch in the FunctionComparator. This adds a conservative case in
      that switch that just compares the underlying functions.
      
      Differential Revision: https://reviews.llvm.org/D134300
      21b03bf9
    • Greg Clayton's avatar
      Track .dwo/.dwp loading errors and notify user when viewing variables. · ccb47b41
      Greg Clayton authored
      When debugging using Fission (-gsplit-dwarf), we can sometimes have issues loading .dwo files if they are missing or if the path was relative and we were unable to locate the file. We can also skip loading due to DWO ID mismatch or if a .dwp file doesn't contain a matching .dwo file. Also .dwo files could be updated due to a recompile and if the user debugs an executable that was linked against the old .dwo file, it could fail to load the information.
      
      This patch adds a m_dwo_error to DWARFUnit that can be get/set and will cause "frame variable" to show errors when there are .dwo/.dwp issues informing the user about the error.
      
      Differential Revision: https://reviews.llvm.org/D134252
      ccb47b41
    • Michael Benfield's avatar
      Document WarnOnSizeOfPointerToAggregate. · 33bc9c3b
      Michael Benfield authored
      This option was just landed in D134381. It would make sense to actually
      document it.
      
      Differential Revision: https://reviews.llvm.org/D134457
      33bc9c3b
    • Fangrui Song's avatar
      [llvm-objcopy] --compress-debug-sections: remove tail padding for ELFCLASS32 · c997fe65
      Fangrui Song authored
      For an ELFCLASS32 object, a compressed section due to --compress-debug-sections={zlib,zstd} has a
      tail padding of 12 zero bytes. zlib happily allows this while zstd is rigid and
      reports `error: '{{.*}}': failed to decompress section '.debug_foo': Src size is incorrect`.
      
      Cole Kissane reported the problem.
      
      Reviewed By: jhenderson, phosek
      
      Differential Revision: https://reviews.llvm.org/D134385
      c997fe65
    • Yashwant Singh's avatar
      [NFC] Empty commit to check commit access · 6b93f30b
      Yashwant Singh authored
      6b93f30b
    • Chris Bieneman's avatar
      [NFC] Refactor dxil metadata code · 4959bfa0
      Chris Bieneman authored
      DXIL relies on a whole bunch of IR metadata constructs being populated
      in the right shape. Rather than just hard coding or using complicated
      arrangements of constant data strings, let's make first-class objects
      that reprensent the metadata and manage reading and writing the
      metadata from the module.
      
      Reviewed By: python3kgae
      
      Differential Revision: https://reviews.llvm.org/D134397
      4959bfa0
    • Nico Weber's avatar
      711814a6
    • Slava Zakharin's avatar
      [flang][runtime] Fixes for element size calculation. · d37250c9
      Slava Zakharin authored
      BytesFor() used to return KIND for the size, which is not always
      correct, so I changed it to return the size of the actual CppType
      corresponding to the given category and kind.
      
      MinElemLen() used to calculate size incorrectly (e.g. CFI_type_extended_double
      was sized 10, whereas it may occupy more bytes on a target), so I changed it
      to call BytesFor().
      
      Additional changes were needed to resolve new failures for transformational
      intrinsics. These intrinsics used to work for not fully supported
      data types (e.g. REAL(3)), but now stopped working because CppType
      cannot be computed for those categories/kinds. The solution is to use
      known element size from the source argument(s) for establishing
      the destination descriptor - the element size is all that is needed
      for transformational intrinsics to keep working.
      
      Note that this does not help cases, where runtime still has to
      compute the element size, e.g. when it creates descriptors for
      components of derived types. If the component has unsupported
      data type, BytesFor() will still fail. So these cases require
      adding support for the missing types.
      
      New regression unit test in Runtime/Transformational.cpp
      demonstrates the case that will start working properly with
      this commit.
      d37250c9
    • Michael Benfield's avatar
      [clang-tidy] Add option WarnOnSizeOfPointerToAggregate. · 0ca59937
      Michael Benfield authored
      This is now an option under the check bugprone-sizeof-expression.
      
      Differential Revision: https://reviews.llvm.org/D134381
      0ca59937
    • Jonathan Camilleri's avatar
      [clang][DebugInfo] Emit access specifiers for typedefs · 4cd7529e
      Jonathan Camilleri authored
      The accessibility level of a typedef or using declaration in a
      struct or class was being lost when producing debug information.
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D134339
      4cd7529e
    • Jonathan Camilleri's avatar
      [DebugInfo] Emit access specifiers for typedefs · 08288052
      Jonathan Camilleri authored
      The accessibility level of a typedef or using declaration in a
      struct or class was being lost when producing debug information.
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D134339
      08288052
    • Aaron Ballman's avatar
      Update the C status page for WG14 N2359 · 9018fa17
      Aaron Ballman authored
      We don't yet implement this paper, so this adds a basic test
      demonstrating that.
      9018fa17
    • Christopher Bate's avatar
      [mlir][vector] Fix test for vector-warp-distribute · cb3d0260
      Christopher Bate authored
      Test does a "CHECK-NOT" against the function name when it should check
      to ensure that the `vector.warp_execute_on_lane_0` is removed.
      
      Reviewed By: ThomasRaoux
      
      Differential Revision: https://reviews.llvm.org/D134448
      cb3d0260
    • Hassnaa Hamdi's avatar
    • Anastasia Stulova's avatar
      db664a66
    • Simon Pilgrim's avatar
    • Saleem Abdulrasool's avatar
      MC: make section classification a bit more thorough · 463da422
      Saleem Abdulrasool authored
      This does *NOT* change the emitted section flags in any way.  This only
      impacts the internal classification of sections.
      
      Extend the section classification in LLVM for ELF targets.  This has one
      important change: we now classify sections as text by default rather
      than readonly.  This matches the behaviour for GAS better.
      
      Ensure that any section that has a writable attribute set is not treated
      as readonly.  We also special case any section named `.debug_` which is
      reserved for DWARF as metadata.  In the case none of the attributes are
      set (or because no attributes were provided), consult the section name
      for classification.  We match the well known names and classify the
      section accordingly.  Any remaining section is now classified as text.
      
      This change allows us to classify sections in the MC layer more
      precisely which is needed for subsequent changes for handling target
      specific behaviour.
      
      Re-apply the change that was reverted with additional changes to
      classify section prefixes appropriately and differentiate the TLS
      sections, addressing the FIXME and post-commit review comments by
      @MaskRay.
      
      Differential Revision: https://reviews.llvm.org/D133456
      Reviewed By: @MaskRay
      463da422
    • bixia1's avatar
      [mlir][sparse] Add codegen rule for the push_back operator. · 4132bce9
      bixia1 authored
      Reviewed By: aartbik
      
      Differential Revision: https://reviews.llvm.org/D134372
      4132bce9
    • Philip Reames's avatar
      [llvm-exegesis] Initialize all supported targets · 47afaf2e
      Philip Reames authored
      Enable registration of multiple exegesis targets at once. Use idiomatic approach to defining target select macros, but leave code in the llvm-mca sub-directories for now.
      
      This is a stepping stone towards allowing llvm-exegesis benchmarking via simulator or testing in non-target dependent tests.
      
      Differential Revision: https://reviews.llvm.org/D133605
      47afaf2e
  2. Sep 22, 2022