Skip to content

Conversation

@zyw-bot
Copy link
Collaborator

@zyw-bot zyw-bot commented Jun 20, 2025

Link: llvm/llvm-project#125828
Requested by: @artagnon

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

zyw-bot commented Jun 20, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@5835f1e
patch: llvm/llvm-project#125828
sha256: 33d991d3513ea09692d5438c283ad3544574a07b47d2547274f19294db322c95
commit: 5a69592

141 files changed, 70102 insertions(+), 70633 deletions(-)

Improvements:
  licm.NumMinMaxHoisted 778 -> 783 +0.64%
  bdce.NumSExt2ZExt 5466 -> 5468 +0.04%
  dse.NumCFGChecks 651904 -> 652120 +0.03%
  licm.NumBOAssociationsHoisted 7182 -> 7184 +0.03%
  memory-builtins.ObjectVisitorLoad 2476759 -> 2477099 +0.01%
  licm.NumLoadStorePromoted 74279 -> 74288 +0.01%
  dse.NumCFGTries 58313 -> 58319 +0.01%
  indvars.NumElimCmp 57988 -> 57993 +0.01%
  adce.NumBranchesRemoved 24156 -> 24158 +0.01%
  correlated-value-propagation.NumAnd 48454 -> 48458 +0.01%
Regressions:
  loop-rotate.NumInstrsHoisted 1242 -> 1241 -0.08%
  indvars.NumLFTR 337255 -> 337070 -0.05%
  indvars.NumReplaced 72745 -> 72712 -0.05%
  simple-loop-unswitch.NumCostMultiplierSkipped 17325 -> 17320 -0.03%
  correlated-value-propagation.NumNNeg 105567 -> 105537 -0.03%
  loop-simplifycfg.NumLoopBlocksDeleted 7062 -> 7060 -0.03%
  loop-instsimplify.NumSimplified 196750 -> 196705 -0.02%
  correlated-value-propagation.NumSMinMax 9242 -> 9240 -0.02%
  loop-simplifycfg.NumTerminatorsFolded 10643 -> 10641 -0.02%
  gvn.NumGVNEqProp 456567 -> 456487 -0.02%

9 13 bench/abc/optimized/bmcFx.ll
41 47 bench/abc/optimized/wlcAbc.ll
4 6 bench/abc/optimized/wlnWlc.ll
6 8 bench/arrow/optimized/UriParse.ll
8 10 bench/boost/optimized/args_cmd.ll
21 25 bench/bullet3/optimized/btSoftBodyHelpers.ll
67 62 bench/cmake/optimized/cmHexFileConverter.ll
8 11 bench/cvc5/optimized/bags_utils.ll
70 71 bench/eastl/optimized/EAMemory.ll
30 33 bench/ffmpeg/optimized/aacdec.ll
21 20 bench/ffmpeg/optimized/exr.ll
15 16 bench/ffmpeg/optimized/hls_sample_encryption.ll
21 20 bench/ffmpeg/optimized/iamf_writer.ll
27 32 bench/ffmpeg/optimized/matroskadec.ll
24 30 bench/folly/optimized/JSONSchema.ll
35 49 bench/graphviz/optimized/excontext.ll
54 54 bench/graphviz/optimized/gvplugin_vt.ll
54 58 bench/hermes/optimized/hbc-attribute.ll
2 2 bench/icu/optimized/msgfmt.ll
9 14 bench/libcxx/optimized/locale.ll
45 53 bench/libevent/optimized/http.ll
52 58 bench/linux/optimized/indirect.ll
18 29 bench/llvm/optimized/SemaConcept.ll
24 25 bench/llvm/optimized/SemaTemplate.ll
43 47 bench/meshoptimizer/optimized/vertexcodec.ll
4 17 bench/node/optimized/libnode.Protocol.ll
46 48 bench/oiio/optimized/strutil.ll
17 20 bench/opencv/optimized/qrcode_encoder.ll
24 38 bench/openexr/optimized/internal_rle.ll
32 35 bench/openjdk/optimized/mlib_c_ImageCopy.ll
2 4 bench/openjdk/optimized/sharedRuntimeTrig.ll
24 38 bench/openusd/optimized/openexr-c.ll
6 4 bench/php/optimized/ir_ra.ll
74 80 bench/pola-rs/optimized/eo2lit9v8mg9048herjayt2j2.ll
46 52 bench/protobuf/optimized/padding_optimizer.ll
59 66 bench/qemu/optimized/qemu-io-cmds.ll
13 14 bench/qemu/optimized/sdhci-cmd.ll
24 32 bench/quantlib/optimized/date.ll
8 10 bench/recastnavigation/optimized/RecastMeshDetail.ll
8 13 bench/ruby/optimized/prism.ll
30 35 bench/sdl/optimized/SDL_guid.ll
43 45 bench/sqlite/optimized/sqlite3.ll
4 4 bench/sundials/optimized/sundials_hashmap.ll
9 6 bench/tls-rs/optimized/2xhpv4vf07do7r8g.ll
14 16 bench/wireshark/optimized/packet-ieee80211.ll
45 51 bench/wireshark/optimized/packet-mbim.ll
78 86 bench/wireshark/optimized/packet-netlink-sock_diag.ll
12 14 bench/wireshark/optimized/packet-sctp.ll
30 35 bench/wireshark/optimized/packet-ssh.ll
15 21 bench/wireshark/optimized/packet-tls-utils.ll
8 10 bench/wolfssl/optimized/chacha.ll

@github-actions
Copy link
Contributor

Here is a summary of the most significant changes in the provided LLVM IR diffs, focusing on up to 5 major transformations and ignoring non-interesting changes such as formatting, comments, and reordering:


1. Loop Condition Refinement Using icmp samesign

In several functions (e.g., bmcFx.ll, Wlc_NtkPrintInputInfo.ll, exr.ll, hls_sample_encryption.ll, matroskadec.ll, etc.), loop exit conditions have been refined using icmp samesign ult or icmp samesign uge instead of comparing against a computed trip count. This suggests a transformation that avoids explicit computation of trip counts by checking whether the induction variable has reached a certain bound under the same sign assumptions.

  • Example:
    %exitcond.not = icmp samesign ult i64 %indvars.iv.next.i.i.us, %wide.trip.count.i.i.us
    br i1 %exitcond.not, label %59, label %_ZL23ConvertMotorolaSrecLinePKcP8_IO_FILE.exit.us, !llvm.loop !12
    becomes:
    %exitcond.not = icmp eq i64 %indvars.iv.next31.i.i.us, %wide.trip.count.i.i.us)

High-level impact: Improves loop control logic by eliminating unnecessary trip count calculations and relying on bounds checks, potentially enabling better optimization opportunities and reducing code size.


2. Removal of Redundant llvm.umin Intrinsic Usage

Multiple instances of @llvm.umin.i32 and @llvm.umin.i64 are removed and replaced with more direct uses of zext/trunc combinations or simpler arithmetic. For example, in wlcAbc.ll and SemaTemplate.ll, explicit minimum value computations between two values are replaced with pointer difference or other comparisons.

  • Example:

    %umin.i = tail call i32 @llvm.umin.i32(i32 %217, i32 %218)

    becomes:

    %217 = zext i32 %2 to i64
    %218 = zext nneg i32 %.val37.i to i64

High-level impact: Eliminates calls to intrinsic min functions where they can be expressed via truncation or zero extension, improving performance and reducing reliance on helper intrinsics.


3. Simplified PHI Nodes in Loops

Several loops had their PHI nodes simplified by removing redundant incoming edges or restructuring them to match updated control flow. For instance, in args_cmd.ll, Wlc_NtkGetInv.ll, and SemaConcept.ll, PHI instructions were adjusted after control flow changes or loop exits.

  • Example:

    %.01230.i.i.i = phi i64 [ %.01230.i.i.i.add, %35 ], [ 0, %.lr.ph.preheader.i.i.i ]

    becomes:

    %.01230.i.i.i = phi i64 [ %.01230.i.i.i.add, %34 ], [ 0, %.lr.ph.preheader.i.i.i ]

High-level impact: Reflects structural simplifications in loop predecessors, often resulting from merging blocks or changing branch targets, which helps reduce complexity and improve clarity for downstream optimizations.


4. Switch Statement Target Adjustments

In several files (UriParse.ll, hls_sample_encryption.ll, matroskadec.ll), switch statements had their default labels changed or target labels reordered. This often corresponds to CFG cleanup or edge removal due to unreachable block elimination or sink threading.

  • Example:
    switch i8 %80, label %._crit_edge.loopexit.i.i.us_crit_edge [
      i8 48, label %96
      ...
    ]
    becomes:
    switch i8 %80, label %._crit_edge.loopexit.i.i.us_crit_edge [
      i8 48, label %95
      ...
    ]

High-level impact: Indicates improved control flow graph (CFG) structure through dead code elimination and block reorganization.


5. Use of tail call and Inline Simplification of abs and bswap Intrinsics

In Wlc_NtkPrintInputInfo.ll, Wlc_NtkGetInv.ll, and aaccdec.ll, calls to @llvm.abs.i32 and @llvm.bswap.i32 are either made tail call or their arguments are folded into other expressions. Additionally, some conditional branches based on abs were simplified.

  • Example:
    %smax = tail call i32 @llvm.smax.i32(i32 %.val67, i32 %.val68)
    %22 = add nuw nsw i32 %smax, 1
    becomes:
    %23 = zext nneg i32 %.val67 to i64

High-level impact: Suggests better use of intrinsic properties and potential constant folding, leading to reduced instruction count and improved execution efficiency.


Conclusion

The overall patch appears to focus on loop condition simplification, removal of redundant intrinsics, and control flow graph restructuring. These changes likely result from late-stage optimizations like LoopUnroll, TailCallElim, or DeadCodeElimination passes, aiming to improve performance and clean up generated IR by removing intermediate variables and replacing complex conditions with simpler ones.

model: qwen-plus-latest
CompletionUsage(completion_tokens=1252, prompt_tokens=105700, total_tokens=106952, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this Aug 2, 2025
@dtcxzyw dtcxzyw deleted the test-run15779275434 branch August 2, 2025 06:40
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.

3 participants