1. Aug 22, 2023
    • Nicole Mazzuca's avatar
      ASan: Add additional wcs* interceptors on Windows · c0c83668
      Nicole Mazzuca authored
      This adds wcs[n]cat, wcs[n]cmp, wcs[n]cpy, and wcschr functions to the
      interception code on Windows; wcs[n]cat was already intercepted, but only on
      POSIX.
      
      Differential Revision: https://reviews.llvm.org/D157038
      c0c83668
    • Eduard Zingerman's avatar
      [BPF] Replace BPFMIPeepholeTruncElim by custom logic in isZExtFree() · 651e6445
      Eduard Zingerman authored
      Replace `BPFMIPeepholeTruncElim` by adding an overload for
      `TargetLowering::isZExtFree()` aware that zero extension is
      free for `ISD::LOAD`.
      
      Short description
      =================
      
      The `BPFMIPeepholeTruncElim` handles two patterns:
      
      Pattern #1:
      
          %1 = LDB %0, ...              %1 = LDB %0, ...
          %2 = AND_ri %1, 0xff      ->  %2 = MOV_ri %1    <-- (!)
      
      Pattern #2:
      
          bb.1:                         bb.1:
            %a = LDB %0, ...              %a = LDB %0, ...
            br %bb3                       br %bb3
          bb.2:                         bb.2:
            %b = LDB %0, ...        ->    %b = LDB %0, ...
            br %bb3                       br %bb3
          bb.3:                         bb.3:
            %1 = PHI %a, %b               %1 = PHI %a, %b
            %2 = AND_ri %1, 0xff          %2 = MOV_ri %1  <-- (!)
      
      Plus variations:
      - AND_ri_32 instead of AND_ri
      - SLL/SLR instead of AND_ri
      - LDH, LDW, LDB32, LDH32, LDW32
      
      Both patterns could be handled by built-in transformations at
      instruction selection phase if suitable `isZExtFree()` implementation
      is provided. The idea is borrowed from `ARMTargetLowering::isZExtFree`.
      
      When evaluating on BPF kernel selftests and remove_truncate_*.ll LLVM
      test cases this revisions performs slightly better than
      BPFMIPeepholeTruncElim, see "Impact" section below for details.
      
      Commit also adds a few test cases to make sure that patterns in
      question are handled.
      
      Long description
      ================
      
      Why this works: Pattern #1
      --------------------------
      
      Consider the following example:
      
          define i1 @foo(ptr %p) {
          entry:
            %a = load i8, ptr %p, align 1
            %cond = icmp eq i8 %a, 0
            ret i1 %cond
          }
      
      Log for `llc -mcpu=v2 -mtriple=bpfel -debug-only=isel` command:
      
          ...
          Type-legalized selection DAG: %bb.0 'foo:entry'
          SelectionDAG has 13 nodes:
            t0: ch,glue = EntryToken
                    t2: i64,ch = CopyFromReg t0, Register:i64 %0
                  t16: i64,ch = load<(load (s8) from %ir.p), anyext from i8> t0, t2, undef:i64
                t19: i64 = and t16, Constant:i64<255>
              t17: i64 = setcc t19, Constant:i64<0>, seteq:ch
            t11: ch,glue = CopyToReg t0, Register:i64 $r0, t17
            t12: ch = BPFISD::RET_GLUE t11, Register:i64 $r0, t11:1
          ...
          Replacing.1 t19: i64 = and t16, Constant:i64<255>
          With: t16: i64,ch = load<(load (s8) from %ir.p), anyext from i8> t0, t2, undef:i64
           and 0 other values
          ...
          Optimized type-legalized selection DAG: %bb.0 'foo:entry'
          SelectionDAG has 11 nodes:
            t0: ch,glue = EntryToken
                  t2: i64,ch = CopyFromReg t0, Register:i64 %0
                t20: i64,ch = load<(load (s8) from %ir.p), zext from i8> t0, t2, undef:i64
              t17: i64 = setcc t20, Constant:i64<0>, seteq:ch
            t11: ch,glue = CopyToReg t0, Register:i64 $r0, t17
            t12: ch = BPFISD::RET_GLUE t11, Register:i64 $r0, t11:1
          ...
      
      Note:
      - Optimized type-legalized selection DAG:
        - `t19 = and t16, 255` had been replaced by `t16` (load).
        - Patterns like `(and (load ... i8), 255)` are replaced by `load`
          in `DAGCombiner::BackwardsPropagateMask` called from
          `DAGCombiner::visitAND`.
        - Similarly patterns like `(shl (srl ..., 56), 56)` are replaced by
          `(and ..., 255)` in `DAGCombiner::visitSRL` (this function is huge,
          look for `TLI.shouldFoldConstantShiftPairToMask()` call).
      
      Why this works: Pattern #2
      --------------------------
      
      Consider the following example:
      
          define i1 @foo(ptr %p) {
          entry:
            %a = load i8, ptr %p, align 1
            br label %next
      
          next:
            %cond = icmp eq i8 %a, 0
            ret i1 %cond
          }
      
      Consider log for `llc -mcpu=v2 -mtriple=bpfel -debug-only=isel` command.
      Log for first basic block:
      
          Initial selection DAG: %bb.0 'foo:entry'
          SelectionDAG has 9 nodes:
            t0: ch,glue = EntryToken
            t3: i64 = Constant<0>
                  t2: i64,ch = CopyFromReg t0, Register:i64 %1
                t5: i8,ch = load<(load (s8) from %ir.p)> t0, t2, undef:i64
              t6: i64 = zero_extend t5
            t8: ch = CopyToReg t0, Register:i64 %0, t6
          ...
          Replacing.1 t6: i64 = zero_extend t5
          With: t9: i64,ch = load<(load (s8) from %ir.p), zext from i8> t0, t2, undef:i64
           and 0 other values
          ...
          Optimized lowered selection DAG: %bb.0 'foo:entry'
          SelectionDAG has 7 nodes:
            t0: ch,glue = EntryToken
                t2: i64,ch = CopyFromReg t0, Register:i64 %1
              t9: i64,ch = load<(load (s8) from %ir.p), zext from i8> t0, t2, undef:i64
            t8: ch = CopyToReg t0, Register:i64 %0, t9
      
      Note:
      - Initial selection DAG:
        - `%a = load ...` is lowered as `t6 = (zero_extend (load ...))`
          w/o special `isZExtFree()` overload added by this commit
          it is instead lowered as `t6 = (any_extend (load ...))`.
        - The decision to generate `zero_extend` or `any_extend` is
          done in `RegsForValue::getCopyToRegs` called from
          `SelectionDAGBuilder::CopyValueToVirtualRegister`:
          - if `isZExtFree()` for load returns true `zero_extend` is used;
          - `any_extend` is used otherwise.
      - Optimized lowered selection DAG:
        - `t6 = (any_extend (load ...))` is replaced by
          `t9 = load ..., zext from i8`
          This is done by `DagCombiner.cpp:tryToFoldExtOfLoad()` called from
          `DAGCombiner::visitZERO_EXTEND`.
      
      Log for second basic block:
      
          Initial selection DAG: %bb.1 'foo:next'
          SelectionDAG has 13 nodes:
            t0: ch,glue = EntryToken
                      t2: i64,ch = CopyFromReg t0, Register:i64 %0
                    t4: i64 = AssertZext t2, ValueType:ch:i8
                  t5: i8 = truncate t4
                t8: i1 = setcc t5, Constant:i8<0>, seteq:ch
              t9: i64 = any_extend t8
            t11: ch,glue = CopyToReg t0, Register:i64 $r0, t9
            t12: ch = BPFISD::RET_GLUE t11, Register:i64 $r0, t11:1
          ...
          Replacing.2 t18: i64 = and t4, Constant:i64<255>
          With: t4: i64 = AssertZext t2, ValueType:ch:i8
          ...
          Type-legalized selection DAG: %bb.1 'foo:next'
          SelectionDAG has 13 nodes:
            t0: ch,glue = EntryToken
                    t2: i64,ch = CopyFromReg t0, Register:i64 %0
                  t4: i64 = AssertZext t2, ValueType:ch:i8
                t18: i64 = and t4, Constant:i64<255>
              t16: i64 = setcc t18, Constant:i64<0>, seteq:ch
            t11: ch,glue = CopyToReg t0, Register:i64 $r0, t16
            t12: ch = BPFISD::RET_GLUE t11, Register:i64 $r0, t11:1
          ...
          Optimized type-legalized selection DAG: %bb.1 'foo:next'
          SelectionDAG has 11 nodes:
            t0: ch,glue = EntryToken
                  t2: i64,ch = CopyFromReg t0, Register:i64 %0
                t4: i64 = AssertZext t2, ValueType:ch:i8
              t16: i64 = setcc t4, Constant:i64<0>, seteq:ch
            t11: ch,glue = CopyToReg t0, Register:i64 $r0, t16
            t12: ch = BPFISD::RET_GLUE t11, Register:i64 $r0, t11:1
          ...
      
      Note:
      - Initial selection DAG:
        - `t0` is an input value for this basic block, it corresponds load
          instruction (`t9`) from the first basic block.
        - It is accessed within basic block via
          `t4` (AssertZext (CopyFromReg t0, ...)).
        - The `AssertZext` is generated by RegsForValue::getCopyFromRegs
          called from SelectionDAGBuilder::getCopyFromRegs, it is generated
          only when `LiveOutInfo` with known number of leading zeros is
          present for `t0`.
        - Known register bits in `LiveOutInfo` are computed by
          `SelectionDAG::computeKnownBits` called from
          `SelectionDAGISel::ComputeLiveOutVRegInfo`.
        - `computeKnownBits()` generates leading zeros information for
          `(load ..., zext from ...)` but *does not* generate leading zeros
          information for `(load ..., anyext from ...)`.
          This is why `isZExtFree()` added in this commit is important.
      - Type-legalized selection DAG:
        - `t5 = truncate t4` is replaced by `t18 = and t4, 255`
      - Optimized type-legalized selection DAG:
        - `t18 = and t4, 255` is replaced by `t4`, this is done by
          `DAGCombiner::SimplifyDemandedBits` called from
          `DAGCombiner::visitAND`, which simplifies patterns like
          `(and (assertzext ...))`
      
      Impact
      ------
      
      This change covers all remove_truncate_*.ll test cases:
      - for -mcpu=v4 there are no changes in the generated code;
      - for -mcpu=v2 code generated for remove_truncate_7 and
        remove_truncate_8 improved slightly, for other tests it is
        unchanged.
      
      For remove_truncate_7:
      
          Before this revision                 After this revision
          --------------------                 -------------------
              r1 <<= 0x20                          r1 <<= 0x20
              r1 >>= 0x20                          r1 >>= 0x20
              if r1 == 0x0 goto +0x2 <LBB0_2>      if r1 == 0x0 goto +0x2 <LBB0_2>
              r1 = *(u32 *)(r2 + 0x0)              r0 = *(u32 *)(r2 + 0x0)
              goto +0x1 <LBB0_3>                   goto +0x1 <LBB0_3>
          <LBB0_2>:                            <LBB0_2>:
              r1 = *(u32 *)(r2 + 0x4)              r0 = *(u32 *)(r2 + 0x4)
          <LBB0_3>:                            <LBB0_3>:
              r0 = r1                              exit
              exit
      
      For remove_truncate_8:
      
          Before this revision                 After this revision
          --------------------                 -------------------
              r2 = *(u32 *)(r1 + 0x0)              r2 = *(u32 *)(r1 + 0x0)
              r3 = r2                              r3 = r2
              r3 <<= 0x20                          r3 <<= 0x20
              r4 = r3                              r3 s>>= 0x20
              r4 s>>= 0x20
              if r4 s> 0x2 goto +0x5 <LBB0_3>      if r3 s> 0x2 goto +0x4 <LBB0_3>
              r4 = *(u32 *)(r1 + 0x4)              r3 = *(u32 *)(r1 + 0x4)
              r3 >>= 0x20
              if r3 >= r4 goto +0x2 <LBB0_3>       if r2 >= r3 goto +0x2 <LBB0_3>
              r2 += 0x2                            r2 += 0x2
              *(u32 *)(r1 + 0x0) = r2              *(u32 *)(r1 + 0x0) = r2
          <LBB0_3>:                            <LBB0_3>:
              r0 = 0x3                             r0 = 0x3
              exit                                 exit
      
      For kernel BPF selftests statistics is as follows: (-mcpu=v4):
      - For -mcpu=v4: 9 out of 655 object files have differences,
        in all cases total number of instructions marginally decreased
        (-27 instructions).
      - For -mcpu=v2: 9 out of 655 object files have differences:
        - For 19 object files number of instruction decreased
          (-129 instruction in total): some redundant `rX &= 0xffff`
          and register to register assignments removed;
        - For 2 object files number of instructions increased +2
          instructions in each file.
      
      Both -mcpu=v2 instruction increases could be reduced to the same
      example:
      
          define void @foo(ptr %p) {
          entry:
            %a = load i32, ptr %p, align 4
            %b = sext i32 %a to i64
            %c = icmp ult i64 1, %b
            br i1 %c, label %next, label %end
      
          next:
            call void inttoptr (i64 62 to ptr)(i32 %a)
            br label %end
      
          end:
            ret void
          }
      
      Note that this example uses value loaded to `%a` both as a sign
      extended (`%b`) and as zero extended (`%a` passed as parameter).
      Here is the difference in final assembly code:
      
          Before this revision          After this revision
          --------------------          -------------------
              r1 = *(u32 *)(r1 + 0)         r1 = *(u32 *)(r1 + 0)
              r1 <<= 32                     r1 <<= 32
              r1 s>>= 32                    r1 s>>= 32
              if r1 < 2 goto <LBB0_2>       if r1 < 2 goto <LBB0_2>
                                            r1 <<= 32
                                            r1 >>= 32
              call 62                       call 62
          <LBB0_2>:                     <LBB0_2>:
              exit                          exit
      
      Before this commit `%a` is passed to call as a sign extended value,
      after this commit `%a` is passed to call as a zero extended value,
      both are correct as 32-bit sub-register is the same.
      
      The difference comes from `DAGCombiner` operation on the initial DAG:
      
      Initial selection DAG before this commit:
      
          t5: i32,ch = load<(load (s32) from %ir.p)> t0, t2, undef:i64
                t6: i64 = any_extend t5         <--------------------- (1)
              t8: ch = CopyToReg t0, Register:i64 %0, t6
                  t9: i64 = sign_extend t5
                t12: i1 = setcc Constant:i64<1>, t9, setult:ch
      
      Initial selection DAG after this commit:
      
          t5: i32,ch = load<(load (s32) from %ir.p)> t0, t2, undef:i64
                t6: i64 = zero_extend t5        <--------------------- (2)
              t8: ch = CopyToReg t0, Register:i64 %0, t6
                  t9: i64 = sign_extend t5
                t12: i1 = setcc Constant:i64<1>, t9, setult:ch
      
      The node `t9` is processed before node `t6` and `load` instruction is
      combined to load with sign extension:
      
          Replacing.1 t9: i64 = sign_extend t5
          With: t30: i64,ch = load<(load (s32) from %ir.p), sext from i32> t0, t2, undef:i64
           and 0 other values
          Replacing.1 t5: i32,ch = load<(load (s32) from %ir.p)> t0, t2, undef:i64
          With: t31: i32 = truncate t30
           and 1 other values
      
      This is done by `DAGCombiner.cpp:tryToFoldExtOfLoad` called from
      `DAGCombiner::visitSIGN_EXTEND`. Note that `t5` is used by `t6` which
      is `any_extend` in (1) and `zero_extend` in (2).
      `tryToFoldExtOfLoad()` rewrites such uses of `t5` differently:
      - `any_extend` is simply removed
      - `zero_extend` is replaced by `and t30, 0xffffffff`, which is later
        converted to a pair of shifts. This pair of shifts survives till the
        end of translation.
      
      Differential Revision: https://reviews.llvm.org/D157870
      651e6445
    • Justin Bogner's avatar
      [DXILBitcodeWriter] Don't create a new abbrev per MDString · 48e0a6f9
      Justin Bogner authored
      We were running out of abbrevs and crashing if there were more than 20
      something strings in metadata, which turned out to be a bug where we
      created an abbrev every time we emitted a string rather than just one
      for the string table.
      
      Differential Revision: https://reviews.llvm.org/D158440
      48e0a6f9
    • Fangrui Song's avatar
      Revert D157750 "[Driver][CodeGen] Properly handle -fsplit-machine-functions... · 77596e6b
      Fangrui Song authored
      Revert D157750 "[Driver][CodeGen] Properly handle -fsplit-machine-functions for fatbinary compilation."
      
      This reverts commit 317a0fe5.
      This reverts commit 30c4b97a.
      
      See post-commit discussions on https://reviews.llvm.org/D157750 that
      we should use a different mechanism to handle the error with --cuda-gpu-arch=
      
      The IR/DiagnosticInfo.cpp, warn_drv_for_elf_only, codegne tests in
      clang/test/Driver, and the following driver behavior (downgrading error
      to warning) changes are undesired.
      ```
      % clang --target=riscv64 -fsplit-machine-functions -c a.c
      warning: -fsplit-machine-functions is not valid for riscv64 [-Wbackend-plugin]
      ```
      77596e6b
    • Med Ismail Bennani's avatar
      [lldb/crashlog] Fix python version requirement issue · 446abb51
      Med Ismail Bennani authored
      In 21a597c3, we fixed a module loading issue by using the new
      `argparse.BooleanOptionalAction`. However, this is only available
      starting python 3.9 and causes test failures on bots that don't fulfill
      this requirement.
      
      To address that, this patch replaces the use of `BooleanOptionalAction`
      by a pair of 2 opposite `store` actions pointing to the same destination
      variable.
      
      Differential Revision: https://reviews.llvm.org/D158452
      
      
      
      Signed-off-by: default avatarMed Ismail Bennani <ismail@bennani.ma>
      446abb51
    • Joseph Huber's avatar
      [libc] Add the 'cpp.new' as a dependency on `atexit` · a69340dd
      Joseph Huber authored
      The `atexit` function depends on the implementations in CPP/new.h but it
      is not listed as a dependency. This causes the GPU build to not include
      it in the `libcgpu.a` file and prevents us from using the startup code
      externally. Simply add it.
      
      Reviewed By: sivachandra
      
      Differential Revision: https://reviews.llvm.org/D158447
      a69340dd
    • Aart Bik's avatar
      [mlir][sparse] migrate more to new surface syntax · bb44a6b7
      Aart Bik authored
      Replaced the "NEW_SYNTAX" with the more readable "map"
      (which we may, or may not keep). Minor improvement in
      keyword parsing, migrated a few more examples over.
      
      Reviewed By: Peiming, yinying-lisa-li
      
      Differential Revision: https://reviews.llvm.org/D158325
      bb44a6b7
    • Alex Langford's avatar
      [lldb] Change UnixSignals::GetSignalAsCString to GetSignalAsStringRef · 58fe7b75
      Alex Langford authored
      This is in preparation to remove the uses of ConstString from
      UnixSignals.
      
      Differential Revision: https://reviews.llvm.org/D158209
      58fe7b75
    • Valentin Clement's avatar
      [flang][openacc] Lower acc declare to the new acc.declare function · 4d04baec
      Valentin Clement authored
      Lower the acc delcare directive in function/subroutine
      to the newly introduced acc.declare operation. Only a single
      acc.declare operation is procduced in a function or subroutine
      so they don't end up nested.
      
      Depends on D158314
      
      Reviewed By: razvanlupusoru
      
      Differential Revision: https://reviews.llvm.org/D158315
      4d04baec
    • Philip Reames's avatar
      [RISCVInsertVSETVLI] Handle vl-preserve case in backwards rewrite · dd0d36d0
      Philip Reames authored
      This updates the backwards mutation code to handle the case where the previous vset was in vl-preserving (x0, x0) form, but that VL was never used before the next vset which changes the VL. Since this requires writing both VL operands, eliminate the restriction on removing GPR producing vsetv as well. (The register will now be written by the earlier vsetv.)
      
      Differential Revision: https://reviews.llvm.org/D158019
      dd0d36d0
    • Felipe de Azevedo Piovezan's avatar
      [DwarfDebug][NFC] Factor out 'isInitialized' logic · 32223123
      Felipe de Azevedo Piovezan authored
      The class 'DbgVariable' can be in one of three states, and the "is any of them
      initialization" logic for them is repeated in a couple of places. We may want to
      expand this class in the future; as such, we factor out this common logic so
      that it is easier to modify.
      
      Differential Revision: https://reviews.llvm.org/D158438
      32223123
    • Peiming Liu's avatar
      [mlir][sparse] more complicated test for dual sparse convolution kernel. · 6ca0b272
      Peiming Liu authored
      Reviewed By: anlunx
      
      Differential Revision: https://reviews.llvm.org/D158443
      6ca0b272
    • Mark Danial's avatar
      [Flang] funderscoring intermittent failure fix · bfe390cf
      Mark Danial authored
      There is an intermittent failure in the tests for the funderscoring driver option reported in (https://lab.llvm.org/buildbot/#/builders/21/builds/78228) that is caused by an uninitialized member variable.
      
      Reviewed By: kkwli0
      
      Differential Revision: https://reviews.llvm.org/D158187
      bfe390cf
    • Andrei Homescu's avatar
      [scudo] Limit stack depot size on Trusty · 2dc5862c
      Andrei Homescu authored
      The stack depot uses several megabytes of memory
      which is a lot for Trusty.
      
      Reviewed By: Chia-hungDuan
      
      Differential Revision: https://reviews.llvm.org/D156392
      2dc5862c
    • Mehdi Amini's avatar
      Fix MLIR doc build · 6e8db667
      Mehdi Amini authored
      The complex dialect now includes the arithmetic one, and TableGen
      complains that the dialect must be explicitly specified to generate
      the doc.
      6e8db667
    • LLVM GN Syncbot's avatar
      [gn build] Port a7bdaff7 · 6c308085
      LLVM GN Syncbot authored
      6c308085
    • Felix's avatar
      [clang-tidy] readability-container-size-empty - detect missing usage of .empty() on string_literals · 4001ae17
      Felix authored
      Detect comparison between string and empty string_literals.
      
      Fixes #64547
      
      Reviewed By: PiotrZSL
      
      Differential Revision: https://reviews.llvm.org/D158346
      4001ae17
    • Craig Topper's avatar
      [RISCV][GISel] Make G_SEXT_INREG with source size of 32 legal for RV64. · 479716d9
      Craig Topper authored
      This maps to the sext.w instruction.
      
      As far as I could tell this needs custom lowering to check the immediate.
      
      Reviewed By: nitinjohnraj
      
      Differential Revision: https://reviews.llvm.org/D158350
      479716d9
    • Chris Cotter's avatar
      [clang-tidy] Implement bugprone-incorrect-enable-if · a7bdaff7
      Chris Cotter authored
      Detects incorrect usages of std::enable_if that don't name the
      nested 'type' type.
      
      Reviewed By: PiotrZSL
      
      Differential Revision: https://reviews.llvm.org/D157239
      a7bdaff7
    • Erick Velez's avatar
      [clang][ExtractAPI] Refactor C++ method and field visitation · 3bb48553
      Erick Velez authored
      Refactor visitation for C++ record children by following the Visitor's CRTP.
      Expand VisitCXXField, VisitCXXMethod for non-templates and introduce VisitCXXConstructor, VisitCXXDestructor.
      Handle relationships by finding the parent's Record via USR from DeclContext.
      
      Depends on D158029
      
      Reviewed By: dang
      
      Differential Revision: https://reviews.llvm.org/D158031
      3bb48553
    • Craig Topper's avatar
      [SelectionDAG][RISCV][SVE] Harden fixed offset version of ComputeValueVTs against scalable offsets. · e620eac7
      Craig Topper authored
      Use getFixedValue instead of getKnownMinValue to convert TypeSize
      to uint64_t. I believe this would have caught the bug fixed by
      D157872.
      
      To prevent false failures, I had to treat a scalable 0 as if it
      is fixed value.
      
      Reviewed By: paulwalker-arm
      
      Differential Revision: https://reviews.llvm.org/D158115
      e620eac7
    • Daniel Hoekwater's avatar
      Reland "[AArch64][CodeGen] Avoid inverting hot branches during relaxation"" · e223e456
      Daniel Hoekwater authored
      This is a reland of 46d2d759, which was
      reverted because of breaking build
      https://lab.llvm.org/buildbot/#/builders/21/builds/78779. However, this
      buildbot is spuriously broken due to Flang::underscoring.f90 being
      nondeterministic.
      e223e456
    • Chia-hung Duan's avatar
      [scudo] Support dumping fragmentation data in SizeClassAllocator64 · 5f771c99
      Chia-hung Duan authored
      This tells the number of pages that still have blocks in-used, i.e.,
      those pages can't do releaseToOSMaybe(). Along with the information of
      getStats() and RSS usage from the system (like smaps), we can tell if
      the heuristic in releaseToOSMaybe() works well in certain scenarios.
      
      Here's the sample output:
      ```
          Fragmentation Stats: SizeClassAllocator64: page size = 4096
            01 (    32): inuse/total blocks:    275/   416 inuse/total pages:      4/     4 inuse bytes:     16K
            02 (    48): inuse/total blocks:    182/   312 inuse/total pages:      4/     4 inuse bytes:     16K
            03 (    64): inuse/total blocks:    169/   312 inuse/total pages:      5/     5 inuse bytes:     20K
            ...
            32 (  1040): inuse/total blocks:     90/   152 inuse/total pages:     37/    39 inuse bytes:    148K
            33 (  1168): inuse/total blocks:    136/   232 inuse/total pages:     64/    67 inuse bytes:    256K
            34 (  1296): inuse/total blo...
      5f771c99
    • Erick Velez's avatar
      [clang][ExtractAPI] Add support for C++ member templates · 634b2fd2
      Erick Velez authored
      Visit and serialize C++ fields by checking if a var template's context is a CXXRecordDecl in VisitVarTemplateDecl.
      
      Depends on D158027
      
      Reviewed By: dang
      
      Differential Revision: https://reviews.llvm.org/D158029
      634b2fd2
    • Daniel Hoekwater's avatar
    • Stephen Tozer's avatar
      Revert "[Dexter] Remove builder from Dexter" · 8df9eff9
      Stephen Tozer authored
      & Revert "[Dexter] Fix incorrect substitution errors in clang-cl builder"
      
      This reverts commits 262520a3,
      and 0b72b71c.
      
      Failures occurred on two buildbots, the SIE buildbot:
      https://lab.llvm.org/buildbot/#/builders/216/builds/26006
      
      And the green dragon buildbot:
      https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/59091
      
      Errors appear to be related to incorrect tool substitution in the Dexter
      test commands, and a currently unknown error with one of the general
      debuginfo tests that uses Dexter.
      8df9eff9
    • Kolya Panchenko's avatar
      [LV] Vectorization remark for outerloop · acbe8868
      Kolya Panchenko authored
      Reviewed By: fhahn, ABataev
      
      Differential Revision: https://reviews.llvm.org/D150696
      acbe8868
    • Piotr Zegar's avatar
      [clang-tidy][NFC][DOC] Use internal references instead of external · 8407e8a8
      Piotr Zegar authored
      Use internal references instead of external links to
      navigate between checks. This allow to generate proper
      hyperlinks when documentation is generated in other
      format than html, for example: latex or pdf
      8407e8a8
    • Craig Topper's avatar
      [RISCV] Separate hasRoundModeOpNum into separate VXRM and FRM functions. · b441fd60
      Craig Topper authored
      Preparation for developing a new rounding mode insertion algorithm
      that is going to be different between them since VXRM doesn't need
      to be save/restored.
      
      This also unifies the FRM handling in RISCVISelLowering.cpp between
      scalar and vector.
      
      Fixes outdated comments in RISCVAsmPrinter and sorts the predicate
      function by the reverse order of the operands being skipped.
      
      Reviewed By: eopXD
      
      Differential Revision: https://reviews.llvm.org/D158326
      b441fd60
    • Daniel Hoekwater's avatar
      [AArch64][CodeGen] Avoid inverting hot branches during relaxation · 46d2d759
      Daniel Hoekwater authored
      Current behavior for relaxing out-of-range conditional branches
      is to invert the conditional and insert a fallthrough unconditional
      branch to the original destination. This approach biases the branch
      predictor in the wrong direction, which can degrading performance.
      
      Machine function splitting introduces many rarely-taken cross-section
      conditional branches, which are improperly relaxed. Avoid inverting
      these branches; instead, retarget them to trampolines at the end of the
      function. Doing so increases the runtime cost of jumping to cold code
      but eliminates the misprediction cost of jumping to hot code.
      
      Differential Revision: https://reviews.llvm.org/D156837
      46d2d759
    • Arthur Eubanks's avatar
      [NFC] Refactor X86TargetLowering::getGlobalWrapperKind() · 133b24a3
      Arthur Eubanks authored
      To simplify D150297.
      
      We should be looking at OpFlags more.
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D157907
      133b24a3
    • Harvin Iriawan's avatar
      [AArch64][NFC] Fix stack-guard-sysreg.ll · 7ba4896e
      Harvin Iriawan authored
        Fix test updated by commit db158c7c
      
        Differential Revision: https://reviews.llvm.org/D158432
      7ba4896e
    • Stephen Tozer's avatar
      [Dexter] Fix incorrect substitution errors in clang-cl builder · 0b72b71c
      Stephen Tozer authored
      Following 262520a3, tests on windows bots began failing due to an incorrect
      substitution in the previous patch, where clang-cl was used instead of
      clang_cl.
      
      Also fixes an inconsistency in the builders used for some of the tests
      in 'dexter-tests', where %clang++ was used for some tests and %clang for
      tests that should have identical RUN lines.
      0b72b71c
    • Artem Labazov's avatar
      [CodeGen] [ubsan] Respect integer overflow handling in abs builtin · f0bbda00
      Artem Labazov authored
      Currenly both Clang and GCC support the following set of flags that control
      code gen of signed overflow:
      
      * -fwrapv: overflow is defined as in two-complement
      * -ftrapv: overflow traps
      * -fsanitize=signed-integer-overflow: if undefined (no -fwrapv), then overflow
        behaviour is controlled by UBSan runtime, overrides -ftrapv
      
      Howerver, clang ignores these flags for __builtin_abs(int) and its higher-width
      versions, so passing minimum integer value always causes poison.
      
      The same holds for *abs(), which are not handled in frontend at all but folded
      to llvm.abs.* intrinsics during InstCombinePass. The intrinsics are not
      instrumented by UBSan, so the functions need special handling as well.
      
      This patch does a few things:
      
      * Handle *abs() in CGBuiltin the same way as __builtin_*abs()
      * -fsanitize=signed-integer-overflow now properly instruments abs() with UBSan
      * -fwrapv and -ftrapv handling for abs() is made consistent with GCC
      
      Fixes #45129 and...
      f0bbda00
    • Shoaib Meenai's avatar
      [ELF] Add -Bsymbolic-non-weak · 97e39f96
      Shoaib Meenai authored
      This adds a new -Bsymbolic option that directly binds all non-weak
      symbols. There's a couple of reasons motivating this:
      * The new flag will match the default behavior on Mach-O, so you can get
        consistent behavior across platforms.
      * We have use cases for which making weak data preemptible is useful,
        but we don't want to pessimize access to non-weak data. (For a large
        internal app, we measured 2000+ data symbols whose accesses would be
        unnecessarily pessimized by `-Bsymbolic-functions`.)
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D158322
      97e39f96
    • Erick Velez's avatar
      [clang][ExtractAPI] Visit method templates with better scheme · d8e9c5d9
      Erick Velez authored
      Visit and serialize method templates and template specializations. Introduces a new scheme of visiting child Decls via VisitCXXMethodDecl which will be followed in future patches for Fields and non-template methods.
      
      Depends on D157579
      
      Reviewed By: dang
      
      Differential Revision: https://reviews.llvm.org/D158027
      d8e9c5d9
  2. Aug 21, 2023