1. Mar 06, 2024
    • Michael Spencer's avatar
      [clang] Diagnose config_macros before building modules (#83641) · ee044d5e
      Michael Spencer authored
      Before this patch, if a module fails to build because of a missing
      config_macro, the user will never see the config macro warning. This
      patch diagnoses this before building, and each subsequent time a module
      is imported.
      
      rdar://123921931
      ee044d5e
    • LLVM GN Syncbot's avatar
      [gn build] Port a8cb9db5 · caad3794
      LLVM GN Syncbot authored
      caad3794
    • LLVM GN Syncbot's avatar
      [gn build] Port 8e56fb82 · 97e9780e
      LLVM GN Syncbot authored
      97e9780e
    • LLVM GN Syncbot's avatar
      [gn build] Port 1a67dee0 · aa4e3d59
      LLVM GN Syncbot authored
      aa4e3d59
    • Nick Desaulniers's avatar
    • Peter Klausler's avatar
      [flang] Catch more bad pointer initialization targets (#83731) · 233f750c
      Peter Klausler authored
      A pointer variable initialization or pointer component default
      initialization cannot reference another pointer.
      
      Fixes https://github.com/llvm/llvm-project/issues/82944.
      233f750c
    • Nico Weber's avatar
      [gn] Remove ScudoBenchmarks · 9f67f196
      Nico Weber authored
      It's the only thing depending on third-party/benchmark.
      The recent third-party/benchmark uprev made it not build in the
      GN build, so remove ScudoBenchmarks until someone feels motivated
      to update the third-party/benchmark BUILD.gn file.
      9f67f196
    • Farzon Lotfi's avatar
      [HLSL] implement the any intrinsic (#83903) · 2807ea6b
      Farzon Lotfi authored
      This PR implements the frontend for #70076
      This PR is part 1 of 2.
      Part 2 requires an intrinsic to instructions lowering.
      
      - `Builtins.td` - add an `any` builtin
      - `CGBuiltin.cpp` add the builtin to intrinsic lowering
      - `hlsl_basic_types.h` -add the `bool` vectors since that is an input
      for any
      - `hlsl_intrinsics.h` - add the `any`  api
      - `SemaChecking.cpp` - addy `any` builtin checking
      - `IntrinsicsDirectX.td` - add the llvm intrinsic
      2807ea6b
    • Farzon Lotfi's avatar
      [HLSL] implement exp intrinsic (#83832) · b2ca23ae
      Farzon Lotfi authored
      This change implements: #70072
      
      - `hlsl_intrinsics.h` - add the `exp` api
      - `DXIL.td` - add the llvm intrinsic to DXIL opcode lowering mapping.
      - This change reuses llvm's existing intrinsic
      `__builtin_elementwise_exp` \ `int_exp` & `__builtin_elementwise_exp2` \
      `int_exp2`
      - This PR is part 1 of 2.
      - Part 2 requires an intrinsic to instructions lowering.
      Part2 will expand `int_exp` to 
      ```
      A = Builder.CreateFMul(log2eConst, val);
      int_exp2(A)
      ```
      just like we do in
      [TranslateExp](https://github.com/microsoft/DirectXShaderCompiler/blob/main/lib/HLSL/HLOperationLower.cpp#L2220C1-L2236C2)
      b2ca23ae
    • Cyndy Ishida's avatar
    • Farzon Lotfi's avatar
      [HLSL] implement `mad` intrinsic (#83826) · 643b31db
      Farzon Lotfi authored
      
      
      This change implements #83736
      The dot product lowering needs a tertiary multipy add operation. DXIL
      has three mad opcodes for `fmad`(46), `imad`(48), and `umad`(49). Dot
      product in DXIL only uses `imad`\ `umad`, but for completeness and
      because the hlsl `mad` intrinsic requires it `fmad` was also included.
      Two new intrinsics were needed to be created to complete this change.
      the `fmad` case already supported by llvm via `fmuladd` intrinsic.
      
      - `hlsl_intrinsics.h` - exposed mad api call.
      - `Builtins.td` - exposed a `mad` builtin.
      - `Sema.h` - make `tertiary` calls check for float types optional. 
      - `CGBuiltin.cpp` - pick the intrinsic for singed\unsigned & float also
      reuse `int_fmuladd`.
      - `SemaChecking.cpp` - type checks for `__builtin_hlsl_mad`. 
      - `IntrinsicsDirectX.td` create the two new intrinsics for
      `imad`\`umad`/
      - `DXIL.td` - create the llvm intrinsic to  `DXIL` opcode mapping.
      
      ---------
      
      Co-authored-by: default avatarFarzon Lotfi <farzon@farzon.com>
      643b31db
    • Alexey Bataev's avatar
      [SLP]Improve minbitwidth analysis. · a730ed7c
      Alexey Bataev authored
      This improves overall analysis for minbitwidth in SLP. It allows to
      analyze the trees with store/insertelement root nodes. Also, instead of
      using single minbitwidth, detected from the very first analysis stage,
      it tries to detect the best one for each trunc/ext subtree in the graph
      and use it for the subtree.
      Results in better code and less vector register pressure.
      
      Metric: size..text
      
      Program                                                                                                                                                size..text
                                                                                                                                                             results     results0    diff
                                                                            test-suite :: SingleSource/Benchmarks/Adobe-C++/simple_types_loop_invariant.test    92549.00    92609.00  0.1%
                                                                                        test-suite :: External/SPEC/CINT2017speed/625.x264_s/625.x264_s.test   663381.00   663493.00  0.0%
                                                                                         test-suite :: External/SPEC/CINT2017rate/525.x264_r/525.x264_r.test   663381.00   663493.00  0.0%
                                                                                                     test-suite :: MultiSource/Benchmarks/Bullet/bullet.test   307182.00   307214.00  0.0%
                                                                                   test-suite :: External/SPEC/CFP2017speed/638.imagick_s/638.imagick_s.test  1394420.00  1394484.00  0.0%
                                                                                    test-suite :: External/SPEC/CFP2017rate/538.imagick_r/538.imagick_r.test  1394420.00  1394484.00  0.0%
                                                                                      test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test  2040257.00  2040273.00  0.0%
      
                                                                                    test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 12396098.00 12395858.00 -0.0%
                                                                                               test-suite :: External/SPEC/CINT2006/445.gobmk/445.gobmk.test   909944.00   909768.00 -0.0%
      
      SingleSource/Benchmarks/Adobe-C++/simple_types_loop_invariant - 4 scalar
      instructions remain scalar (good).
      Spec2017/x264 - the whole function idct4x4dc is vectorized using <16
      x i16> instead of <16 x i32>, also zext/trunc are removed. In other
      places last vector zext/sext removed and replaced by
      extractelement + scalar zext/sext pair.
      MultiSource/Benchmarks/Bullet/bullet - reduce or <4 x i32> replaced by
      reduce or <4 x i8>
      Spec2017/imagick - Removed extra zext from 2 packs of the operations.
      Spec2017/parest - Removed extra zext, replaced by extractelement+scalar
      zext
      Spec2017/blender - the whole bunch of vector zext/sext replaced by
      extractelement+scalar zext/sext, some extra code vectorized in smaller
      types.
      Spec2006/gobmk - fixed cost estimation, some small code remains scalar.
      
      Reviewers: RKSimon
      
      Reviewed By: RKSimon
      
      Pull Request: https://github.com/llvm/llvm-project/pull/78976
      a730ed7c
    • Changpeng Fang's avatar
    • Nico Weber's avatar
      f836048a
    • Jeremy Morse's avatar
      [NFC][RemoveDIs] Always use iterators for inserting PHIs · f33f66be
      Jeremy Morse authored
      It's becoming potentially unsafe to insert a PHI instruction using a plain
      Instruction pointer. Switch all the remaining sites that create and insert
      PHIs to use iterators instead. For example, the code in
      ComplexDeinterleavingPass.cpp is definitely at-risk of mixing PHIs and
      debug-info.
      f33f66be
    • Jeffrey Byrnes's avatar
      [SROA]: Only defer trying partial sized ptr or ptr vector types · 1e828f83
      Jeffrey Byrnes authored
      Change-Id: Ic77f87290905addadd5819dff2d0c62f031022ab
      1e828f83
    • Ulrich Weigand's avatar
      [SystemZ] Use proper relocation for TLS variable debug info (#83975) · a8cb9db5
      Ulrich Weigand authored
      Debug info refering to a TLS variable via DW_OP_GNU_push_tls_address
      needs to use a R_390_TLS_LDO64 relocation instead of R_390_64.
      
      Fixed by adding a SystemZELFTargetObjectFile override class and proving
      a getDebugThreadLocalSymbol implementation.
      a8cb9db5
    • Yuta Mukai's avatar
      [AArch64] Verify ldp/stp alignment stricter (#83948) · 6b5888c2
      Yuta Mukai authored
      When ldp-aligned-only/stp-aligned-only is specified, modified to cancel
      ldp/stp transformation if MachineMemOperand is not present or the access
      size is unknown.
      In the previous implementation, the test passed when there was no
      MachineMemOperand. Also, if the size was unknown, an incorrect value was
      used or an assertion failed. (But actually, if there is no
      MachineMemOperand, it will be excluded from the target by
      isCandidateToMergeOrPair() before reaching the part.)
      
      A statistic NumFailedAlignmentCheck is added. NumPairCreated is modified
      so that it only counts if it is not cancelled.
      6b5888c2
    • elhewaty's avatar
      [DAG] select (sext m), (add X, C), X --> (add X, (and C, (sext m)))) (#83640) · 26058e68
      elhewaty authored
      - [DAG][X86] Add tests for Folding select m, add(X, C), X --> add (X, and(C, m))(NFC)
      - [DAG][X86] Fold select (sext m), (add X, C), X --> (add X, (and C, (sext m))))
      - Fixes: https://github.com/llvm/llvm-project/issues/66101
      26058e68
    • Jay Foad's avatar
      [AMDGPU] Remove unneeded BUF _impl multiclasses. NFC. (#84034) · e49479b8
      Jay Foad authored
      Remove MUBUF_Real_gfx11_impl and others. By converting the underlying
      class MUBUF_Real_gfx11 into a multiclass, the _impl wrapper is no longer
      needed.
      e49479b8
    • Vadim D's avatar
      [clang] Add -Wmissing-designated-field-initializers (#81364) · 7df43ccf
      Vadim D authored
      #56628 changed the behavior of `-Wmissing-field-initializers`, which
      introduces many new warnings in C++ code that uses partial designated
      initializers. If such code is being built with `-Wextra -Werror`, this
      change will break the build.
      
      This PR adds a new flag that allows to disable these new warnings and
      keep the old ones, as was suggested by @AaronBallman in the original
      issue:
      https://github.com/llvm/llvm-project/issues/56628#issuecomment-1761510850
      
      Fixes  #68933
      7df43ccf
    • agozillon's avatar
      [Flang][MLIR][OpenMP] Create a deferred declare target marking process for Bridge.cpp (#78502) · afb05cd6
      agozillon authored
      This patch seeks to create a process that happens on module finalization
      for OpenMP, in which a list of operations that had declare target
      directives applied to them and were not generated at the time of
      processing the original declare target directive are re-checked to apply
      the appropriate declare target semantics.
      
      This works by maintaining a vector of declare target related data inside
      of the FIR converter, in this case the symbol and the two relevant
      unsigned integers representing the enumerators. This vector is added to
      via a new function called from Bridge.cpp, insertDeferredDeclareTargets,
      which happens prior to the processing of the directive (similarly to
      getDeclareTargetFunctionDevice currently for requires), it effectively
      checks if the Operation the declare target directive is applied to
      currently exists, if it doesn't it appends to the vector. This is a
      seperate function to the processing of the declare target via the
      overloaded genOMP as we unfortunately do not have access to the list
      without passing it through every call, as the AbstractConverter we pass
      will not allow access to it (I've seen no other cases of casting it to a
      FirConverter, so I opted to not do that).
      
      The list is then processed at the end of the module in the
      finalizeOpenMPLowering function in Bridge by calling a new function
      markDelayedDeclareTargetFunctions which marks the latently generated
      operations. In certain cases, some still will not be generated, e.g. if
      an interface is defined, marked as declare target, but has no definition
      or usage in the module then it will not be emitted to the module, so due
      to these cases we must silently ignore when an operation has not been
      found via it's symbol.
      
      The main use-case for this (although, I imagine there is others) is for
      processing interfaces that have been declared in a module with a declare
      target directive but do not have their implementation defined in the
      same module. For example, inside of a seperate C++ module that will be
      linked in. In cases where the interface is called inside of a target
      region it'll be marked as used on device appropriately (although,
      realistically a user should explicitly mark it to match the
      corresponding definition), however, in cases where it's used in a
      non-clear manner through something like a function pointer passed to an
      external call we require this explicit marking, which this patch adds
      support for (currently will cause the compiler to crash).
      
      This patch also adds documentation on the declare target process and 
      mechanisms within the compiler currently.
      afb05cd6
    • Simon Pilgrim's avatar
      [CostModel][X86] Add test coverage for 'concat subvector' style shuffles · 3b84b6f1
      Simon Pilgrim authored
      Shows 2 major issues:
       - SSE should be free as it splits everything to 128-bit
       - Negative costs for 128 -> 512 concat shuffles
      3b84b6f1
    • Alexey Bataev's avatar
    • Nick Desaulniers's avatar
      [libc] suppress readability-identifier-naming for std::numeric_limits interfaces (#83921) · 2aa22ca2
      Nick Desaulniers authored
      These templates are made to match the ergonomics of std::numeric_limits.
      Because our style for constexpr variables is ALL_CAPS, we must silence the
      linter for these manually.
      
      Link:
      https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics
      2aa22ca2
    • Nick Desaulniers's avatar
      [libc] fix readability-identifier-naming in memory_utils/utils.h (#83919) · 640c8574
      Nick Desaulniers authored
      Fixes:
      
          libc/src/string/memory_utils/utils.h:345:13: warning: invalid case style
          for member 'offset_' [readability-identifier-naming]
      
      Having a trailing underscore for members is a google3 style, not LLVM style.
      Removing the underscore is insufficient, as we would then have 2 members with
      the same identifier which is not allowed (it is a compile time error). Remove
      the getter, and just access the renamed member that's now made public.
      640c8574
    • Nick Desaulniers's avatar
      [libc] fix more readability-identifier-naming lints (#83914) · 88d82b74
      Nick Desaulniers authored
      Found via:
      
          $ ninja -k2000 libc-lint 2>&1 | grep readability-identifier-naming
      
      Auto fixed via:
      
          $ clang-tidy -p build/compile_commands.json \
            -checks="-*,readability-identifier-naming" \
            <filename> --fix
      
      This doesn't fix all instances, just the obvious simple cases where it makes
      sense to change the identifier names.  Subsequent PRs will fix up the
      stragglers.
      88d82b74
    • David Goldman's avatar
      [clangd] Add metric for rename decl kind (#83867) · ec7062d9
      David Goldman authored
      This will give us insight into what users are renaming in practice - for
      instance, try to gauge the impact of the ObjC rename support.
      ec7062d9
    • Natalie Chouinard's avatar
      [infra] Add git to Linux container (#82687) · da63746b
      Natalie Chouinard authored
      Fixes #82646
      da63746b
  2. Mar 05, 2024