Skip to content

Conversation

@zyw-bot
Copy link
Collaborator

@zyw-bot zyw-bot commented Dec 3, 2025

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

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

zyw-bot commented Dec 3, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@00c8e61
patch: llvm/llvm-project#170474
sha256: e1e63bcd3a22680ec5e583dc5a2234f6b77d8c5b28444809d0841633c127399e
commit: cf96440

3 files changed, 144 insertions(+), 164 deletions(-)

Improvements:
  indvars.NumReplaced 69106 -> 69110 +0.01%
  scalar-evolution.NumExitCountsComputed 4044447 -> 4044451 +0.00%
  lcssa.NumLCSSA 15128894 -> 15128902 +0.00%
  gvn.NumGVNSimpl 4415377 -> 4415379 +0.00%
  memdep.NumCacheCompleteNonLocalPtr 5348618 -> 5348620 +0.00%
  scalar-evolution.NumExitCountsNotComputed 11931820 -> 11931824 +0.00%
  memdep.NumCacheNonLocalPtr 266903707 -> 266903739 +0.00%
Regressions:
  licm.NumSunk 268195 -> 268187 -0.00%
  local.NumPHICSEs 186115 -> 186111 -0.00%
  gvn.NumGVNEqProp 427034 -> 427030 -0.00%
  simplifycfg.NumHoistCommonInstrs 2431944 -> 2431936 -0.00%
  instsimplify.NumSimplified 2467336 -> 2467332 -0.00%
  early-cse.NumCSE 5560451 -> 5560447 -0.00%
  instcombine.NumSunkInst 3381567 -> 3381565 -0.00%
  instcombine.NumCombined 120701405 -> 120701377 -0.00%

-10 pola-rs/3j0wo23154dycf1fpnzd17ptx.ll

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

This LLVM IR diff reflects optimizations targeting loop trip count computation and control flow simplification in the polars_arrow::array::Array::null_count function (and related code). Here are the 5 major changes:

  1. Elimination of redundant and i64 %x, 4294967295 masking:
    Three instances of %wide.trip.count*.i.* = and i64 %val, 4294967295 (which masks the lower 32 bits) were removed — at lines 41906, 42085, 42892, and 43058. This indicates the trip count is already known to fit in 32 bits, making the mask unnecessary.

  2. Replacement of 64-bit loop exit comparisons with 32-bit equivalents:
    Loop exit conditions (%exitcond*.not.*) were changed from icmp eq i64 %indvars.iv.next*, %wide.trip.count* to icmp eq i32 %trip_limit, %trunc_next, where %trip_limit (e.g., %152, %218, %526, %578) is a pre-existing 32-bit value. This avoids 64-bit arithmetic and enables better optimization (e.g., induction variable elimination, smaller registers).

  3. Simplification of loop phi nodes and critical edge handling:
    Several phi nodes in loop exit blocks (e.g., %195, %.lcssa.i.us.pre-phi.i, %.sroa.0.3.lcssa.i) were updated to directly use truncated loop counters (%181, %557, %623) instead of redundant truncations computed in separate basic blocks (e.g., %199, %565). This removes dead code and merges control flow.

  4. Removal of dead basic blocks and redundant truncations:
    Blocks like .lr.ph.split.us.i.._crit_edge.loopexit.split.loop.exit35.i.loopexit_crit_edge.us.i and its trunc instruction %565 = trunc ... were deleted, as their logic was folded into predecessor blocks. Similarly, %262 = trunc ... was hoisted and reused, eliminating duplication.

  5. Control flow cleanup in loop exit branches:
    A branch target was updated from %default.unreachable269%default.unreachable277, and another branch was redirected from %.lr.ph.split.us.i.._crit_edge... to %._crit_edge... (line 42920), reflecting refined loop exit structure after merging paths. Also, an invoke continuation label was renamed from .cont292.cont302, suggesting minor CFG restructuring (likely due to inlining or exception-handling optimization).

Overall, these changes reflect aggressive loop canonicalization, induction variable narrowing, and dead code elimination, likely driven by Loop Vectorize or Loop Simplify passes — improving both code size and potential vectorization readiness.

model: qwen-plus-latest
CompletionUsage(completion_tokens=668, prompt_tokens=4941, total_tokens=5609, completion_tokens_details=None, prompt_tokens_details=None)

@nikic
Copy link

nikic commented Dec 3, 2025

/close

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants