Skip to content

pre-commit: PR127652 #2133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

pre-commit: PR127652 #2133

wants to merge 3 commits into from

Conversation

dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 18, 2025

Link: llvm/llvm-project#127652
Requested by: @nikic

@github-actions github-actions bot mentioned this pull request Feb 18, 2025
@dtcxzyw
Copy link
Owner Author

dtcxzyw commented Feb 18, 2025

runner: ariselab-64c-v2
baseline: llvm/llvm-project@378c6fb
patch: llvm/llvm-project#127652
sha256: bed5a9250f625862895411f0703df8be7c2532f81fcc4d6dd3ef369aae9f797b
commit: 396f2e6

2161 files changed, 652561 insertions(+), 646068 deletions(-)

Improvements:
  licm.NumSunk 265309 -> 266921 +0.61%
  local.NumPHICSEs 157238 -> 158014 +0.49%
  simplifycfg.NumSinkCommonCode 334152 -> 335513 +0.41%
  simplifycfg.NumSinkCommonInstrs 710668 -> 712722 +0.29%
  licm.NumHoisted 4377104 -> 4383042 +0.14%
  loop-instsimplify.NumSimplified 172001 -> 172062 +0.04%
  instsimplify.NumSimplified 2142966 -> 2143647 +0.03%
  mem2reg.NumPromoted 43476 -> 43486 +0.02%
  instcombine.NumPHICSEs 1944919 -> 1945329 +0.02%
  simplifycfg.NumHoistCommonCode 614155 -> 614230 +0.01%
Regressions:
  licm.NumLoadStorePromoted 60104 -> 59468 -1.06%
  bdce.NumRemoved 322948 -> 319861 -0.96%
  licm.NumMovedLoads 400306 -> 399542 -0.19%
  basicaa.SearchLimitReached 30061 -> 30017 -0.15%
  licm.NumPromotionCandidates 444917 -> 444281 -0.14%
  early-cse.NumCSEGEP 11145831 -> 11139251 -0.06%
  instcombine.NumSunkInst 2797268 -> 2796611 -0.02%
  adce.NumBranchesRemoved 21738 -> 21734 -0.02%
  simplifycfg.NumInvokesMerged 134392 -> 134376 -0.01%
  instcombine.NumConstProp 126191 -> 126176 -0.01%

10 7 bench/abc/optimized/sbdCore.ll
4 3 bench/abc/optimized/sswSat.ll
2 2 bench/abseil-cpp/optimized/cord_test.ll
1 1 bench/actix-rs/optimized/1rfb1t3n8679w74r.ll
14 13 bench/arrow/optimized/api_aggregate.ll
52 43 bench/arrow/optimized/api_scalar.ll
42 39 bench/arrow/optimized/api_vector.ll
14 10 bench/arrow/optimized/config.ll
5 4 bench/arrow/optimized/type.ll
6 6 bench/assimp/optimized/PlyParser.ll
4 4 bench/boost/optimized/algorithm.ll
4 4 bench/brotli/optimized/backward_references.ll
14 4 bench/casadi/optimized/code_generator.ll
6 5 bench/casadi/optimized/convexify.ll
29 25 bench/cmake/optimized/cmGetPropertyCommand.ll
36 32 bench/cmake/optimized/cmGetSourceFilePropertyCommand.ll
7 5 bench/cmake/optimized/cmQtAutoGen.ll
18 23 bench/cmake/optimized/connect.ll
25 19 bench/cvc5/optimized/extended_rewrite.ll
9 6 bench/cvc5/optimized/theory_sep.ll
20 14 bench/cvc5/optimized/theory_strings_preprocess.ll
7 4 bench/darktable/optimized/canon_600.ll
17 16 bench/diesel-rs/optimized/24idv9j1r56qvsu.ll
28 26 bench/duckdb/optimized/bignum.ll
9 9 bench/eastl/optimized/BenchmarkBitset.ll
5 5 bench/egg-rs/optimized/3r699r9ar80tn3x1.ll
58 40 bench/faiss/optimized/pq4_fast_scan_search_1.ll
9 7 bench/flatbuffers/optimized/idl_gen_kotlin.ll
109 55 bench/flatbuffers/optimized/idl_gen_kotlin_kmp.ll
11 8 bench/folly/optimized/LogConfigParser.ll
12 8 bench/grpc/optimized/chttp2_transport.ll
9 8 bench/grpc/optimized/inproc_transport.ll
18 20 bench/grpc/optimized/sockaddr_utils.ll
53 51 bench/harfbuzz/optimized/harfbuzz.ll
8 6 bench/harfbuzz/optimized/hb-static.ll
8 8 bench/html5ever-rs/optimized/126f7y4y0nk6dpjh.ll
22 30 bench/hwloc/optimized/misc.ll
6 9 bench/hyperscan/optimized/fdr.ll
6 5 bench/icu/optimized/escapesrc.ll
38 33 bench/icu/optimized/rbt_pars.ll
12 11 bench/icu/optimized/ucnv_bld.ll
62 36 bench/icu/optimized/uts46.ll
55 37 bench/imgui/optimized/imgui.ll
48 47 bench/libpng/optimized/pngwutil.ll
18 15 bench/linux/optimized/nfs4xdr.ll
18 17 bench/llvm/optimized/Clang.ll
4 3 bench/llvm/optimized/ProfileSummaryBuilder.ll
12 9 bench/luajit/optimized/lj_carith.ll
12 8 bench/luau/optimized/Parser.ll
23 22 bench/nix/optimized/derivations.ll
13 19 bench/nlohmann_json/optimized/unit-algorithms.ll
7 8 bench/nori/optimized/tabwidget.ll
11 9 bench/ocio/optimized/Lut3DOpCPU.ll
2 6 bench/ockam-rs/optimized/1webxc5tel1wnzl3.ll
4 8 bench/ockam-rs/optimized/2ngtaq92gcad4v6j.ll
2 6 bench/ockam-rs/optimized/2qz3huiqqut486jt.ll
67 54 bench/oiio/optimized/imagebufalgo_compare.ll
24 19 bench/oiio/optimized/imagebufalgo_xform.ll
60 48 bench/oiio/optimized/texturesys.ll
15 11 bench/openjdk/optimized/hb-common.ll
20 11 bench/openspiel/optimized/efg_game.ll
15 9 bench/openspiel/optimized/spades.ll
3 2 bench/openssl/optimized/evp_test.ll
21 15 bench/openusd/optimized/assetLocalization.ll
17 14 bench/openusd/optimized/jsonSerialization.ll
16 15 bench/openusd/optimized/namespaceEditor.ll
19 16 bench/openusd/optimized/statistics.ll
24 18 bench/openusd/optimized/testUsdImagingNestedInstancingCategories.ll
8 5 bench/php/optimized/engine_pcgoneseq128xslrr64.ll
16 14 bench/postgres/optimized/jsonb_gin.ll
36 28 bench/postgres/optimized/pgstatfuncs.ll
12 6 bench/proj/optimized/imw_p.ll
40 24 bench/protobuf/optimized/parser.ll
19 14 bench/proxygen/optimized/Logging.ll
43 37 bench/pyo3-rs/optimized/249pdmmr5286g8h9.ll
36 18 bench/pyo3-rs/optimized/2c6t2zmseyyrmc3o.ll
54 36 bench/rocksdb/optimized/trace_analyzer_tool.ll
9 8 bench/ruby/optimized/process.ll
13 11 bench/rust-analyzer-rs/optimized/1yf6pyfk8ihkfv63.ll
3 3 bench/slurm/optimized/reservation.ll
6 5 bench/tls-rs/optimized/4vvnrvl2eceao62c.ll
30 26 bench/turborepo-rs/optimized/1vul900b5dplxpbbkrjott84o.ll
18 12 bench/turborepo-rs/optimized/8oe5vwmwwrst9p60jy1zusiyz.ll
76 52 bench/wasmtime-rs/optimized/2rxishkjui70pb7b.ll
16 18 bench/wasmtime-rs/optimized/5g1sfst7nzqq22by.ll
38 26 bench/wasmtime-rs/optimized/pc3lkwoxfkbj2dl.ll
5 3 bench/wireshark/optimized/packet-ieee80211.ll
32 20 bench/wolfssl/optimized/hash.ll
8 16 bench/xgboost/optimized/tracker.ll
14 11 bench/z3/optimized/pb_sls.ll
12 13 bench/zed-rs/optimized/8eitysufhvsi37fsnmjuossia.ll
5 3 bench/zed-rs/optimized/c4c7jl64zv8zhv2ne6xdvhty4.ll
10 7 bench/zed-rs/optimized/e39hl8e3ablf1r15aeuqbekxt.ll
3 5 bench/zed-rs/optimized/e8p2cuwt1sxb20ryu42v8urkr.ll
14 12 bench/zed-rs/optimized/f10ffiihtazjqkmwr0jihceey.ll
32 36 bench/zxing/optimized/ODITFReader.ll

Copy link
Contributor

Summary of Major Changes in the LLVM IR Diff

  1. Reordering and Simplification of getelementptr Instructions:

    • In multiple files, such as sbdCore.ll, sswSat.ll, cord_test.ll, and others, getelementptr instructions have been reordered or moved to different basic blocks. For example, in sbdCore.ll, the getelementptr instructions for indvars.iv358.sroa.gep and indvars.iv358.sroa.gep419 were removed from the initial block and reintroduced later in a preheader block.
    • This reordering simplifies the control flow by deferring the computation of these addresses until they are actually needed, potentially improving instruction scheduling and reducing redundant computations.
  2. Introduction of Preheader Blocks:

    • Several functions now include preheader blocks (e.g., .preheader290.preheader in sbdCore.ll, .lr.ph.preheader in bignum.ll). These blocks are used to compute values (like getelementptr) that are required in subsequent loops or conditional branches.
    • This change improves loop structure clarity and can help with optimizations like loop unrolling or vectorization by centralizing loop setup code.
  3. Consolidation of Phi Nodes:

    • Phi nodes have been updated to use newly introduced getelementptr instructions instead of older ones. For instance, in config.ll, the phi node %sink.sroa.phi is updated to incorporate values from new getelementptr instructions (%.sink.sroa.gep57, %.sink.sroa.gep56).
    • This consolidation ensures that the phi nodes correctly reflect the latest computed values, which may lead to better alias analysis and memory access optimization.
  4. Removal of Redundant getelementptr Instructions:

    • Some getelementptr instructions have been removed entirely if they were not being used downstream. For example, in bignum.ll, several getelementptr instructions related to sink34.i.sroa.gep were deleted because their results were no longer necessary after restructuring.
    • This reduces the number of instructions and improves readability while ensuring only essential computations remain.
  5. Improved Use of Alias Analysis Metadata:

    • Many stores and loads now explicitly reference updated getelementptr results with alias analysis metadata (!tbaa, !alias.scope). For instance, in flatbuffers/optimized/idl_gen_kotlin_kmp.ll, the store operation uses %.sink.sroa.phi instead of older phi nodes, ensuring precise tracking of memory accesses.
    • This enhances the effectiveness of alias analysis, enabling more aggressive optimizations by the compiler, such as eliminating redundant loads/stores or improving cache locality.

High-Level Overview

The changes primarily focus on improving the structure and efficiency of memory access patterns within the LLVM IR. By reordering and consolidating getelementptr instructions, introducing preheader blocks, and updating phi nodes, the code achieves better separation of concerns between address computation and actual memory operations. Additionally, the removal of redundant getelementptr instructions and improved use of alias analysis metadata contribute to cleaner, more optimized IR.

These modifications likely stem from improvements in the Scalar Replacement of Aggregates (SROA) pass or other memory-related optimizations in LLVM. The overall goal appears to be reducing unnecessary computations, improving loop structures, and enhancing alias analysis to enable further optimizations during subsequent passes.

model: qwen-plus-latest
CompletionUsage(completion_tokens=741, prompt_tokens=106100, total_tokens=106841, completion_tokens_details=None, prompt_tokens_details=None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants