Skip to content

Conversation

@dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented May 8, 2025

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

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

dtcxzyw commented May 8, 2025

Diff mode

runner: ariselab-64c-v2
baseline: llvm/llvm-project@5b29058
patch: llvm/llvm-project#137875
sha256: fc5e1f92a105e7fccd5dd42d546a17c8d9fb210e30fc82d91ec944db435ca8be
commit: 045fd7a

92 files changed, 130027 insertions(+), 130534 deletions(-)

Improvements:
  basicaa.SearchLimitReached 34557 -> 34606 +0.14%
  correlated-value-propagation.NumNNeg 84479 -> 84507 +0.03%
  instcombine.NumDeadInst 35302713 -> 35309491 +0.02%
  correlated-value-propagation.NumNUW 513093 -> 513175 +0.02%
  instcombine.NumCombined 105523566 -> 105528227 +0.00%
  simplifycfg.NumFoldBranchToCommonDest 674931 -> 674955 +0.00%
  early-cse.NumCSELoad 6542893 -> 6543109 +0.00%
  early-cse.NumCSEGEP 11594923 -> 11595258 +0.00%
  jump-threading.NumThreads 2369901 -> 2369954 +0.00%
  globalopt.NumDeleted 853528 -> 853545 +0.00%
Regressions:
  early-cse.NumCSE 3846856 -> 3843521 -0.09%
  instcombine.NumFactor 39349 -> 39336 -0.03%
  correlated-value-propagation.NumAnd 38152 -> 38142 -0.03%
  gvn.NumGVNInstr 139516 -> 139482 -0.02%
  gvn.NumGVNPRE 139516 -> 139482 -0.02%
  bdce.NumRemoved 333537 -> 333507 -0.01%
  licm.NumGEPsHoisted 48404 -> 48402 -0.00%
  instcombine.NumDeadStore 24550 -> 24549 -0.00%
  instcombine.NumSunkInst 2878868 -> 2878755 -0.00%
  count-visits.MaxVisited 43130 -> 43129 -0.00%

21 23 bench/abc/optimized/abc.ll
6 7 bench/abc/optimized/bmcMulti.ll
74 76 bench/abc/optimized/cecSatG2.ll
8 9 bench/abc/optimized/giaCof.ll
36 38 bench/abc/optimized/giaEquiv.ll
57 61 bench/abc/optimized/giaPat2.ll
62 67 bench/abseil-cpp/optimized/float_conversion.ll
42 54 bench/abseil-cpp/optimized/gtest-all.ll
52 64 bench/abseil-cpp/optimized/int128.ll
8 9 bench/fmt/optimized/format-impl-test.ll
64 76 bench/freetype/optimized/sfnt.ll
14 15 bench/hdf5/optimized/H5Fsuper_cache.ll
122 129 bench/imgui/optimized/imgui_draw.ll
164 168 bench/linux/optimized/tree.ll
14 16 bench/llvm/optimized/RISCVMergeBaseOffset.ll
102 105 bench/llvm/optimized/blake3.ll
78 88 bench/meilisearch-rs/optimized/2eqafq69fd46y14a.ll
55 61 bench/meshlab/optimized/gltf_loader.ll
180 176 bench/mold/optimized/arch-m68k.ll
238 234 bench/mold/optimized/arch-sparc64.ll
102 105 bench/mold/optimized/blake3.ll
49 56 bench/openjdk/optimized/hb-ot-name.ll
26 27 bench/openjdk/optimized/utf8.ll
122 127 bench/openssl/optimized/d1_lib.ll
43 46 bench/openssl/optimized/statem_srvr.ll
57 60 bench/php/optimized/pcre2_auto_possess.ll
4 7 bench/php/optimized/pcre2_study.ll
22 29 bench/qemu/optimized/fdt.ll
119 140 bench/qemu/optimized/fdt_sw.ll
128 137 bench/recastnavigation/optimized/imguiRenderGL.ll
1 1 bench/rust-analyzer-rs/optimized/36cskjvhktchzlnh.ll
2 2 bench/rust-analyzer-rs/optimized/5ac99zaxn7b9r9xv.ll
4 4 bench/rust-analyzer-rs/optimized/hf9vzunhg9aziex.ll
6 6 bench/rust-analyzer-rs/optimized/hknx1qr3lu9291s.ll
21 28 bench/spike/optimized/fdt.ll
128 73 bench/spike/optimized/fdt_ro.ll
119 140 bench/spike/optimized/fdt_sw.ll
33 29 bench/wireshark/optimized/netscaler.ll
17 20 bench/wireshark/optimized/packet-atm.ll
10 13 bench/wireshark/optimized/packet-knet.ll
86 89 bench/wireshark/optimized/packet-opensafety.ll
173 189 bench/wireshark/optimized/tvbuff.ll
169 175 bench/wolfssl/optimized/tls.ll
9 11 bench/zed-rs/optimized/38cn6p2m6864jrrxog4mr8xwk.ll
6 8 bench/zed-rs/optimized/7ud3epkhjcjfe38h6hlh4jrau.ll

@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2025

Here is a high-level summary of the major changes in the provided LLVM IR diff:

  1. Simplified Integer Comparison Logic:

    • In multiple functions (e.g., @Abc_CommandAbc9Pms, @Gia_ManCountConst0PosGia, and others), the transformation replaces a pattern involving shift-and-or (shl + or disjoint) followed by equality check against zero with a simpler or instruction directly. This reduces instruction count and simplifies control flow, improving both readability and execution efficiency.
    • Example: Replaced %72 = shl nsw i32 %47, 1; %73 = or disjoint i32 %72, %45 with %72 = or i32 %47, %45.
  2. Phi Node Adjustments for Loop Control:

    • Several functions adjust phi node values in loop headers and exit blocks to reflect updated variable names and new value sources due to code restructuring.
    • For instance, in @Abc_CommandAbc9Pms, .critedge block's phi nodes now reference renamed labels like %._crit_edge instead of outdated ones like %.lr.ph, likely reflecting loop unrolling or restructure.
  3. Branch Condition Refinement:

    • The condition logic in branches has been optimized by replacing complex comparisons with more direct ones, often using bitwise OR and EQ/NE checks instead of shifts and masks.
    • Example: In @tt_cmap2_char_index, replaced a multi-step bitshift-comparison sequence with a simple or between two bytes followed by an icmp eq.
  4. Memory Load and Phi Node Updates:

    • In several functions (e.g., @H5F__cache_superblock_deserialize, @Gia_GenerateCexesDumpFile), memory loads and pointer calculations have been reordered or simplified. Phi nodes were adjusted accordingly to match new predecessor blocks and variable states.
  5. Reduction in Intermediate Instructions:

    • Some functions removed unnecessary intermediate instructions such as redundant truncations, shifts, and insertions, consolidating them into fewer steps while preserving behavior.
    • Example: In @rcu_preempt_deferred_qs_irqrestore, replaced a chain of zext, shl, and or operations with a single or operation on lower bits before final comparison.

These optimizations primarily focus on reducing complexity, removing redundant computation, and streamlining control flow paths. The result is a leaner, more efficient IR that should yield better runtime performance and smaller generated machine code.

model: qwen-plus-latest
CompletionUsage(completion_tokens=545, prompt_tokens=119817, total_tokens=120362, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this May 8, 2025
@dtcxzyw dtcxzyw deleted the test-run14907142170 branch May 18, 2025 09:30
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.

1 participant