Skip to content

pre-commit: PR146714 #2530

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: PR146714 #2530

wants to merge 3 commits into from

Conversation

zyw-bot
Copy link
Collaborator

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

Link: llvm/llvm-project#146714
Requested by: @dtcxzyw

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

zyw-bot commented Jul 2, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@e324392
patch: llvm/llvm-project#146714
sha256: df886d347a8b302b2ea4f74b4966e81f10c029b55b0eecb934e3975bfb4e6f5f
commit: 56020ed

2110 files changed, 1764296 insertions(+), 1774849 deletions(-)

Improvements:
  instsimplify.NumReassoc 839734 -> 867821 +3.34%
  licm.NumAddSubHoisted 1337 -> 1381 +3.29%
  basicaa.SearchLimitReached 5088 -> 5162 +1.45%
  loop-simplifycfg.NumLoopBlocksDeleted 7092 -> 7121 +0.41%
  loop-simplifycfg.NumTerminatorsFolded 10648 -> 10678 +0.28%
  correlated-value-propagation.NumSICmps 64544 -> 64612 +0.11%
  licm.NumIntAssociationsHoisted 4100 -> 4104 +0.10%
  instcombine.NumFactor 46917 -> 46948 +0.07%
  instcombine.NumReassoc 286964 -> 287148 +0.06%
  instcombine.NegatorMaxInstructionsCreated 17169 -> 17178 +0.05%
Regressions:
  reassociate.NumAnnihil 835 -> 833 -0.24%
  licm.NumGEPsHoisted 61079 -> 60976 -0.17%
  simple-loop-unswitch.NumTrivial 3538 -> 3534 -0.11%
  reassociate.NumFactor 3118 -> 3116 -0.06%
  instcombine.NumSunkInst 3564518 -> 3562822 -0.05%
  instcombine.NumDeadInst 44226754 -> 44208372 -0.04%
  licm.NumSunk 281268 -> 281152 -0.04%
  indvars.NumElimCmp 57979 -> 57961 -0.03%
  local.NumPHICSEs 204984 -> 204922 -0.03%
  instcombine.NegatorNumTreesNegated 52529 -> 52515 -0.03%

15 14 bench/abc/optimized/acecRe.ll
12 10 bench/abc/optimized/giaIso2.ll
8 13 bench/abc/optimized/mvcUtils.ll
4 4 bench/abseil-cpp/optimized/exception_safety_testing_test.ll
3 4 bench/actix-rs/optimized/19s5ghr2x6s6bmh4.ll
7 11 bench/assimp/optimized/BlenderCustomData.ll
58 53 bench/assimp/optimized/BlenderLoader.ll
7 6 bench/boost/optimized/area_geo.ll
7 4 bench/cmake/optimized/cmList.ll
71 69 bench/coreutils-rs/optimized/4ws6541n7p4pbb05.ll
6 5 bench/cvc5/optimized/alpha_equivalence.ll
8 9 bench/darktable/optimized/fp_dng.ll
2 3 bench/darktable/optimized/introspection_liquify.ll
16 20 bench/diesel-rs/optimized/4dmkc4an6cvf22v6.ll
4 5 bench/draco/optimized/mesh_edgebreaker_decoder_impl.ll
4 5 bench/draco/optimized/mesh_edgebreaker_encoder_impl.ll
9 8 bench/duckdb/optimized/rsa.ll
8 5 bench/eastl/optimized/TestExtra.ll
15 21 bench/eastl/optimized/TestSegmentedVector.ll
9 10 bench/ffmpeg/optimized/dvbsub_parser.ll
2 1 bench/ffmpeg/optimized/mpeg.ll
50 54 bench/ffmpeg/optimized/rtpenc_h261.ll
11 12 bench/fish-rs/optimized/5o5xgybh9xo8acbeboom17uhq.ll
10 13 bench/fmt/optimized/base-test.ll
3 4 bench/fmt/optimized/color-test.ll
38 35 bench/foundations-rs/optimized/208outlkq19x3hykb3fof84u4.ll
71 61 bench/freetype/optimized/ftstroke.ll
4 5 bench/freetype/optimized/sfnt.ll
6 7 bench/git/optimized/color.ll
52 50 bench/git/optimized/packfile.ll
20 15 bench/gromacs/optimized/lincs.ll
11 18 bench/gromacs/optimized/selvalue.ll
9 13 bench/grpc/optimized/legacy_channel_idle_filter.ll
23 24 bench/grpc/optimized/work_serializer.ll
64 68 bench/hdf5/optimized/H5Omtime.ll
16 12 bench/hermes/optimized/APInt.ll
8 12 bench/hermes/optimized/CodeBlock.ll
2 1 bench/hermes/optimized/HadesGC.ll
7 11 bench/hermes/optimized/JSONParser.ll
2 1 bench/hermes/optimized/RegExp.ll
13 11 bench/icu/optimized/datamap.ll
6 7 bench/icu/optimized/locavailable.ll
7 8 bench/icu/optimized/ulistformatter.ll
24 29 bench/jq/optimized/jv_dtoa.ll
43 40 bench/just-rs/optimized/bulvmt5gknxyhsd.ll
42 30 bench/lean4/optimized/expr.ll
1 1 bench/libuv/optimized/inet.ll
10 12 bench/lief/optimized/AArch64Feature.ll
5 6 bench/lief/optimized/DyldBindingInfo.ll
22 18 bench/lightgbm/optimized/network.ll
23 17 bench/lightgbm/optimized/sample_strategy.ll
8 10 bench/llvm/optimized/Decl.ll
13 17 bench/llvm/optimized/ScopeInfo.ll
4 3 bench/llvm/optimized/SeedCollector.ll
12 11 bench/llvm/optimized/TemplateName.ll
14 11 bench/luajit/optimized/lj_opt_mem.ll
23 27 bench/luajit/optimized/lj_str.ll
15 13 bench/luau/optimized/lstrlib.ll
13 7 bench/meshlab/optimized/filter_ssynth.ll
34 26 bench/meshlab/optimized/multiViewer_Container.ll
23 24 bench/mold/optimized/arch-arm32.ll
20 21 bench/mold/optimized/gc-sections.cc.X86_64.ll
16 17 bench/mold/optimized/input-sections.cc.X86_64.ll
18 22 bench/nanobind/optimized/test_functions.ll
8 10 bench/nix/optimized/attr-set.ll
8 9 bench/node/optimized/libnode.packet.ll
5 4 bench/opencv/optimized/arg_layer.ll
8 7 bench/opencv/optimized/gather_layer.ll
6 5 bench/openjdk/optimized/bytecodeStream.ll
13 17 bench/openjdk/optimized/handles.ll
11 8 bench/openjdk/optimized/mlib_c_ImageAffine_BC.ll
9 8 bench/openspiel/optimized/leduc_poker.ll
16 17 bench/openssl/optimized/bio_b64.ll
7 6 bench/openusd/optimized/streamOut.ll
6 8 bench/openvdb/optimized/Filter.ll
4 5 bench/openvdb/optimized/TopologyToLevelSet.ll
8 10 bench/php/optimized/ftp_fopen_wrapper.ll
9 13 bench/php/optimized/iconv.ll
8 12 bench/php/optimized/zend_inheritance.ll
7 8 bench/php/optimized/zend_ini.ll
30 38 bench/pola-rs/optimized/1qyqkb8vgycy6h5akbtqppixy.ll
7 6 bench/pola-rs/optimized/2x1snfrtze7jig38mzpup27sc.ll
15 19 bench/pola-rs/optimized/4uf3zemqcz1kz37kef2sjlzv9.ll
12 16 bench/pola-rs/optimized/5igj4k372mlhkf3aildnxq1ta.ll
6 7 bench/postgres/optimized/guc.ll
20 18 bench/postgres/optimized/ruleutils.ll
50 45 bench/proj/optimized/horner.ll
26 14 bench/protobuf/optimized/arena.ll
6 8 bench/protobuf/optimized/descriptor.ll
26 33 bench/protobuf/optimized/field_mask_util.ll
4 6 bench/proxygen/optimized/HTTPConnectorWithFizz.ll
12 8 bench/qemu/optimized/tcg.ll
24 22 bench/quantlib/optimized/mclookbackengine.ll
3 3 bench/re2/optimized/onepass.ll
23 25 bench/redis/optimized/ziplist.ll
31 33 bench/redis/optimized/zipmap.ll
9 29 bench/ripgrep-rs/optimized/3bctup5kmnkujhz5.ll
4 5 bench/rocksdb/optimized/compression_context_cache.ll
29 26 bench/ruff-rs/optimized/9ccn8a2meujd26g9852zxayje.ll
6 7 bench/rust-analyzer-rs/optimized/1213fy5h08xh684z.ll
20 21 bench/rust-analyzer-rs/optimized/59xtetyz59tgy0g8.ll
32 38 bench/salsa-rs/optimized/94dtk09x8ywmkbr4cvij0wkfj.ll
9 11 bench/sentencepiece/optimized/arena.ll
13 9 bench/slurm/optimized/affinity.ll
9 8 bench/slurm/optimized/numa.ll
38 36 bench/typst-rs/optimized/1ru1rhojhbz2vfey.ll
31 30 bench/uv-rs/optimized/32ql9ocq6kkdl5jg2dnp7csot.ll
3 4 bench/wireshark/optimized/decode_as_model.ll
21 19 bench/z3/optimized/ddnf.ll
12 17 bench/z3/optimized/fix_dl_var_tactic.ll
22 16 bench/z3/optimized/substitution_tree.ll
6 7 bench/zed-rs/optimized/0x2swxz4m93xo6c0jggy1zzvx.ll
11 13 bench/zed-rs/optimized/4q1bnadqr1o107uase7gmrd0k.ll
15 13 bench/zstd/optimized/zstd_decompress.ll
36 34 bench/zxing/optimized/BinaryBitmap.ll

Copy link
Contributor

github-actions bot commented Jul 2, 2025

Here is a high-level summary of the most significant changes in this LLVM IR patch set:

  1. Optimized pointer comparisons using arithmetic
    Several functions previously used getelementptr and icmp eq ptr for comparing memory addresses. These have been replaced with integer arithmetic (add, shl, icmp eq i64) to compute offsets and compare them as integers instead of pointers. This change likely improves performance by reducing reliance on pointer-based logic, enabling better optimization opportunities.

  2. Reduction in intermediate GEP instructions
    Multiple instances show that redundant getelementptr (GEP) chains are simplified or removed. For example, nested GEPs were collapsed into fewer operations using multiplication and addition to directly calculate the correct offset. This reduces instruction count and simplifies control flow.

  3. Phi node reordering and cleanup
    In several loops, phi nodes were reordered or adjusted to match new control flow patterns introduced by modified loop exits or branches. This reflects restructuring of basic blocks and improved dominance handling.

  4. Loop exit block restructuring
    Some loop exits now include additional .preheader blocks or have updated branch targets. This suggests improved loop unrolling or tail duplication strategies, possibly leading to more efficient code layout and reduced branching overhead.

  5. Use of shl and mul for offset calculation
    Instead of complex pointer arithmetic involving multiple GEP steps, some functions now use shl nsw or mul nsw to calculate element offsets, especially when dealing with array indices or struct field access. This allows more predictable behavior under optimization and may enable better vectorization or constant folding.

These transformations generally point toward better scalar evolution analysis and improved lowering of pointer and array accesses into simpler integer arithmetic, which can lead to better register allocation, reduced memory usage, and faster execution.

model: qwen-plus-latest
CompletionUsage(completion_tokens=381, prompt_tokens=108646, total_tokens=109027, completion_tokens_details=None, prompt_tokens_details=None)

%.not.i.i = icmp eq ptr %8, %25
br i1 %.not.i.i, label %33, label %26
%26 = select i1 %or.cond.i.i, i64 4, i64 3
%.not.i.i = icmp samesign eq i64 %7, %26
Copy link
Owner

Choose a reason for hiding this comment

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

Regression.

%52 = sext i32 %46 to i64
%.idx64.i = shl nsw i64 %52, 4
%53 = add nsw i64 %.idx.i, -16
%.not4752.i = icmp slt i64 %53, %.idx64.i
Copy link
Owner

@dtcxzyw dtcxzyw Jul 3, 2025

Choose a reason for hiding this comment

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

%62 = add nuw nsw i64 %44, 10
%63 = add nuw nsw i64 %62, %.161
%64 = add nuw nsw i64 %63, %32
%.not72 = icmp samesign eq i64 %64, %3
Copy link
Owner

Choose a reason for hiding this comment

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

Regression.

%56 = add nuw nsw i64 %55, %21
%57 = add nuw nsw i64 %56, %34
%58 = add nuw nsw i64 %57, %46
%59 = icmp samesign ugt i64 %58, %2
Copy link
Owner

Choose a reason for hiding this comment

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

Regression.

Copy link
Owner

Choose a reason for hiding this comment

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

%13 = getelementptr inbounds nuw i8, ptr %1, i64 %2 one-use
%16 = getelementptr inbounds nuw i8, ptr %1, i64 8 multi-use
%20 = getelementptr inbounds nuw i8, ptr %16, i64 %18 multi-use
%33 = getelementptr inbounds nuw i8, ptr %20, i64 %22 multi-use
%45 = getelementptr inbounds nuw i8, ptr %33, i64 %35 one-use
%56 = getelementptr inbounds nuw i8, ptr %45, i64 %47 one-use
%57 = getelementptr inbounds nuw i8, ptr %56, i64 12 one-use
%58 = icmp ugt ptr %57, %13

->

%55 = add nuw nsw i64 %18, 20
%56 = add nuw nsw i64 %55, %22
%57 = add nuw nsw i64 %56, %35
%58 = add nuw nsw i64 %57, %47
%59 = icmp samesign ugt i64 %58, %2

Copy link
Owner

Choose a reason for hiding this comment

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

%indvars.iv = phi i64 [ 0, %59 ], [ %indvars.iv.next, %.critedge ]
%.469123 = phi ptr [ %56, %59 ], [ %66, %.critedge ]
%62 = add i64 %45, %46
%gepdiff106 = sub i64 %.neg116, %62
Copy link
Owner

Choose a reason for hiding this comment

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

Ptrdiff cannot reuse the precomputed offset.

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

Successfully merging this pull request may close these issues.

2 participants