Skip to content

pre-commit: PR128111 #2150

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: PR128111 #2150

wants to merge 3 commits into from

Conversation

dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 21, 2025

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

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

dtcxzyw commented Feb 21, 2025

runner: buildkitsandbox
baseline: llvm/llvm-project@776cdda
patch: llvm/llvm-project#128111
sha256: e6e9eacdb2c74db4b0f1ec374b1a7b537ad904532e4fac69c564a1a8c5f5e1d0
commit: 66efe7a

1597 files changed, 1572960 insertions(+), 1593671 deletions(-)

Improvements:
  memdep.NumCacheDirtyNonLocal 295 -> 298 +1.02%
  instcombine.NumExpand 1850 -> 1852 +0.11%
  memdep.NumUncacheNonLocal 23605 -> 23621 +0.07%
  simplifycfg.NumHoistCommonCode 614165 -> 614567 +0.07%
  gvn.NumGVNLoad 1191000 -> 1191774 +0.06%
  simplifycfg.NumHoistCommonInstrs 1807367 -> 1808135 +0.04%
  memdep.NumCacheNonLocal 18525 -> 18532 +0.04%
  simplifycfg.NumSpeculations 353319 -> 353429 +0.03%
  local.NumPHICSEs 157259 -> 157306 +0.03%
  licm.NumSunk 265258 -> 265337 +0.03%
Regressions:
  correlated-value-propagation.NumSelects 219527 -> 214436 -2.32%
  sroa.NumLoadsPredicated 14737 -> 14493 -1.66%
  instcombine.NumSel 25680 -> 25342 -1.32%
  simple-loop-unswitch.NumSelects 2018 -> 2014 -0.20%
  adce.NumRemoved 91681 -> 91503 -0.19%
  loop-instsimplify.NumSimplified 172005 -> 171679 -0.19%
  loop-simplify.NumNested 10278 -> 10266 -0.12%
  sroa.NumLoadsSpeculated 314180 -> 313936 -0.08%
  sccp.NumDeadBlocks 720986 -> 720478 -0.07%
  correlated-value-propagation.NumPhis 1069043 -> 1068550 -0.05%

1 1 bench/abc/optimized/bmcBmc3.ll
3 3 bench/abseil-cpp/optimized/cord.ll
2 3 bench/actix-rs/optimized/14bh10sj718x2c7a.ll
1 2 bench/actix-rs/optimized/3tnlvci61w0nl5yv.ll
1 2 bench/actix-rs/optimized/5dylu5g0crehei80.ll
2 4 bench/actix-rs/optimized/7zeo7o16a1wcxcn.ll
13 12 bench/actix-rs/optimized/n3tsoobypc9yljt.ll
2 2 bench/assimp/optimized/X3DImporter.ll
5 5 bench/assimp/optimized/glTF2Importer.ll
7 16 bench/boost/optimized/absolute_uri_rule.ll
7 10 bench/boost/optimized/host_rule.ll
7 7 bench/c3c/optimized/sema_expr.ll
9 12 bench/casadi/optimized/serializer.ll
10 14 bench/casadi/optimized/sx_instantiator.ll
4 3 bench/cmake/optimized/huf_compress.ll
6 10 bench/coreutils-rs/optimized/1e5pt7vtfxa4ahz7.ll
21 22 bench/coreutils-rs/optimized/2i3dvgzkmy2gn6v1.ll
1 2 bench/coreutils-rs/optimized/l1lqbqyvia1m667.ll
13 14 bench/delta-rs/optimized/11f8x98axanecwnw.ll
7 8 bench/delta-rs/optimized/43y2svfstmvqcl15.ll
10 13 bench/diesel-rs/optimized/6cb7zukciz78xvw.ll
5 4 bench/duckdb/optimized/huf_compress.ll
4 4 bench/eastl/optimized/TestVariant.ll
6 8 bench/folly/optimized/SimpleLoopController.ll
5 13 bench/grpc/optimized/rbac_filter.ll
21 25 bench/grpc/optimized/xds_lb_policy_registry.ll
4 5 bench/grpc/optimized/xds_server_config_fetcher.ll
11 7 bench/hermes/optimized/Callable.ll
4 2 bench/hermes/optimized/HermesInternal.ll
7 9 bench/hermes/optimized/Inlining.ll
18 36 bench/hermes/optimized/JSONParser.ll
16 8 bench/hermes/optimized/Operations.ll
5 11 bench/hermes/optimized/PassManager.ll
2 3 bench/hermes/optimized/RegAlloc.ll
10 12 bench/icu/optimized/locid.ll
4 7 bench/icu/optimized/normalizer2impl.ll
12 13 bench/icu/optimized/tznames_impl.ll
9 15 bench/image-rs/optimized/4srzh4wujeew249y.ll
80 70 bench/libevent/optimized/bufferevent.ll
10 14 bench/libquic/optimized/process_metrics_linux.ll
14 16 bench/linux/optimized/keyctl.ll
32 31 bench/linux/optimized/swnode.ll
7 10 bench/logos-rs/optimized/l82l31q4dxfnso7.ll
23 27 bench/luau/optimized/TypePath.ll
14 37 bench/luau/optimized/Unifier2.ll
8 10 bench/memcached/optimized/testapp.ll
20 24 bench/meshlab/optimized/edit_paint.ll
1 3 bench/meshlab/optimized/filter_dock_dialog.ll
7 9 bench/minetest/optimized/nodedef.ll
35 36 bench/mitsuba3/optimized/appender.ll
4 7 bench/node/optimized/libnode.NodeTracing.ll
24 36 bench/node/optimized/libnode.NodeWorker.ll
16 19 bench/node/optimized/libnode.node_file.ll
11 15 bench/node/optimized/libnode.node_http2.ll
4 5 bench/ockam-rs/optimized/3spcfx0kj7tua4em.ll
1 2 bench/ockam-rs/optimized/lcclztcuaxx9mqt.ll
5 21 bench/oiio/optimized/imagebuf.ll
17 20 bench/openjdk/optimized/barrierSetC2.ll
2 6 bench/openjdk/optimized/loopTransform.ll
6 6 bench/pbrt-v4/optimized/integrators.ll
1 4 bench/pbrt-v4/optimized/subsurface.ll
15 11 bench/php/optimized/zend_file_cache.ll
9 7 bench/postgres/optimized/freepage.ll
2 4 bench/protobuf/optimized/command_line_interface.ll
10 14 bench/protobuf/optimized/descriptor.ll
10 16 bench/qemu/optimized/execlog.ll
19 8 bench/quantlib/optimized/ecb.ll
4 4 bench/quickjs/optimized/quickjs.ll
3 2 bench/redis/optimized/redis-benchmark.ll
3 5 bench/regex-rs/optimized/6c2onrqlphpgxx0.ll
12 17 bench/ring-rs/optimized/4gu90fp46fobkewp.ll
5 7 bench/rust-analyzer-rs/optimized/1rhf3pjhhflazor1.ll
4 6 bench/rust-analyzer-rs/optimized/1x49zfabvca0zorz.ll
6 12 bench/rust-analyzer-rs/optimized/wcknfmhk1hydgx3.ll
3 4 bench/rustfmt-rs/optimized/1mznjg1e09hdetpr.ll
3 4 bench/rustfmt-rs/optimized/3sx1t619hmuq0zz7.ll
11 11 bench/taskflow/optimized/async.ll
2 4 bench/tokenizers-rs/optimized/1k9vblvd5jyd3qmf.ll
13 14 bench/tree-sitter-rs/optimized/1cv8rmziqotlzxv3.ll
3 5 bench/typst-rs/optimized/2i78fvbm4wocuesi.ll
5 9 bench/typst-rs/optimized/49m3cs7hus53ztof.ll
11 14 bench/vcpkg/optimized/cgroup-parser.ll
1 6 bench/vcpkg/optimized/vcpkgpaths.ll
9 14 bench/verilator/optimized/V3Split.ll
6 22 bench/wasmedge/optimized/executor.ll
10 14 bench/wasmedge/optimized/serial_type.ll
31 39 bench/wasmtime-rs/optimized/4oustitdsdvnhdau.ll
23 7 bench/wasmtime-rs/optimized/xl3b912aq97wiv3.ll
6 10 bench/wireshark/optimized/packet-dof.ll
8 20 bench/z3/optimized/api_params.ll
28 41 bench/z3/optimized/dl_sieve_relation.ll
3 6 bench/z3/optimized/smt_context.ll

Copy link
Contributor

Summary of Major Changes in the LLVM IR Diff

  1. Elimination of Select Instructions for Null Checks:

    • In multiple files, select instructions used to handle null checks have been removed or simplified. For example, in cord.ll, host_rule.ll, and sema_expr.ll, instead of using a select instruction to choose between a pointer and null, the code now directly uses the non-null pointer when applicable. This reduces unnecessary branching and simplifies the control flow.
  2. Optimization of Pointer Arithmetic and Dereferencing:

    • Files like huf_compress.ll and Callable.ll show changes where pointer arithmetic and dereferencing have been optimized. Instead of loading a pointer and then performing operations on it, the code directly uses offsets or loads values from specific addresses. This can lead to more efficient memory access patterns and potentially better cache utilization.
  3. Removal of Redundant Lifetime Management Calls:

    • In testapp.ll, redundant calls to llvm.lifetime.start.p0 and llvm.lifetime.end.p0 have been removed. These calls are used to manage the lifetime of variables, but their removal suggests that the optimizer has determined they are unnecessary, which can reduce overhead and improve performance.
  4. Streamlining of PHI Nodes:

    • Several files, including l82l31q4dxfnso7.ll and Unifier2.ll, demonstrate simplifications in the use of PHI nodes. By reducing the number of PHI nodes or consolidating them, the code becomes more straightforward and easier for further optimizations by the backend.
  5. Improvement in Function Argument Passing:

    • In NodeTracing.ll and NodeWorker.ll, there are improvements in how function arguments are passed. Specifically, instead of passing a selected pointer (potentially null) to functions, the code now passes the original non-null pointer directly. This avoids unnecessary indirection and ensures that functions receive valid pointers, improving safety and efficiency.

High-Level Overview

The patch primarily focuses on simplifying control flow, optimizing memory access patterns, and reducing unnecessary instructions in the LLVM Intermediate Representation (IR). Key areas of improvement include:

  • Control Flow Simplification: Many instances of select instructions used for conditional pointer handling have been eliminated, leading to cleaner and more direct code paths.
  • Memory Access Optimization: Pointer arithmetic and dereferencing have been streamlined, with direct accesses to specific memory locations replacing intermediate steps.
  • Lifetime Management: Unnecessary lifetime management calls have been removed, reducing overhead and allowing the compiler to generate more efficient machine code.
  • Function Argument Handling: The way arguments are passed to functions has been improved, ensuring that only valid pointers are used and avoiding unnecessary checks or selections.

These changes collectively contribute to a more efficient and maintainable LLVM IR, which can result in better performance and smaller binary sizes after compilation. The optimizations appear to be focused on removing redundancy and simplifying the logic, making the generated code easier for the backend to optimize further.

model: qwen-plus-latest
CompletionUsage(completion_tokens=630, prompt_tokens=101698, total_tokens=102328, completion_tokens_details=None, prompt_tokens_details=None)

@@ -430,10 +430,11 @@ define dso_local range(i64 -66, 13) i64 @HUF_buildCTable_wksp(ptr noundef captur

18: ; preds = %16
%19 = icmp eq i32 %3, 0
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(4096) %13, i8 0, i64 4096, i1 false)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Regression

%conv.i.i.i.i.i.i.i = zext i32 %agg.tmp.sroa.0.0.copyload.i.i.i.i to i64
%add.i.i.i.i.i.i.i = add i64 %conv.i.i.i.i.i.i.i, %18
%19 = inttoptr i64 %add.i.i.i.i.i.i.i to ptr
%cond.i.i.i.i.i.i = select i1 %cmp.i.not.i.i.i.i.i.i, ptr null, ptr %19
Copy link
Owner Author

Choose a reason for hiding this comment

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

Regression

@@ -777,7 +777,9 @@ _ZN4core3ops8function5FnMut8call_mut17h33940878987a20c1E.exit55.i.i: ; preds = %
; Function Attrs: inlinehint nonlazybind uwtable
define internal void @"_ZN114_$LT$core..iter..adapters..flatten..FlatMap$LT$I$C$U$C$F$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$4next17hf0b4bd35edd4f090E"(ptr noalias noundef writeonly sret({ i64, [3 x i64] }) align 8 captures(none) dereferenceable(32) %0, ptr noalias noundef align 8 captures(none) dereferenceable(88) %1) unnamed_addr #3 personality ptr @rust_eh_personality {
%3 = alloca { i64, [2 x i64] }, align 8
%.sroa.5.i4.i = alloca [3 x i64], align 8
Copy link
Owner Author

Choose a reason for hiding this comment

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

Regression.

@@ -3642,13 +3642,15 @@ define internal void @zend_file_cache_serialize_class(ptr noundef captures(none)
br i1 %.not11101272, label %.loopexit1258, label %.lr.ph1275

.lr.ph1275: ; preds = %628
%.not1109 = icmp eq ptr %612, %615
%spec.select1251 = select i1 %.not1109, ptr null, ptr %634
Copy link
Owner Author

Choose a reason for hiding this comment

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

Regression.

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.

1 participant