Skip to content

Conversation

@zyw-bot
Copy link
Collaborator

@zyw-bot zyw-bot commented Jul 30, 2025

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

@github-actions github-actions bot mentioned this pull request Jul 30, 2025
@zyw-bot
Copy link
Collaborator Author

zyw-bot commented Jul 30, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@3696120
patch: llvm/llvm-project#151333
sha256: c8aaa6dcbd61a030267549a0ce73267329844b0385e0b279372a71784e0fe5df
commit: b166157

9135 files changed, 13100610 insertions(+), 12970814 deletions(-)

Improvements:
  licm.NumGEPsHoisted 60456 -> 78827 +30.39%
  basicaa.SearchLimitReached 5081 -> 5316 +4.63%
  licm.NumSunk 280918 -> 283503 +0.92%
  licm.NumHoisted 5627016 -> 5648472 +0.38%
  bdce.NumRemoved 397418 -> 398392 +0.25%
  gvn.NumGVNEqProp 455650 -> 456707 +0.23%
  memory-builtins.ObjectVisitorLoad 2482020 -> 2486798 +0.19%
  dse.NumFastOther 516044 -> 516962 +0.18%
  simplifycfg.NumSinkCommonInstrs 836357 -> 837602 +0.15%
  dse.NumFastStores 1198737 -> 1200477 +0.15%
Regressions:
  loop-simplifycfg.NumLoopBlocksDeleted 6777 -> 6728 -0.72%
  loop-simplifycfg.NumTerminatorsFolded 10472 -> 10453 -0.18%
  instcombine.NumDeadInst 44218226 -> 44143189 -0.17%
  simple-loop-unswitch.NumSelects 1919 -> 1917 -0.10%
  correlated-value-propagation.NumShlNUW 163238 -> 163098 -0.09%
  simplifycfg.NumInvokeSetsFormed 59475 -> 59437 -0.06%
  loop-instsimplify.NumSimplified 182332 -> 182216 -0.06%
  correlated-value-propagation.NumMulNUW 64023 -> 63985 -0.06%
  simple-loop-unswitch.NumCostMultiplierSkipped 15581 -> 15572 -0.06%
  simple-loop-unswitch.NumSwitches 1852 -> 1851 -0.05%

6 3 bench/abc/optimized/giaTtopt.ll
11 10 bench/abseil-cpp/optimized/gmock-all.ll
17 13 bench/actix-rs/optimized/4zcw438fefceam0r.ll
1 2 bench/assimp/optimized/AMFImporter_Postprocess.ll
7 8 bench/assimp/optimized/Importer.ll
21 18 bench/boost/optimized/pool_resource.ll
2 1 bench/boost/optimized/to_chars.ll
1 2 bench/box2d/optimized/linux_joystick.ll
2 1 bench/bullet3/optimized/btConvexHull.ll
5 4 bench/c3c/optimized/llvm_codegen.ll
5 4 bench/c3c/optimized/symtab.ll
9 8 bench/casadi/optimized/rootfinder.ll
25 23 bench/ceres/optimized/block_random_access_dense_matrix.ll
12 8 bench/ceres/optimized/polynomial.ll
5 4 bench/clamav/optimized/hashtab.ll
8 5 bench/clamav/optimized/inflate64.ll
24 20 bench/clap-rs/optimized/28kpmq8k0hu4re4f.ll
14 7 bench/clap-rs/optimized/58cs3pckwcmstm46.ll
4 2 bench/clap-rs/optimized/rh1bh36cvgkzipt.ll
2 1 bench/cmake/optimized/uv-common.ll
9 5 bench/coreutils-rs/optimized/389ib4lq03w39x6a.ll
4 6 bench/cpython/optimized/gcmodule.ll
2 3 bench/cpython/optimized/lexer.ll
8 5 bench/curl/optimized/multi.ll
4 3 bench/cvc5/optimized/atom_requests.ll
6 4 bench/delta-rs/optimized/3e84m8xk6w9g4bb2.ll
5 4 bench/diesel-rs/optimized/3btvyztn2iiarpvf.ll
7 6 bench/duckdb/optimized/ub_duckdb_main_capi_cast.ll
6 3 bench/eastl/optimized/EASprintfOrdered.ll
6 4 bench/egg-rs/optimized/3vlwzyp0day7srdg.ll
34 35 bench/elfshaker-rs/optimized/3a1f053714hdbf2r1u9m19s6u.ll
4 3 bench/elfshaker-rs/optimized/9f70t9k6da07jnr9o42fbjzc5.ll
16 15 bench/entt/optimized/group.ll
41 39 bench/fish-rs/optimized/7ggr7vxi3lrn28dd77bkw6see.ll
16 14 bench/fish-rs/optimized/e69mx4kebbw5h90l2bpw0bwyt.ll
11 10 bench/fmt/optimized/gmock-gtest-all.ll
28 18 bench/folly/optimized/EventBase.ll
33 25 bench/foundations-rs/optimized/208outlkq19x3hykb3fof84u4.ll
10 8 bench/freetype/optimized/cff.ll
16 14 bench/g2o/optimized/marginal_covariance_cholesky.ll
10 6 bench/git/optimized/preload-index.ll
4 3 bench/graphviz/optimized/dotinit.ll
7 6 bench/graphviz/optimized/poly.ll
2 1 bench/grpc/optimized/xds_override_host.ll
10 8 bench/harfbuzz/optimized/hb-ot-cff1-table.ll
20 19 bench/hdf5/optimized/H5FSdbg.ll
18 17 bench/hdf5/optimized/H5Ochunk.ll
2 1 bench/hermes/optimized/ChromeTraceSerializer.ll
7 5 bench/html5ever-rs/optimized/19ci5iy6gkdi8zuj.ll
18 17 bench/hwloc/optimized/hwloc-ps.ll
17 16 bench/hyperscan/optimized/dfa_min.ll
4 6 bench/influxdb-rs/optimized/3k3vgyqcou07q2z6.ll
8 10 bench/influxdb-rs/optimized/u7z03ejdn0bs7a8.ll
13 14 bench/jemalloc/optimized/eset.ll
8 6 bench/just-rs/optimized/3022oi333lxf39jd.ll
5 10 bench/lean4/optimized/static.ll
6 5 bench/libevent/optimized/bufferevent_ssl.ll
27 30 bench/libevent/optimized/watch.ll
2 1 bench/libigl/optimized/ViewerData.ll
2 1 bench/libigl/optimized/sparse_cached.ll
54 50 bench/libjpeg-turbo/optimized/rdswitch.ll
6 4 bench/libquic/optimized/activity_tracker.ll
13 10 bench/libquic/optimized/err.ll
13 10 bench/libquic/optimized/inflate.ll
17 16 bench/libwebp/optimized/cost_enc.ll
6 7 bench/libwebp/optimized/vp8l_dec.ll
4 5 bench/lief/optimized/entropy.ll
2 3 bench/lief/optimized/oid.ll
45 43 bench/llama.cpp/optimized/log.ll
7 5 bench/lua/optimized/lstring.ll
12 8 bench/luajit/optimized/lib_ffi.ll
35 32 bench/luajit/optimized/lj_opt_loop.ll
7 3 bench/lvgl/optimized/lv_draw_sw_mask_rect.ll
8 7 bench/meilisearch-rs/optimized/3m3x2x3yg1gvj93u.ll
10 9 bench/memcached/optimized/slabs.ll
5 3 bench/mimalloc/optimized/heap.ll
14 15 bench/mimalloc/optimized/segment.ll
11 8 bench/mini-lsm-rs/optimized/4wwk8tlxvknqh1t8.ll
15 10 bench/mold/optimized/dynamic_link.ll
2 4 bench/mold/optimized/thread_dispatcher.ll
30 24 bench/nghttp2/optimized/nghttp2_map.ll
11 7 bench/nghttp2/optimized/nghttp2_submit.ll
5 4 bench/nix/optimized/add-to-store.ll
23 21 bench/nuttx/optimized/mempool_multiple.ll
29 30 bench/nuttx/optimized/mm_malloc.ll
20 17 bench/ocio/optimized/GpuShader.ll
24 22 bench/ocio/optimized/LookParse.ll
15 11 bench/ockam-rs/optimized/14jhibpevwjs778a.ll
10 12 bench/oiio/optimized/ElementReadStream.ll
29 31 bench/oiio/optimized/Reader.ll
15 13 bench/open3d/optimized/PinholeCameraTrajectory.ll
17 12 bench/opencv/optimized/contours_common.ll
3 4 bench/openexr/optimized/internal_huf.ll
5 6 bench/openspiel/optimized/ABstats.ll
9 12 bench/openssl/optimized/statem_lib.ll
4 5 bench/openusd/optimized/av1_loopfilter.ll
12 6 bench/openusd/optimized/parserPlugin.ll
9 7 bench/openusd/optimized/strengthOrdering.ll
16 12 bench/openusd/optimized/typeTraits.ll
4 2 bench/openvdb/optimized/AttributeSet.ll
15 12 bench/openvdb/optimized/Queue.ll
10 5 bench/ozz-animation/optimized/raw_track.ll
57 39 bench/pbrt-v4/optimized/scene.ll
20 16 bench/pingora-rs/optimized/31j9x1yac3tbgzqgz7fdnl2q0.ll
16 12 bench/pingora-rs/optimized/9p340cni5ef4byzbq5uzx23g8.ll
37 34 bench/pocketpy/optimized/gc.ll
12 11 bench/pola-rs/optimized/7m5bf1eqnwjxx8o6tuahkftad.ll
4 2 bench/pola-rs/optimized/9n2idp9g5wabsfk9h5z1ax8tc.ll
10 11 bench/pola-rs/optimized/cil91sqjm14i40hvtn93g3igf.ll
62 65 bench/portaudio/optimized/pa_linux_pulseaudio.ll
4 3 bench/proj/optimized/trans.ll
55 51 bench/proj/optimized/unitconvert.ll
11 8 bench/proxygen/optimized/HPACKCodec.ll
10 7 bench/proxygen/optimized/QPACKHeaderTable.ll
11 8 bench/pyo3-rs/optimized/36bd5489ry9qsmb9.ll
4 2 bench/qdrant-rs/optimized/56pxyf4u4f2wpi3v.ll
4 3 bench/qemu/optimized/system.ll
9 7 bench/quickjs/optimized/qjsc.ll
5 4 bench/raft-rs/optimized/d5pa1kzoe6m82bg0xl3ke9nfw.ll
29 31 bench/rayon-rs/optimized/2xi93mrj8f00xnic.ll
10 5 bench/re2/optimized/set.ll
9 13 bench/recastnavigation/optimized/DetourLocalBoundary.ll
5 7 bench/redis/optimized/latency.ll
4 2 bench/regex-rs/optimized/1x04d8372kemp7hd.ll
26 22 bench/ripgrep-rs/optimized/58dexfd2ydnodcl0.ll
28 26 bench/ripgrep-rs/optimized/5ckxrdy9v0i8g3uf.ll
12 14 bench/ruby/optimized/file.ll
25 23 bench/ruby/optimized/re.ll
2 3 bench/ruff-rs/optimized/5w459yx4cbffhf0y4cegeyhh9.ll
5 8 bench/rust-analyzer-rs/optimized/4yvp88cqyyaanzkc.ll
54 48 bench/rustfmt-rs/optimized/3n0n7c4xrusd0kzl.ll
4 3 bench/salsa-rs/optimized/0re58vbodfo9fw2ucr33a7vsy.ll
17 15 bench/sdl/optimized/SDL_x11xfixes.ll
15 14 bench/sentencepiece/optimized/bpe_model_trainer.ll
5 3 bench/sentencepiece/optimized/generated_enum_util.ll
5 3 bench/sentencepiece/optimized/trainer_interface.ll
14 9 bench/smol-rs/optimized/21eidrukyvr99qqv.ll
10 7 bench/tokio-rs/optimized/r9h5225tdo2hxm6.ll
5 4 bench/tree-sitter-rs/optimized/s186efq8x74ief6.ll
2 3 bench/uv-rs/optimized/b1g2y9imcx7brty5xgizhygb8.ll
38 37 bench/verilator/optimized/V3Delayed.ll
25 21 bench/verilator/optimized/V3Subst.ll
15 14 bench/wasmedge/optimized/argument_parser.ll
4 3 bench/wasmi-rs/optimized/5j8r45rfbax70rfnan7wcjxtw.ll
25 19 bench/wasmtime-rs/optimized/24jxjxhx40nukvhl.ll
19 18 bench/wasmtime-rs/optimized/4qgt4edt0wnnlcua.ll
13 12 bench/wireshark/optimized/interface_frame.ll
13 10 bench/wolfssl/optimized/ecc.ll
22 15 bench/yalantinglibs/optimized/binary_json_conformance_suite.ll
22 14 bench/yalantinglibs/optimized/client.ll
4 6 bench/zed-rs/optimized/0drf4dow76rapncpvt6xcgeqh.ll
3 5 bench/zed-rs/optimized/2y3d15fhybcig6chysm503x7k.ll
13 10 bench/zlib/optimized/inflate.ll
7 6 bench/zstd/optimized/fse_compress.ll
22 21 bench/zstd/optimized/zstd_ldm.ll
4 6 bench/zstd/optimized/zstd_v04.ll
16 15 bench/zxing/optimized/PDFReader.ll

@github-actions
Copy link
Contributor

The provided patch contains several key changes across multiple LLVM IR files. Here is a summary of the major changes:

  1. Optimization of GEP (GetElementPtr) Instructions:

    • Multiple instances of getelementptr instructions with complex index sequences are simplified by introducing an intermediate invariant.gep pointer. This reduces redundancy and improves readability. For example, in giaTtopt.ll, the GEP instruction is split into two steps: first computing a base pointer and then applying an offset.
  2. Introduction of Invariant Base Pointers:

    • Several functions now precompute an invariant base pointer using getelementptr with a fixed offset (e.g., i64 8 or i64 16). This base pointer is reused in subsequent GEP operations within loops, reducing repeated calculations and enhancing performance.
  3. Loop Structure Refactoring:

    • Loops are restructured to separate initialization from iteration. A new block (e.g., .preheader) initializes the invariant base pointer before entering the main loop body. This change improves loop optimization opportunities for the compiler.
  4. Phi Node Adjustments:

    • PHI nodes in loop exits and landing pads are updated to reflect new variable names resulting from the refactored GEP sequences. These changes ensure correct dominance and value tracking across control flow paths.
  5. Code Simplification and Cleanup:

    • Redundant or obsolete GEP sequences involving multiple indices and struct fields are replaced with simpler, more direct accesses via the new invariant base pointers. This results in cleaner, more maintainable IR code.

These changes collectively aim to enhance code efficiency and facilitate better optimization by the LLVM backend, particularly in scenarios involving repeated pointer arithmetic within loops.

model: qwen-plus-latest
CompletionUsage(completion_tokens=362, prompt_tokens=111919, total_tokens=112281, completion_tokens_details=None, prompt_tokens_details=None)

%24 = getelementptr i8, ptr %23, i64 %.idx.i
%23 = getelementptr inbounds nuw i8, ptr %12, i64 160
%23 = getelementptr inbounds nuw [1 x %struct.mi_page_s], ptr %23, i64 0, i64 %22
%24 = getelementptr inbounds nuw i8, ptr %23, i64 56
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing fold to combine constant GEP indices: https://llvm.godbolt.org/z/xonqM9Wqj

@nikic
Copy link

nikic commented Jul 30, 2025

Produces a lot of new constant offset invariant.gep. Should suppress that case in LICM.

@dtcxzyw dtcxzyw closed this Aug 2, 2025
@dtcxzyw dtcxzyw deleted the test-run16625180294 branch August 2, 2025 06:40
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.

3 participants