Skip to content

Conversation

@dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 12, 2025

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

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

dtcxzyw commented Feb 12, 2025

runner: ariselab-64c-v2
baseline: llvm/llvm-project@bf7af2d
patch: llvm/llvm-project#125073
sha256: 9db2a0cad05e8bbdadf24b2662b4fed9a0095b3ba49d9300dc320b31fd5391bd
commit: 17eb1c4

2540 files changed, 17020 insertions(+), 17020 deletions(-)

1 1 bench/abc/optimized/abcFxu.ll
3 3 bench/bdwgc/optimized/gc.ll
2 2 bench/cpp-httplib/optimized/httplib.ll
7 7 bench/eastl/optimized/TestDeque.ll
70 70 bench/fmt/optimized/chrono-test.ll
60 60 bench/glslang/optimized/SpvBuilder.ll
5 5 bench/hwloc/optimized/lstopo-lstopo-cairo.ll
16 16 bench/libevent/optimized/evdns.ll
19 19 bench/libquic/optimized/curve25519.ll
14 14 bench/libwebp/optimized/webp_dec.ll
10 10 bench/luau/optimized/Autocomplete.ll
11 11 bench/luau/optimized/isocline.ll
50 50 bench/miniaudio/optimized/unity.ll
44 44 bench/mold/optimized/passes.cc.ARM32.ll
12 12 bench/mold/optimized/relocatable.cc.ALPHA.ll
13 13 bench/nori/optimized/warptest.ll
56 56 bench/openvdb/optimized/FindActiveValues.ll
6 6 bench/openvdb/optimized/LevelSetMeasure.ll
22 22 bench/openvdb/optimized/MultiResGrid.ll
28 28 bench/openvdb/optimized/RayTracer.ll
40 40 bench/pbrt-v4/optimized/surfscatter.ll
41 41 bench/pugixml/optimized/pugixml.ll
18 18 bench/pybind11/optimized/test_buffers.ll
20 20 bench/pybind11/optimized/test_call_policies.ll
17 17 bench/pybind11/optimized/test_custom_type_casters.ll
23 23 bench/pybind11/optimized/test_pickling.ll
45 45 bench/raylib/optimized/raudio.ll
15 15 bench/raylib/optimized/rcore.ll
9 9 bench/spike/optimized/socketif.ll
218 218 bench/sqlite/optimized/sqlite3.ll
8 8 bench/tinygltf/optimized/tiny_gltf.ll
24 24 bench/yalantinglibs/optimized/conformance.pb.ll
42 42 bench/yalantinglibs/optimized/data_def.pb.ll
81 81 bench/yalantinglibs/optimized/test_messages_proto2.pb.ll
38 38 bench/yalantinglibs/optimized/test_messages_proto3.pb.ll
4 4 bench/zfp/optimized/zfp.ll

@github-actions
Copy link
Contributor

Summary of Changes

This patch primarily focuses on refining the llvm.memset intrinsic calls across multiple LLVM IR files. Below are the key changes observed:

  1. Adjustment of Dereferenceable Bytes in llvm.memset Calls:

    • The dereferenceable attribute in llvm.memset calls has been updated to reflect the exact number of bytes being zeroed out instead of overestimating it. For example, in many instances, the value was changed from dereferenceable(56) to dereferenceable(48), ensuring that the size matches the actual memory being initialized.
    • This adjustment improves precision and potentially enables better optimization by the backend, as it avoids unnecessary assumptions about memory size.
  2. Consistency in Memory Initialization Size:

    • The second argument of llvm.memset (the number of bytes to initialize) now aligns with the dereferenceable attribute. For instance, if the dereferenceable value is set to 36, the size argument is also updated to 36.
    • This ensures that the intrinsic accurately reflects the operation being performed, reducing potential confusion or misinterpretation during further optimizations.
  3. Alignment Attribute Updates:

    • In some cases, the align attribute was adjusted to match the actual alignment of the pointer being passed to llvm.memset. For example, align 1 was replaced with align 8 where appropriate, reflecting stricter alignment requirements.
    • Proper alignment can lead to more efficient memory access patterns and better code generation for platforms that benefit from aligned memory operations.
  4. Reduction in Overhead:

    • By reducing the dereferenceable size and ensuring consistency between the size and alignment attributes, the patch minimizes unnecessary work done by the llvm.memset intrinsic. This can result in smaller binary sizes and faster execution for certain memory initialization operations.
  5. Improved Metadata Annotations:

    • Some llvm.memset calls include metadata annotations such as !alias.scope or !noalias. These annotations were updated to reflect the correct dereferenceable size, ensuring that alias analysis remains accurate.
    • Accurate aliasing information helps LLVM's optimizer make better decisions about memory accesses, leading to improved performance and correctness.

High-Level Overview

The patch addresses a common issue in LLVM IR where llvm.memset intrinsics may specify an overly large dereferenceable size, which does not match the actual memory being initialized. By tightening these values, the patch enhances the accuracy of the IR, enabling better optimization opportunities for the backend. Additionally, alignment attributes were corrected to ensure they align with the actual pointer alignment, improving memory access efficiency.

These changes are pervasive across multiple benchmarks and functions, affecting libraries such as abc, bdwgc, cpp-httplib, eastl, fmt, glslang, hwloc, libevent, libquic, miniaudio, mold, nori, and openvdb. While the individual impact of each change might be small, collectively, they contribute to cleaner IR, reduced memory initialization overhead, and potentially better performance for memory-intensive operations.

The patch does not introduce new functionality or alter the logic of existing code but rather refines the representation of memory initialization operations in the IR. This kind of refinement is crucial for maintaining high-quality IR and ensuring that LLVM's optimizers have the most precise information possible.

model: qwen-plus-latest
CompletionUsage(completion_tokens=721, prompt_tokens=103107, total_tokens=103828, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this Feb 12, 2025
@dtcxzyw dtcxzyw deleted the test-run13285182380 branch February 24, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant