Skip to content

Conversation

@zyw-bot
Copy link
Collaborator

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

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

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

zyw-bot commented Jul 6, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@db4e927
patch: llvm/llvm-project#147180
sha256: ff2bc55c4a7bb17df56acb501e5f664f9c6725e197bbca3b4675b31306f88093
commit: 83544bc

819 files changed, 3051 insertions(+), 3051 deletions(-)

Improvements:
Regressions:
  instcombine.NumCombined 130200074 -> 130185765 -0.01%

1 1 bench/abc/optimized/abcNpn.ll
2 2 bench/actix-rs/optimized/19s5ghr2x6s6bmh4.ll
3 3 bench/bullet3/optimized/btSoftBody.ll
8 8 bench/git/optimized/gc.ll
5 5 bench/glslang/optimized/hlslParseHelper.ll
13 13 bench/grpc/optimized/promise_based_filter.ll
28 28 bench/hermes/optimized/Triple.ll
25 25 bench/image-rs/optimized/2ndzmzcdt55acj4k.ll
61 61 bench/llvm/optimized/AArch64ISelLowering.ll
202 202 bench/llvm/optimized/AttrImpl.ll
38 38 bench/llvm/optimized/Consumed.ll
11 11 bench/llvm/optimized/DeclSpec.ll
43 43 bench/llvm/optimized/LegalizerHelper.ll
20 20 bench/llvm/optimized/OpenMPKinds.ll
82 82 bench/llvm/optimized/SymbolGraphSerializer.ll
32 32 bench/llvm/optimized/Triple.ll
108 108 bench/llvm/optimized/TypeLoc.ll
31 31 bench/llvm/optimized/X86ISelLowering.ll
4 4 bench/miniaudio/optimized/unity.ll
15 15 bench/node/optimized/libnode.cares_wrap.ll
10 10 bench/openusd/optimized/listOp.ll
12 12 bench/php/optimized/simplexml.ll
22 22 bench/postgres/optimized/postmaster.ll
7 7 bench/pugixml/optimized/pugixml.ll
6 6 bench/ruby/optimized/prism.ll
9 9 bench/tls-rs/optimized/59h61akxu6z29dlt.ll
29 29 bench/typst-rs/optimized/1ru1rhojhbz2vfey.ll
26 26 bench/typst-rs/optimized/3rk2ctuzbghb17s4.ll
16 16 bench/typst-rs/optimized/49m3cs7hus53ztof.ll
17 17 bench/typst-rs/optimized/4qskctz4kwc33g7b.ll
14 14 bench/typst-rs/optimized/59tuvc5m3xlovl3o.ll
30 30 bench/typst-rs/optimized/d6l9ieo9tcw33dn.ll
87 87 bench/wasmtime-rs/optimized/2ly4gzztxx8hlwxv.ll
40 40 bench/wasmtime-rs/optimized/3r0osxvwe4cd326n.ll

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2025

The patch applies the nneg (non-negative) attribute to multiple zext (zero extend) operations in LLVM IR code. Here's a high-level summary of the changes:

  1. Addition of nneg Attribute to Zero-Extend Operations:
    The main change is adding the nneg flag to zext instructions across various functions. This indicates that the input value to be zero-extended is known to be non-negative, allowing the optimizer to avoid checks or transformations related to negative values.

  2. Targeted Value Types:

    • Most of the modified zext operations convert i8 or i16 to i64, often after an add nsw operation subtracts 1 or another small constant from the original index.
    • These conversions typically occur as part of switch table indexing logic where bounds are expected to be controlled by earlier checks.
  3. Context: Switch Table Indexing:

    • Many of the zext instructions appear when calculating indices into switch tables, which are used for efficient dispatch based on enum-like values.
    • By marking these indices as nneg, the compiler confirms they cannot be negative, reinforcing safety and potentially improving generated code efficiency.
  4. Performance Optimization:

    • These changes enable better optimization opportunities by giving the backend more precise information about value ranges.
    • Specifically, it allows removal of redundant range checks and enables use of more optimal instruction sequences for indexing.
  5. Wide Scope Across Benchmarks:

    • The modification appears in multiple benchmarks including:
      • abcNpn, btSoftBody, git, image-rs, glslang
      • LLVM's AArch64ISelLowering, AttrImpl, Consumed, DeclSpec
    • These files represent a diverse set of applications and libraries, indicating this is a general optimization pattern being applied systematically.

In summary:
This patch improves code generation and analysis by annotating zext instructions with nneg, reflecting that their inputs are guaranteed non-negative—especially useful when computing indices into switch tables. It enhances optimization potential without altering functionality.

model: qwen-plus-latest
CompletionUsage(completion_tokens=456, prompt_tokens=103363, total_tokens=103819, completion_tokens_details=None, prompt_tokens_details=None)

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

2 participants