1. Jul 19, 2023
    • Jianjian GUAN's avatar
      [AVR] Enable verifyInstructionPredicates for AVR · eb33db4f
      Jianjian GUAN authored
      This patch fixes the failed test of verifyInstructionPredicates which is caused by verifyInstructionPredicates. verifyInstructionPredicates will add JMPk without checking the target predicate.
      
      Reviewed By: benshi001
      
      Differential Revision: https://reviews.llvm.org/D155570
      eb33db4f
    • Jie Fu's avatar
      [tools] Fix buildbot build failure · 16d50781
      Jie Fu authored
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:234: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:235: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:236:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:237:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:238: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3765: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3766: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3767:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
      /buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3768: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
      16d50781
    • Jake Egan's avatar
      [NFC][XCOFF] Remove curly braces from single line if statement · d2884a23
      Jake Egan authored
      Missed this detail from D155199.
      d2884a23
    • WANG Xuerui's avatar
      [LoongArch] Align functions and loops better according to uarch · f27017a0
      WANG Xuerui authored
      The LA464 micro-architecture is very sensitive to alignment of hot code,
      with performance variation of up to ~12% in the go1 benchmark suite of
      the Go language (as observed by me during my work on the Go loong64
      port).
      [[ https://go.dev/cl/479816 | Manual alignment of certain loops ]] and [[ https://go.dev/cl/479817 | automatic alignment of loop heads ]]
      helps a lot there, by reducing much of the random variation and
      generally increasing performance, so we naturally want to do the same
      here.
      
      Practically, LA464 is the only LoongArch micro-architecture in wide use,
      and we are currently supporting just that. The first "4" in "LA464"
      stands for "4-issue", in particular its instruction fetch and decode
      stages are 4-wide; so functions and branch targets should be preferably
      aligned to at least 16 bytes for best throughput.
      
      The Loongson team has benchmarked various combinations of function,
      loop, and branch target alignments with GCC.
      [[ https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619980.html | The results ]]
      show that "16-byte label alignment together with 32-byte function
      alignment gives best results in terms of SPEC score". A "label" in GCC
      means a branch target; while we don't currently align branch targets,
      we do align loops, so in this patch we default to 32-byte function
      alignment and 16-byte loop alignment.
      
      Reviewed By: SixWeining
      
      Differential Revision: https://reviews.llvm.org/D148622
      f27017a0
    • Jie Fu's avatar
      [mlir] Fix -Wcast-qual in mlir/test/CAPI/ir.c after D153911 (NFC) · 998f3e71
      Jie Fu authored
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1120:18: error: cast from 'const void *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
            (uint8_t *)mlirDenseElementsAttrGetRawData(uint8Elements);
                       ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1121:35: error: cast from 'const void *' to 'signed char *' drops const qualifier [-Werror,-Wcast-qual]
        int8_t *int8RawData = (int8_t *)mlirDenseElementsAttrGetRawData(int8Elements);
                                        ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1123:19: error: cast from 'const void *' to 'unsigned int *' drops const qualifier [-Werror,-Wcast-qual]
            (uint32_t *)mlirDenseElementsAttrGetRawData(uint32Elements);
                        ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1125:18: error: cast from 'const void *' to 'int *' drops const qualifier [-Werror,-Wcast-qual]
            (int32_t *)mlirDenseElementsAttrGetRawData(int32Elements);
                       ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1127:19: error: cast from 'const void *' to 'unsigned long long *' drops const qualifier [-Werror,-Wcast-qual]
            (uint64_t *)mlirDenseElementsAttrGetRawData(uint64Elements);
                        ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1129:18: error: cast from 'const void *' to 'long long *' drops const qualifier [-Werror,-Wcast-qual]
            (int64_t *)mlirDenseElementsAttrGetRawData(int64Elements);
                       ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1130:34: error: cast from 'const void *' to 'float *' drops const qualifier [-Werror,-Wcast-qual]
        float *floatRawData = (float *)mlirDenseElementsAttrGetRawData(floatElements);
                                       ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1132:17: error: cast from 'const void *' to 'double *' drops const qualifier [-Werror,-Wcast-qual]
            (double *)mlirDenseElementsAttrGetRawData(doubleElements);
                      ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1134:19: error: cast from 'const void *' to 'unsigned short *' drops const qualifier [-Werror,-Wcast-qual]
            (uint16_t *)mlirDenseElementsAttrGetRawData(bf16Elements);
                        ^
      /Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1136:19: error: cast from 'const void *' to 'unsigned short *' drops const qualifier [-Werror,-Wcast-qual]
            (uint16_t *)mlirDenseElementsAttrGetRawData(f16Elements);
                        ^
      10 errors generated.
      998f3e71
    • Jie Fu's avatar
      [tools] Ignore -Wcast-qual in c-index-test.c after D153911 (NFC) · 0f0c3d45
      Jie Fu authored
      /Users/jiefu/llvm-project/clang/tools/c-index-test/c-index-test.c:234:18: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
          free((char *)unsaved_files[i].Filename);
                       ^
      /Users/jiefu/llvm-project/clang/tools/c-index-test/c-index-test.c:235:18: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
          free((char *)unsaved_files[i].Contents);
                       ^
      /Users/jiefu/llvm-project/clang/tools/c-index-test/c-index-test.c:3762:32: error: cast from 'const char *' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
        return (CXIdxClientContainer)"TU";
                                     ^
      3 errors generated.
      0f0c3d45
    • eopXD's avatar
      [RISCV] Use the stack for MVT::f16 for fastcc when there are no other registers available · 32c257d3
      eopXD authored
      In D155502, we added code for the compiler to check GPR-s for f16
      under zhinx. This commit adds code to hit the stack when we run out of
      GPR-s.
      
      With this patch and D155502, resolves #63922
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D155507
      32c257d3
    • Amir Ayupov's avatar
      [BOLT][Utils] Pass cmp-rev to nfc-check-setup · 3837e3e6
      Amir Ayupov authored
      Pass the revision to checkout to (cmp-rev) as nfc-check-setup option.
      Simpifies the comparison against arbitrary commit, not just the previous one.
      
      Reviewed By: #bolt, rafauler
      
      Differential Revision: https://reviews.llvm.org/D155657
      3837e3e6
    • eopXD's avatar
      [Clang][RISCV] Improve diagnostic message for full multiply intrinsics · 28c3a74a
      eopXD authored
      The full multiply intrinsics are not included for EEW=64 in Zve64*.
      They require the V extension to be enabled.
      
      This commit improves diagnostic message from
      
      ```
      <source>:4:10: error: call to undeclared function '__riscv_vsmul_vv_i64m1';
          4 |   return __riscv_vsmul_vv_i64m1(op1, op2, __RISCV_VXRM_RNU, vl);
      ```
      
      to
      
      ```
      test.c:5:10: error: builtin requires: v
          5 |   return __riscv_vsmul_vv_i64m1(op1, op2, __RISCV_VXRM_RNU, vl);
      ```
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D155416
      28c3a74a
    • Jake Egan's avatar
      [NFC][XCOFF] Use common function to calculate file offset · ecbc812e
      Jake Egan authored
      The file offset code is repeated in nearly identical form for every derivation of SectionEntry, so make it into a method in SectionEntry instead.
      
      Reviewed By: scott.linder
      
      Differential Revision: https://reviews.llvm.org/D155199
      ecbc812e
    • eopXD's avatar
      [Clang][RISCV] Guard RVV intrinsics types that is not available when ELEN < 64 · c4a5b584
      eopXD authored
      (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1)
      requires at least `zve64x`.
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D155414
      c4a5b584
    • Owen Pan's avatar
    • Akira Hatanaka's avatar
      Fix types of arm64 MSVC __readx18/__writex18 intrinsics · 4ae87b3f
      Akira Hatanaka authored
      Using `L` for type `long` results in clang passing 64-bit integers to
      these intrinsics on LP64 operating systems. This isn't correct as the
      intrinsics accept 32-bit integers.
      
      Use `N` instead of `L` so that 32-bit integers are passed to the
      intrinsics on LP64 operating systems too. This is the same fix as the
      following two commits:
      
      33703fb9
      afa47c91
      
      Differential Revision: https://reviews.llvm.org/D155012
      4ae87b3f
    • LLVM GN Syncbot's avatar
      [gn build] Port ef70fe4d · c1e11472
      LLVM GN Syncbot authored
      c1e11472
    • Nico Weber's avatar
      [gn] port 20341c3a · b917bf00
      Nico Weber authored
      b917bf00
    • Nico Weber's avatar
      [gn] port 3f65f718 · ca91d4ec
      Nico Weber authored
      ca91d4ec
    • Fangrui Song's avatar
      [ELF] --icf: switch to xxh3_64bits · f4b4bc2f
      Fangrui Song authored
      for more efficient section content hashing. Also clean up the tests a
      bit and properly test the formatting of --print-icf-sections.
      f4b4bc2f
    • Johannes Doerfert's avatar
      [OpenMP][NFCI] Avoid storing non-constant values in ICV · f914208c
      Johannes Doerfert authored
      If we store a constant in an ICV it is easier for the optimizer to
      propagate it. Since we often use the full block for the thread limit and
      the parallel team size, we can instead replace that dynamic value with a
      constant that otherwise cannot occur, here 0.
      f914208c
    • Johannes Doerfert's avatar
      [OpenMP][NFCI] Split assertion message from assertion expression · 88a68de1
      Johannes Doerfert authored
      We ended up with `llvm.assume(icmp ne ptr as(4) null, as(4) @str)`
      because the string in address space 4 was not known to be non-null.
      There is no need to create these assumes.
      88a68de1
    • Alex MacLean's avatar
      [cmake] Add -Wcast-qual to C flags if LLVM_ENABLE_WARNINGS is defined. · 621d1d07
      Alex MacLean authored
      Disable this warning for specific cast in llvm_regcomp().
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D153911
      621d1d07
    • David Blaikie's avatar
      PseudoObjectExpr: Prefer ArrayRef over iterator_range when iterating with pointers · b43df5bf
      David Blaikie authored
      Simpler to use ArrayRef directly here rather than a more
      generic/customizable range helper like iterator_range
      b43df5bf
    • Craig Topper's avatar
      [RISCV] Simplify VROR_IV_V_X_I multiclass. NFC · b22308bc
      Craig Topper authored
      Remove template parameters that always have their default value.
      b22308bc
    • Michael Maitland's avatar
      [RISCV] Remove unused classes VPseudoTernary, VPseudoTernaryNoMaskNoPolicy,... · be6380f0
      Michael Maitland authored
      [RISCV] Remove unused classes VPseudoTernary, VPseudoTernaryNoMaskNoPolicy, and VPseudoConversionW_V
      
      These classes are dead and can be removed.
      
      Differential Revision: https://reviews.llvm.org/D155634
      be6380f0
    • Michael Jones's avatar
      [libc][NFC] reuse variable in printf string conv · 4d4e18f4
      Michael Jones authored
      The amount of spaces to pad with is stored in the variable
      padding_spaces, previously the actual write calls used the same formula
      to calculate the value. This simplifies and clarifies the values by just
      reusing the variable.
      
      Reviewed By: lntue
      
      Differential Revision: https://reviews.llvm.org/D155113
      4d4e18f4
    • Michael Jones's avatar
      [libc] Set min precision for strtofloat fuzz · 2ff8094e
      Michael Jones authored
      MPFR has a minimum precision of 2, but the strtofloat fuzz sometimes
      would request a precision of 1 for the case of the minimum subnormal.
      This patch tells the fuzzer to ignore any case where the precision would
      go below 2.
      
      Reviewed By: lntue
      
      Differential Revision: https://reviews.llvm.org/D155130
      2ff8094e
    • Po-yao Chang's avatar
      [Clang] Add warnings for CWG2521 · 5ce5e983
      Po-yao Chang authored
      1. Teach -Wuser-defined-literals to warn on using double underscores in
         literal suffix identifiers.
      2. Add -Wdeprecated-literal-operator to warn about the use of the first
         grammar production of literal-operator-id, which defaults to off for now.
      
      Differential Revision: https://reviews.llvm.org/D152632
      5ce5e983
    • Matthew Voss's avatar
      [lld] A Unified LTO Bitcode Frontend · ab9b3c84
      Matthew Voss authored
      The unified LTO pipeline creates a single LTO bitcode structure that can
      be used by Thin or Full LTO. This means that the LTO mode can be chosen
      at link time and that all LTO bitcode produced by the pipeline is
      compatible, from an optimization perspective. This makes the behavior of
      LTO a bit more predictable by normalizing the set of LTO features
      supported by each LTO bitcode file.
      
      Example usage:
      
      clang -flto -funified-lto -fuse-ld=lld foo.c
      
      clang -flto=thin -funified-lto -fuse-ld=lld foo.c
      
      clang -c -flto -funified-lto foo.c  # -flto={full,thin} are identical in
      terms of compilation actions
      clang -flto=thin -fuse-ld=lld foo.o # pass --lto=thin to ld.lld
      
      clang -c -flto -funified-lto foo.c clang -flto -fuse-ld=lld foo.o
      
      The RFC discussing the details and rational for this change is here:
      https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774
      
      Differential Revision: https://reviews.llvm.org/D123805
      ab9b3c84
    • Rashmi Mudduluru's avatar
    • Rashmi Mudduluru's avatar
      3ea673a9
    • Yitzhak Mandelbaum's avatar
      [clang][dataflow] Add function to `WatchedLiteralsSolver` that reports whether... · 1defa781
      Yitzhak Mandelbaum authored
      [clang][dataflow] Add function to `WatchedLiteralsSolver` that reports whether the iteration limit has been reached.
      
      This change provides a centralized record of whether the solver is
      "exhausted". In general, once the solver is exhausted, further uses do not
      produce meaningful conclusions. Clients can use this information, for example,
      to choose to discard all results based on the solver, instead of trying to
      distinguish those reached before the limit was reached. Providing it at in the
      solver avoids the need to propagate it from each callsite to the client of the
      solver.
      
      Differential Revision: https://reviews.llvm.org/D155636
      1defa781
    • Amir Ayupov's avatar
      [BOLT] Switch to using layout order in YAML · 69b7e257
      Amir Ayupov authored
      Use layout order in YAML profile reading/writing. Preserve old behavior (DFS order)
      under `-profile-use-dfs` option.
      
      Reviewed By: spupyrev
      
      Differential Revision: https://reviews.llvm.org/D155514
      69b7e257
    • Amir Ayupov's avatar
      [BOLT][NFC] Rename icf-dfs option variable to ICFUseDFS · 599e0da3
      Amir Ayupov authored
      Rename to avoid collision with profile-use-dfs.
      
      Differential Revision: https://reviews.llvm.org/D155513
      599e0da3
    • Owen Pan's avatar
      [clang-format] Add TypeNames option to disambiguate types/objects · 5c106f7b
      Owen Pan authored
      If a non-keyword identifier is found in TypeNames, then a *, &, or && that
      follows it is annotated as TT_PointerOrReference.
      
      Differential Revision: https://reviews.llvm.org/D155273
      5c106f7b
    • Valentin Clement's avatar
      [flang][openacc] Support static slice in reduction lowering · a060102b
      Valentin Clement authored
      Lower static array slices reduction with the correct
      type.
      
      Reviewed By: razvanlupusoru
      
      Differential Revision: https://reviews.llvm.org/D155519
      a060102b
    • Piotr Zegar's avatar
      [clang-tidy] Allow explicit throwing in bugprone-exception-escape for special functions · ff40c348
      Piotr Zegar authored
      Functions declared explicitly with noexcept(false) or throw(exception)
      will be excluded from the analysis, as even though it is not recommended for
      functions like swap, main, move constructors and assignment operators,
      and destructors, it is a clear indication of the developer's intention and
      should be respected.
      
      Fixes: #40583, #55143
      
      Reviewed By: carlosgalvezp
      
      Differential Revision: https://reviews.llvm.org/D153423
      ff40c348
    • Sedenion's avatar
      [clang-format] Fix indent for selective formatting · 0570cc56
      Sedenion authored
      The problem was that the LevelIndentTracker remembered
      the indentation level of previous deeper levels when
      leaving a scope. Afterwards, when it entered again a
      deeper level, it blindly reused the previous
      indentation level. In case the --lines option was used
      such that the previous deeper level was not formatted,
      that previous level was whatever happened to be there
      in the source code. The formatter simply believed it.
      
      This is fixed by letting the LevelIndentTracker forget
      the previous deeper levels when stepping out of them
      (=> change in LevelIndentTracker::nextLine()).
      Note that this used to be the case until LLVM 14.0.6,
      but was changed in https://reviews.llvm.org/D129064
      (#56352) to fix a crash. Our commit here essentially
      reverts that crash fix. It was incorrect/incomplete.
      
      Fixes #58464.
      Fixes #59178.
      Fixes #62799.
      
      Differential Revision: https://reviews.llvm.org/D151047
      0570cc56
    • Daniil Suchkov's avatar
      [AArch64] NFC. Add a test exposing a bug in FixupStatepointCallerSaved pass · 6fa66acf
      Daniil Suchkov authored
      This pass doesn't take register classes into account, so it ends up
      trying to spill a non-GP register onto stack which is not correct.
      6fa66acf
    • Christopher Ferris's avatar
      [scudo] Fix memtag tests. · 902c41fc
      Christopher Ferris authored
      A few memtag tests were using EXPECT_DEBUG_DEATH which executes the
      statement unless NDEBUG is set. This meant the statement would
      cause an abort, but the EXPECT_DEATH part was not done. Change these
      to simply EXPECT_DEATH, these tests already verify that SCUDO_DEBUG
      is set before checking for DEATH.
      
      Reviewed By: Chia-hungDuan
      
      Differential Revision: https://reviews.llvm.org/D155538
      902c41fc
    • Amanda Tang's avatar
      [ODS] Quick fix · 729ffb5c
      Amanda Tang authored
      Quick fix for a failing test in https://reviews.llvm.org/rG5267ed05bc4612e91409d63b4dbc4e01751acb75
      
      Reviewed By: jpienaar
      
      Differential Revision: https://reviews.llvm.org/D155637
      729ffb5c
    • Fangrui Song's avatar
      [Support] Add llvm::xxh3_64bits · 48e93f57
      Fangrui Song authored
      ld.lld SHF_MERGE|SHF_STRINGS duplicate elimination is computation heavy
      and utilitizes llvm::xxHash64, a simplified version of XXH64.
      Externally many sources confirm that a new variant XXH3 is much faster.
      
      I have picked a few hash implementations and computed the
      proportion of time spent on hashing in the overall link time (a debug
      build of clang 16 on a machine using AMD Zen 2 architecture):
      
      * llvm::xxHash64: 3.63%
      * official XXH64 (`#define XXH_VECTOR XXH_SCALAR`): 3.53%
      * official XXH3_64bits (`#define XXH_VECTOR XXH_SCALAR`): 1.21%
      * official XXH3_64bits (default, essentially `XXH_SSE2`): 1.22%
      * this patch llvm::xxh3_64bits: 1.19%
      
      The remaining part of lld remains unchanged. Consequently, a lower ratio
      indicates that hashing is faster. Therefore, it is evident that XXH3 from xxhash
      is significantly faster than both the official version and our llvm::xxHash64.
      
      (
      string length: count
      1-3: 393434
      4-8: 2084056
      9-16: 2846249
      17-128: 5598928
      129-240: 1317989
      241-: 328058...
      48e93f57