Skip to content

pre-commit: PR147065 #2537

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: PR147065 #2537

wants to merge 3 commits into from

Conversation

zyw-bot
Copy link
Collaborator

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

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

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

zyw-bot commented Jul 4, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@45909ec
patch: llvm/llvm-project#147065
sha256: 6c2d90bb176038c7addf63ca9fc814240f843aa0b510377fb26f6989cf41d977
commit: a3198d1

50 files changed, 80970 insertions(+), 80941 deletions(-)

Improvements:
  sccp.NumDeadBlocks 755759 -> 755798 +0.01%
  correlated-value-propagation.NumCmps 300645 -> 300651 +0.00%
  sccp.NumInstRemoved 2109423 -> 2109462 +0.00%
  simple-loop-unswitch.NumBranches 108875 -> 108876 +0.00%
  dse.NumFastOther 517687 -> 517689 +0.00%
  indvars.NumLFTR 337216 -> 337217 +0.00%
  scalar-evolution.NumExitCountsNotComputed 12660819 -> 12660848 +0.00%
  memdep.NumCacheCompleteNonLocalPtr 5689326 -> 5689339 +0.00%
  loop-vectorize.LoopsAnalyzed 2062991 -> 2062993 +0.00%
  memdep.NumUncacheNonLocalPtr 269977211 -> 269977383 +0.00%
Regressions:
  instcombine.NegatorMaxDepthVisited 20740 -> 20701 -0.19%
  reassociate.NumAnnihil 835 -> 834 -0.12%
  basicaa.SearchLimitReached 5088 -> 5083 -0.10%
  licm.NumAddSubHoisted 1337 -> 1336 -0.07%
  instcombine.NegatorMaxTotalValuesVisited 64790 -> 64743 -0.07%
  instcombine.NumFactor 46917 -> 46897 -0.04%
  instcombine.NegatorMaxInstructionsCreated 17169 -> 17163 -0.03%
  instcombine.NegatorNumInstructionsCreatedTotal 69400 -> 69376 -0.03%
  instcombine.NegatorNumInstructionsNegatedSuccess 64334 -> 64320 -0.02%
  instcombine.NegatorNumTreesNegated 52529 -> 52519 -0.02%

129 111 bench/clamav/optimized/spin.ll
31 33 bench/clamav/optimized/upx.ll
14 12 bench/cmake/optimized/huf_compress.ll
22 22 bench/cmake/optimized/zstd_decompress.ll
123 127 bench/darktable/optimized/export.ll
4 4 bench/darktable/optimized/print_settings.ll
34 32 bench/duckdb/optimized/huf_compress.ll
154 149 bench/ffmpeg/optimized/flac_picture.ll
61 64 bench/freetype/optimized/type1.ll
30 34 bench/git/optimized/apply.ll
10 9 bench/git/optimized/fast-import.ll
51 41 bench/git/optimized/packfile.ll
27 39 bench/hyperscan/optimized/runtime.ll
8 8 bench/libquic/optimized/s3_srvr.ll
65 65 bench/lief/optimized/ecjpake.ll
4 5 bench/lief/optimized/rsa.ll
107 111 bench/lief/optimized/ssl_tls.ll
10 9 bench/lief/optimized/ssl_tls13_client.ll
75 75 bench/lief/optimized/ssl_tls13_server.ll
62 61 bench/linux/optimized/decompress_unlzo.ll
53 53 bench/linux/optimized/nf_nat_helper.ll
37 37 bench/linux/optimized/zstd_decompress.ll
7 9 bench/llvm/optimized/PPCaching.ll
75 72 bench/oiio/optimized/deepdata.ll
109 108 bench/openssl/optimized/cipher_aes_cbc_hmac_sha1_hw.ll
106 105 bench/openssl/optimized/cipher_aes_cbc_hmac_sha256_hw.ll
108 107 bench/openssl/optimized/e_aes_cbc_hmac_sha1.ll
42 44 bench/openusd/optimized/zipFile.ll
4 4 bench/redis/optimized/listpack.ll
25 25 bench/zstd/optimized/zstd_v07.ll

Copy link
Contributor

github-actions bot commented Jul 4, 2025

Here's a high-level summary of up to 5 major changes in the provided LLVM IR diff:

  1. Introduction of freeze instruction for pointer %126
    A new freeze instruction is used on pointer %126, storing the result into %.fr804. This indicates that undefined behavior (e.g., null or invalid pointer) from %126 is being explicitly addressed, and subsequent GEPs now use this frozen value to avoid undefined behavior in pointer calculations.

  2. Improved Pointer Comparison Using icmp ult ptr Instead of Arithmetic Checks
    In several places (e.g., blocks %132, %175, and others), complex arithmetic-based comparisons like:

    %133 = sub nsw i64 %132, %124
    %.not650 = icmp slt i64 %133, -12807

    are replaced with simpler and more idiomatic pointer comparisons:

    %.not650 = icmp ult ptr %130, %0

    This improves code clarity and ensures safer, more portable bounds checking by using actual pointer relationships rather than offset arithmetic.

  3. Rewriting PHI Nodes in Critical Paths
    Multiple PHI nodes in critical control flow paths (e.g., .preheader736, .preheader735, and .lr.ph) have been restructured or updated to reflect changes in predecessor blocks. For example:

    %.2582758 = phi i32 [ %183, %.lr.ph770.split ], [ %174, %._crit_edge790.loopexit ]

    These updates indicate restructuring of loops and conditional branches to improve SSA form and correctness after other control flow optimizations.

  4. Simplification of Loop Exit and Merge Logic
    Several loop exit blocks (e.g., .loopexit, .lr.ph770.split, etc.) have been adjusted or merged. The logic around exiting loops and merging values has been simplified with fewer intermediate variables and cleaner branching conditions, often replacing multiple phi entries with more canonicalized ones.

  5. Pointer Arithmetic Replaced With ptrtoint and Proper Offset Handling
    Some instances where pointer arithmetic was previously done directly (e.g., comparing pointer offsets using getelementptr and integer subtraction) have been rewritten to first convert pointers to integers (ptrtoint) before performing arithmetic. For example:

    %134 = add i64 %133, 4
    %135 = add i64 %134, %131

    becomes:

    %133 = ptrtoint ptr %130 to i64
    %134 = add i64 %133, 4

    This change aligns with stricter LLVM pointer aliasing and optimization rules, ensuring correct handling of pointer differences.


Summary:
The patch introduces better-defined pointer handling via freeze and ptrtoint, replaces arithmetic-based bounds checks with pointer comparisons (icmp ult ptr), simplifies PHI node usage after control flow changes, and canonicalizes loop exits. These changes likely improve safety, optimize memory access reasoning, and make the code more robust under aggressive LLVM transformations.

model: qwen-plus-latest
CompletionUsage(completion_tokens=727, prompt_tokens=116710, total_tokens=117437, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this Jul 4, 2025
@dtcxzyw dtcxzyw deleted the test-run16075961743 branch July 10, 2025 10:40
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.

3 participants