Skip to content

pre-commit: PR147263 #2552

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

Closed
wants to merge 3 commits into from
Closed

pre-commit: PR147263 #2552

wants to merge 3 commits into from

Conversation

zyw-bot
Copy link
Collaborator

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

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

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

zyw-bot commented Jul 7, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@ded1426
patch: llvm/llvm-project#147263
sha256: a67268fb5b661a0a2f30bf1ba977f7cac2a3522e6f3eb77f74300ca4ccb40a87
commit: 6d5a7b0

1138 files changed, 311257 insertions(+), 315812 deletions(-)

Improvements:
  instcombine.NumFactor 46917 -> 46972 +0.12%
  correlated-value-propagation.NumAddNSW 283117 -> 283374 +0.09%
  correlated-value-propagation.NumAddNW 521125 -> 521415 +0.06%
  correlated-value-propagation.NumNSW 656749 -> 657007 +0.04%
  correlated-value-propagation.NumNW 1076762 -> 1077054 +0.03%
  licm.NumBOAssociationsHoisted 7177 -> 7178 +0.01%
  correlated-value-propagation.NumAddNUW 238008 -> 238041 +0.01%
  correlated-value-propagation.NumPhiCommon 58391 -> 58397 +0.01%
  correlated-value-propagation.NumSubNUW 39244 -> 39248 +0.01%
  correlated-value-propagation.NumNUW 617270 -> 617304 +0.01%
Regressions:
  licm.NumAddSubHoisted 1337 -> 1320 -1.27%
  instcombine.NegatorNumTreesNegated 52532 -> 51876 -1.25%
  instcombine.NegatorNumInstructionsNegatedSuccess 64337 -> 63677 -1.03%
  instcombine.NegatorNumInstructionsCreatedTotal 69403 -> 68743 -0.95%
  instcombine.NegatorMaxDepthVisited 20740 -> 20706 -0.16%
  reassociate.NumAnnihil 835 -> 834 -0.12%
  instcombine.NegatorMaxTotalValuesVisited 64790 -> 64720 -0.11%
  instsimplify.NumReassoc 839903 -> 839453 -0.05%
  loop-delete.NumBackedgesBroken 46244 -> 46224 -0.04%
  adce.NumRemoved 102958 -> 102915 -0.04%

12 14 bench/abc/optimized/giaTransduction.ll
2 2 bench/abseil-cpp/optimized/parser_test.ll
4 4 bench/boost/optimized/area.ll
5 5 bench/boost/optimized/cmdline.ll
41 45 bench/boost/optimized/default_filter_factory.ll
28 30 bench/boost/optimized/message.ll
27 22 bench/ceres/optimized/compressed_row_sparse_matrix.ll
22 22 bench/ceres/optimized/eigensparse.ll
8 8 bench/clamav/optimized/mbox.ll
3 4 bench/cmake/optimized/cmOrderDirectories.ll
10 11 bench/coreutils-rs/optimized/4jcegsvljtrqsq46.ll
14 14 bench/darktable/optimized/imageop_math.ll
5 5 bench/duckdb/optimized/prog.ll
32 28 bench/duckdb/optimized/sds.ll
10 11 bench/eastl/optimized/BenchmarkAlgorithm.ll
2 4 bench/eastl/optimized/EAMemory.ll
9 9 bench/eastl/optimized/EASprintfCore.ll
4 6 bench/eastl/optimized/TestFixedString.ll
20 21 bench/ffmpeg/optimized/hca.ll
21 22 bench/ffmpeg/optimized/rtpenc_aac.ll
50 59 bench/ffmpeg/optimized/rtpenc_amr.ll
36 38 bench/freetype/optimized/sfnt.ll
85 93 bench/freetype/optimized/type1.ll
11 11 bench/g2o/optimized/slam2d_linear.ll
16 16 bench/glog/optimized/signalhandler.ll
6 8 bench/grpc/optimized/slice.ll
74 72 bench/hdf5/optimized/H5Obtreek.ll
78 76 bench/hdf5/optimized/H5Odrvinfo.ll
48 45 bench/hdf5/optimized/H5Omtime.ll
45 41 bench/hdf5/optimized/H5Orefcount.ll
7 9 bench/hermes/optimized/DependencyExtractor.ll
2 2 bench/hermes/optimized/HandleRootOwner.ll
82 85 bench/jq/optimized/decNumber.ll
56 57 bench/jq/optimized/jv_dtoa.ll
3 3 bench/libcxx/optimized/cxa_demangle.ll
34 36 bench/libigl/optimized/min_quad_with_fixed.2.ll
29 31 bench/libsodium/optimized/shorthash_siphash24_ref.ll
65 66 bench/lief/optimized/ecjpake.ll
39 41 bench/lief/optimized/rsa.ll
23 25 bench/linux/optimized/decompress_unlzo.ll
14 15 bench/linux/optimized/namei.ll
6 7 bench/linux/optimized/ndisc.ll
7 9 bench/linux/optimized/nf_nat_helper.ll
1 2 bench/llvm/optimized/BasicAliasAnalysis.ll
14 16 bench/llvm/optimized/Expr.ll
4 6 bench/llvm/optimized/IRSimilarityIdentifier.ll
14 16 bench/llvm/optimized/LazyCallGraph.ll
10 14 bench/llvm/optimized/MemProf.ll
8 11 bench/meshlab/optimized/additionalgui.ll
23 28 bench/meshlab/optimized/filter_voronoi.ll
9 10 bench/meshlab/optimized/io_collada.ll
19 20 bench/meshlab/optimized/mainwindow_Init.ll
16 22 bench/meshlab/optimized/multiViewer_Container.ll
18 19 bench/mini-lsm-rs/optimized/4c6shhrwpfde8fun.ll
30 30 bench/nanobind/optimized/test_eigen.ll
12 13 bench/nghttp2/optimized/sfparse.ll
34 34 bench/oiio/optimized/deepdata.ll
15 19 bench/oiio/optimized/strutil.ll
11 12 bench/opencv/optimized/aruco_detector.ll
37 35 bench/opencv/optimized/gemm_layer.ll
23 25 bench/openjdk/optimized/attachListener_posix.ll
16 17 bench/openjdk/optimized/klassVtable.ll
17 16 bench/openjdk/optimized/relocInfo_x86.ll
10 12 bench/openssl/optimized/bio_b64.ll
12 13 bench/openssl/optimized/siphash.ll
6 6 bench/openssl/optimized/stanza.ll
13 12 bench/openusd/optimized/pathExpressionEval.ll
11 14 bench/php/optimized/zend_generators.ll
69 70 bench/php/optimized/zend_strtod.ll
10 8 bench/pola-rs/optimized/40wah5zis7dsqiheha5veerhb.ll
9 9 bench/pola-rs/optimized/9e3hi5rinq7qrjv1lrpozyc63.ll
10 11 bench/qemu/optimized/fdt.ll
12 14 bench/quantlib/optimized/abcdatmvolcurve.ll
6 8 bench/quantlib/optimized/generalizedhullwhite.ll
3 3 bench/quantlib/optimized/tcopulapolicy.ll
8 8 bench/quickjs/optimized/quickjs.ll
45 47 bench/raylib/optimized/rtextures.ll
9 14 bench/recastnavigation/optimized/catch_amalgamated.ll
33 29 bench/redis/optimized/sds.ll
83 84 bench/ruby/optimized/random.ll
14 14 bench/ruff-rs/optimized/4a0sesc153a050u04do7llz00.ll
12 12 bench/ruff-rs/optimized/4y0unrlbgjyvysqyc1zrg4crs.ll
57 58 bench/ruff-rs/optimized/cf4d78dtw2y7jldih6lhmy5k5.ll
13 15 bench/stb/optimized/stb_image_resize2.ll
4 5 bench/stockfish/optimized/search.ll
20 22 bench/tev/optimized/Image.ll
29 31 bench/tev/optimized/StbiLdrImageSaver.ll
20 22 bench/tev/optimized/main.ll
15 18 bench/uv-rs/optimized/bt5f6f08hvtjlcji6qu3dcjek.ll
14 22 bench/velox/optimized/ExprToSubfieldFilter.ll
27 37 bench/velox/optimized/Filter.ll
13 20 bench/velox/optimized/Type.ll
7 9 bench/zxing/optimized/ODCode128Reader.ll

Copy link
Contributor

github-actions bot commented Jul 7, 2025

Here is a summary of up to 5 major changes in the provided LLVM IR diff, focusing on interesting transformations and ignoring formatting, comments, or reordering:


1. Simplified Pointer Arithmetic and Bounds Checks

Several instances of pointer arithmetic involving getelementptr and bounds checks have been simplified by removing intermediate negation and subtraction steps. For example:

  • Replaced:
    %12 = getelementptr i8, ptr %10, i64 -8
  • With:
    %12 = add nsw i64 %storemerge.idx.i.i.i75, %.idx

This reduces the number of operations needed to compute memory addresses and avoids negative offsets.

Files affected: giaTransduction.ll, message.ll, cmdline.ll


2. Optimized PHI Nodes in Loops

In several loop exit blocks, phi nodes have been updated to reflect new incoming edges or simplify values based on changed control flow. This indicates that the control flow graph has been adjusted, possibly due to better branch prediction or elimination of redundant paths.

For example:

  • Old:
    %.3.i.i.i = phi i8 [ 0, %2 ], [ 0, %8 ], [ 1, %.preheader.lr.ph.i.i.i ], [ 1, %21 ]
  • New:
    %.3.i.i.i = phi i8 [ 0, %2 ], [ 0, %8 ], [ 1, %.preheader.lr.ph.i.i.i ], [ 1, %20 ]

This suggests improved loop structure and edge handling for better register allocation or reduced branching overhead.

Files affected: message.ll, parser_test.ll, eigensparse.ll


3. Improved Loop Exit Conditions

Some loops were transformed so that their exit conditions now rely on simpler comparisons or use icmp eq directly against computed indices instead of comparing derived pointers. This likely improves performance by reducing pointer arithmetic in loop conditions.

Example:

  • Old:
    %.not.i.i.i = icmp eq i64 %.idx, %storemerge.idx.neg
  • New:
    %.not.i.i.i = icmp eq i64 %63, 0

This change simplifies condition checking and may allow better optimization opportunities from the backend.

Files affected: message.ll, sfnt.ll, H5Obtreek.ll


4. Reduction in Memcpy/Memmove Size Computation Complexity

There are multiple cases where the size argument for llvm.memcpy or llvm.memmove was previously calculated using complex chains of sub, add, and gepdiff. These have been replaced with more direct computations.

Example:

  • Old:
    %reass.sub = sub i64 %48, %49
    %gepdiff = add i64 %reass.sub, 409
  • New:
    %gepdiff = sub nsw i64 %.neg4, %19

This leads to clearer code and potentially faster execution due to fewer instructions during copy/move operations.

Files affected: H5Odrvinfo.ll, H5Obtreek.ll, rtpenc_amr.ll


5. More Accurate Null and Error Handling in Conditional Paths

Multiple functions show improvements in null-pointer and error-code propagation, especially around function call failure recovery. For instance:

  • More accurate selection of error codes using phi nodes.
  • Simplified null checks with early exits or thread cleanup.

Example:

%.0 = phi i32 [ -1094995529, %bytestream2_get_le32.exit.thread ], [ -1094995529, %_ZNK5boost17basic_string_viewIcSt11char_traitsIcEE4findES3_m.exit.thread20 ], ...

is streamlined into fewer branches and clearer error path labeling.

This improves robustness and may reduce exception handling overhead.

Files affected: rtpenc_aac.ll, sds.ll, H5E_printf_stack wrappers


Conclusion (High-Level Overview)

The overall trend across these patches is toward:

  • Reducing complexity in pointer calculations,
  • Improving loop termination conditions,
  • Streamlining error propagation and PHIs,
  • Simplifying memory copy logic,
  • Removing unnecessary intermediate steps.

These changes are consistent with optimizations aimed at reducing instruction count and improving runtime efficiency, particularly in tight loops and memory manipulation routines. They also suggest better integration of signed/unsigned comparisons and tighter alignment of dataflow analysis.

model: qwen-plus-latest
CompletionUsage(completion_tokens=1025, prompt_tokens=111638, total_tokens=112663, completion_tokens_details=None, prompt_tokens_details=None)

@@ -2501,7 +2501,9 @@ _ZN2cv3dnn14dnn4_v20241223L5shapeERKNS_3MatE.exit77: ; preds = %113, %.noexc126,
br label %.body75.thread

_ZNSt6vectorIiSaIiEED2Ev.exit: ; preds = %.thread186, %174, %105
%.not5.i = icmp eq i64 %35, 8
%177 = add nsw i64 %35, -8
%178 = getelementptr inbounds i8, ptr %40, i64 %177
Copy link
Owner

Choose a reason for hiding this comment

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

Missing GVN opportunity

@dtcxzyw dtcxzyw closed this Jul 8, 2025
@dtcxzyw dtcxzyw deleted the test-run16114648922 branch July 10, 2025 10:39
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.

3 participants