Skip to content

pre-commit: PR126423 #2110

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

pre-commit: PR126423 #2110

wants to merge 3 commits into from

Conversation

dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 9, 2025

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

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

dtcxzyw commented Feb 9, 2025

runner: ariselab-64c-v2
baseline: llvm/llvm-project@3d14000
patch: llvm/llvm-project#126423
sha256: df7d4a34083494b12a196b32b7d759c87de009d14c4df0277524a247c9bc6814
commit: ea0861b

4 files changed, 161 insertions(+), 164 deletions(-)

Improvements:
  adce.NumRemoved 91012 -> 91015 +0.00%
  jump-threading.NumFolds 2086517 -> 2086518 +0.00%
  instcombine.NumCombined 99678365 -> 99678368 +0.00%
  last-run-tracking.NumSkippedPasses 46000114 -> 46000115 +0.00%
Regressions:
  correlated-value-propagation.NumAnd 37422 -> 37420 -0.01%
  correlated-value-propagation.NumSExt 37965 -> 37963 -0.01%
  simplifycfg.NumHoistCommonCode 608542 -> 608540 -0.00%
  correlated-value-propagation.NumPhis 994865 -> 994862 -0.00%
  simplifycfg.NumHoistCommonInstrs 1771199 -> 1771197 -0.00%
  instcombine.NumSunkInst 2723811 -> 2723809 -0.00%
  jump-threading.NumThreads 2236141 -> 2236140 -0.00%
  local.NumRemoved 3758933 -> 3758932 -0.00%
  gvn.NumGVNInstr 7678929 -> 7678928 -0.00%
  instcombine.NumDeadInst 33143068 -> 33143065 -0.00%

27 31 bench/llvm/optimized/X86RegisterBankInfo.ll
1 1 bench/meshoptimizer/optimized/indexcodec.ll
21 20 bench/opencv/optimized/find_ellipses.ll

Copy link
Contributor

github-actions bot commented Feb 9, 2025

Summary of Changes in LLVM IR Diff

This patch introduces several modifications across three different LLVM IR files. Below is a summary of the major changes:

  1. Optimization in X86RegisterBankInfo.ll:

    • Removed redundant instructions: The call to llvm.lifetime.start.p0 and related comparisons (icmp, select) have been eliminated, simplifying the control flow.
    • Restructured phi nodes: A new phi node %.pre-phi75 has been introduced to handle values from multiple predecessors, improving clarity and reducing redundancy.
    • Adjusted switch statements: The labels in the switch instruction for %43 have been reorganized, with some labels being removed or reordered (42, 43, etc.), aligning better with the updated control flow.
    • Simplified phi node merging: The final phi node %.0 now incorporates fewer preds, streamlining the logic and reducing unnecessary computations.
  2. Truncation Optimization in indexcodec.ll:

    • Added nuw (No Unsigned Wrap) flag: In the truncation of %indvars.iv.i185 to an 8-bit integer, the nuw flag ensures that the operation will not result in unsigned overflow, enhancing precision and safety of the computation.
  3. Control Flow Refinement in find_ellipses.ll:

    • Updated branching logic: Several branch instructions have been modified to use updated labels (226 instead of 225), ensuring consistency in the flow of execution.
    • Improved pointer arithmetic: The calculation involving %217 and %218 has been adjusted to use zext operations more effectively, potentially improving performance by avoiding unnecessary sign extensions.
    • Streamlined phi nodes: The phi node %.6.us now merges values from fewer predecessors, simplifying the data dependency graph and making the logic easier to follow.
    • Reordered label usage: Some labels have been reused or repurposed (226), reducing duplication and improving readability.

High-Level Overview

The overall goal of these changes appears to be optimization-focused, targeting both computational efficiency and code clarity. By removing redundant instructions, restructuring control flow, and refining data dependencies, the patch aims to improve the generated machine code's performance and maintainability. These modifications likely result in reduced instruction count, better register utilization, and improved runtime behavior when compiled to native code.

model: qwen-plus-latest
CompletionUsage(completion_tokens=508, prompt_tokens=4430, total_tokens=4938, completion_tokens_details=None, prompt_tokens_details=None)


225: ; preds = %220, %209, %208
%.6.us = phi i32 [ %224, %220 ], [ %.5.us, %209 ], [ %.5.us, %208 ]
%217 = zext nneg i32 %111 to i64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression due to lack of sext vs zext nneg CSE.

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