1. Dec 31, 2023
  2. Dec 30, 2023
  3. Dec 29, 2023
    • Yingwei Zheng's avatar
    • Ivan Kosarev's avatar
    • Shengchen Kan's avatar
    • LLVM GN Syncbot's avatar
      [gn build] Port 450be891 · 3c92011b
      LLVM GN Syncbot authored
      3c92011b
    • Dimitry Andric's avatar
      [builtins] Fix CPU feature detection for FreeBSD on AArch64 (#76532) · 953ae941
      Dimitry Andric authored
       [builtins] Fix CPU feature detection for FreeBSD on AArch64
      
      This is a follow-up to #75635 which broke the build for FreeBSD on
      AArch64:
      
      ```
      compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/freebsd.inc:3:16: error: call to undeclared function 'elf_aux_info'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          3 |   int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
            |                ^
      ```
      
      Using `elf_aux_info()` requires including `<sys/auxv.h>` first. To
      prevent redeclaration issues with `hwcap.inc` attempting to define
      `HWCAP_xxx` macros before `<sys/auxv.h>` does so, include `<sys/auxv.h>`
      before any of the `.inc` files on FreeBSD.
      953ae941
    • Brad Smith's avatar
      [compiler-rt] Remove a few workarounds for FreeBSD 9.x (#76263) · 450be891
      Brad Smith authored
      Support for FreeBSD 11.x was dropped so garbage collect a few FreeBSD
      9.x workarounds and make 12.x the oldest supported releases.
      450be891
    • XChy's avatar
      dafd1789
    • yingopq's avatar
      [Mips] Optimize (shift x (and y, BitWidth - 1)) to (shift x, y) (#73889) · e13e95bc
      yingopq authored
      Do optimization to turn x >> (shift & 31/63) into a single srlv instead
      of andi + srlv, since the mips variable shift instruction already
      implicitly masks the shift, like x86, wasm and AMDGPU. Copy the
      X86DAGToDAGISel::isUnneededShiftMask() function to MIPS for checking
      whether need combine two instructions to one.
      e13e95bc
    • Chia's avatar
      [RISCV][ISel] Remove redundant min/max in saturating truncation (#75145) · 87779fd8
      Chia authored
      This patch closed #73424, which is also a missed-optimization case
      similar to #68466 on X86.
      
      ## Source Code
      ```
      define void @trunc_sat_i8i16(ptr %x, ptr %y) {
        %1 = load <8 x i16>, ptr %x, align 16
        %2 = tail call <8 x i16> @llvm.smax.v8i16(<8 x i16> %1, <8 x i16> <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>)
        %3 = tail call <8 x i16> @llvm.smin.v8i16(<8 x i16> %2, <8 x i16> <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>)
        %4 = trunc <8 x i16> %3 to <8 x i8>
        store <8 x i8> %4, ptr %y, align 8
        ret void
      }
      ```
      ## Before this patch: 
      ```
      trunc_sat_i8i16:                  # @trunc_maxmin_id_i8i16
              vsetivli        zero, 8, e16, m1, ta, ma
              vle16.v v8, (a0)
              li      a0, -128
              vmax.vx v8, v8, a0
              li      a0, 127
              vmin.vx v8, v8, a0
              vsetvli zero, zero, e8, mf2, ta, ma
              vnsrl.wi        v8, v8, 0
              vse8.v  v8, (a1)
              ret
      ```
      
      ## After this patch: 
      ```
      trunc_sat_i8i16:                  # @trunc_maxmin_id_i8i16
      	vsetivli	zero, 8, e8, mf2, ta, ma
      	vle16.v	v8, (a0)
      	csrwi	vxrm, 0
      	vnclip.wi	v8, v8, 0
      	vse8.v	v8, (a1)
      	ret
      ```
      87779fd8
    • Nathan Ridge's avatar
      [clangd] Avoid crash when summarizing pointer-to-member expr for block-end hint (#76492) · dbd1fb8e
      Nathan Ridge authored
      For calls through a pointer to member, CXXMemberCallExpr::getCallee() is
      a BinaryOperator with operator ->* (after unwrapping parens).
      
      getMethodDecl() only returns non-null if the callee is a MemberExpr.
      
      Fixes https://github.com/clangd/clangd/issues/1873
      dbd1fb8e
    • wanglei's avatar
      [LoongArch] Fix incorrect pattern [X]VBITSELI_B instructions · da5378e8
      wanglei authored
      Adjusted the operand order of [X]VBITSELI_B to correctly match vselect.
      da5378e8
    • Chia's avatar
      [RISCV][ISel] Combine scalable vector add/sub/mul with zero/sign extension (#72340) · 5b155aea
      Chia authored
      This PR mainly aims at resolving the below missed-optimization case,
      while it could also be considered as an extension of the previous patch
      https://reviews.llvm.org/D133739?id=
      
      ## Missed-Optimization Case
      Compiler Explorer: https://godbolt.org/z/GzWzP7Pfh
      ### Source Code: 
      ```
      define <vscale x 2 x i16> @multiple_users(ptr  %x, ptr  %y, ptr %z) {
        %a = load <vscale x 2 x i8>, ptr %x
        %b = load <vscale x 2 x i8>, ptr %y
        %b2 = load <vscale x 2 x i8>, ptr %z
        %c = sext <vscale x 2 x i8> %a to <vscale x 2 x i16>
        %d = sext <vscale x 2 x i8> %b to <vscale x 2 x i16>
        %d2 = sext <vscale x 2 x i8> %b2 to <vscale x 2 x i16>
        %e = mul <vscale x 2 x i16> %c, %d
        %f = add <vscale x 2 x i16> %c, %d2
        %g = sub <vscale x 2 x i16> %c, %d2
        %h = or <vscale x 2 x i16> %e, %f
        %i = or <vscale x 2 x i16> %h, %g
        ret <vscale x 2 x i16> %i
      }
      ```
      ### Before This Patch
      ```
      # %bb.0:
              vsetvli a3, zero, e16, mf2, ta, ma
              vle8.v  v8, (a0)
              vle8.v  v9, (a1)
              vle8.v  v10, (a2)
              svf2       v11, v8
              vsext.vf2       v8, v9
              vsext.vf2       v9, v10
              vmul.vv v8, v11, v8
              vadd.vv v10, v11, v9
              vsub.vv v9, v11, v9
              vor.vv  v8, v8, v10
              vor.vv  v8, v8, v9
              ret
      ```
      ###  After This Patch 
      ```
      # %bb.0:
      	vsetvli	a3, zero, e8, mf4, ta, ma
      	vle8.v	v8, (a0)
      	vle8.v	v9, (a1)
      	vle8.v	v10, (a2)
      	vwmul.vv	v11, v8, v9
      	vwadd.vv	v9, v8, v10
      	vwsub.vv	v12, v8, v10
      	vsetvli	zero, zero, e16, mf2, ta, ma
      	vor.vv	v8, v11, v9
      	vor.vv	v8, v8, v12
      	ret
      ```
      We can see Add/Sub/Mul are combined with the Sign Extension.
      
      ## Relation to the Patch D133739
      The patch D133739 introduced an optimization for folding `ADD_VL`/
      `SUB_VL` / `MUL_V` with `VSEXT_VL` / `VZEXT_VL`. However, the patch did
      not consider the case of non-fixed length vector case, thus this PR
      could also be considered as an extension for the D133739.
      
      Furthermore, in the current `SelectionDAG`, we represent scalable vector
      add (or any binary operator) as a normal `ADD` operation. It might be
      better to use an Opcode like `ADD_VL`, which needs further conversation
      and decision.
      5b155aea
    • wanglei's avatar
      [LoongArch] Fix incorrect pattern XVREPL128VEI_{W/D} instructions · c7367f98
      wanglei authored
      Remove the incorrect patterns for `XVREPL128VEI_{W/D}` instructions,
      and add correct patterns for XVREPLVE0_{W/D} instructions
      c7367f98
    • wanglei's avatar
      [LoongArch] Fix LASX vector_extract codegen · 47c88bcd
      wanglei authored
      Custom lowering `ISD::EXTRACT_VECTOR_ELT` with lasx.
      47c88bcd