Skip to content

pre-commit: PR128296 #2154

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: PR128296 #2154

wants to merge 3 commits into from

Conversation

dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 22, 2025

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

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

dtcxzyw commented Feb 22, 2025

runner: ariselab-64c-v2
baseline: llvm/llvm-project@e21a173
patch: llvm/llvm-project#128296
sha256: 0dda9eadf0fcf5b791f0823e7cd10d627ce0bf79e28c8b385db5ec970e67e5f4
commit: 711501c

770 files changed, 2202011 insertions(+), 2233944 deletions(-)

Improvements:
  adce.NumBranchesRemoved 21738 -> 23052 +6.04%
  adce.NumRemoved 91503 -> 92195 +0.76%
  memcpyopt.NumCallSlot 593787 -> 596428 +0.44%
  jump-threading.NumDupes 110485 -> 110913 +0.39%
  instcombine.NumDeadInst 34552183 -> 34575593 +0.07%
  memcpyopt.NumMemCpyInstr 1149209 -> 1149792 +0.05%
  memdep.NumCacheNonLocalPtr 207044020 -> 207061247 +0.01%
  instcombine.NumDeadStore 24317 -> 24319 +0.01%
  instcombine.NumTwoIterations 16966719 -> 16968091 +0.01%
  instcombine.NumSel 25342 -> 25344 +0.01%
Regressions:
  memcpyopt.NumStackMove 58290 -> 56230 -3.53%
  simplifycfg.NumSpeculations 353429 -> 351295 -0.60%
  constraint-elimination.NumCondsRemoved 2202655 -> 2196161 -0.29%
  licm.NumMovedCalls 26160 -> 26126 -0.13%
  early-cse.NumCSELoad 6547351 -> 6542642 -0.07%
  early-cse.NumSimplify 25585680 -> 25572790 -0.05%
  correlated-value-propagation.NumNonNull 8719805 -> 8715584 -0.05%
  memdep.NumCacheDirtyNonLocalPtr 21199 -> 21189 -0.05%
  sccp.NumDeadBlocks 720478 -> 720154 -0.04%
  sccp.NumInstRemoved 2003831 -> 2003026 -0.04%

0 3 bench/abseil-cpp/optimized/node_hash_map_test.ll
1 7 bench/actix-rs/optimized/14bh10sj718x2c7a.ll
14 21 bench/actix-rs/optimized/34v80y29y6uwgxas.ll
6 11 bench/actix-rs/optimized/3arfg1ogrgyw4qv2.ll
0 4 bench/actix-rs/optimized/520p8qtoxfmkvgyc.ll
52 64 bench/boost/optimized/async.ll
0 2 bench/coreutils-rs/optimized/1rno21l8yxg9vs0k.ll
3 4 bench/coreutils-rs/optimized/2cnndbx112sveeb9.ll
9 12 bench/coreutils-rs/optimized/589u74ammi1cn62m.ll
0 2 bench/darktable/optimized/CiffParser.ll
10 11 bench/darktable/optimized/FileReader.ll
3 5 bench/darktable/optimized/FileWriter.ll
59 60 bench/darktable/optimized/HasselbladLJpegDecoder.ll
57 58 bench/darktable/optimized/LJpegDecoder.ll
45 46 bench/darktable/optimized/NakedDecoder.ll
0 14 bench/delta-rs/optimized/17fowff2nvfrfdbu.ll
0 2 bench/delta-rs/optimized/43rqrp2cinp33t64.ll
22 29 bench/delta-rs/optimized/5gq5labm4y40zyg0.ll
5 21 bench/diesel-rs/optimized/15s0i984drbne3lh.ll
13 17 bench/entt/optimized/view.ll
10 17 bench/grpc/optimized/transport.ll
5 18 bench/html5ever-rs/optimized/2ju3n2qmt0ooyuv4.ll
5 18 bench/html5ever-rs/optimized/3n74qlghvzguzx1d.ll
10 23 bench/html5ever-rs/optimized/dg2cb04337sswh6.ll
16 23 bench/image-rs/optimized/1clnprdgqfw2q9lq.ll
26 31 bench/influxdb-rs/optimized/54bldmpi534adbqh.ll
0 4 bench/llvm/optimized/RegisterBankInfo.ll
2 7 bench/meilisearch-rs/optimized/2wt0tk1rjionlq9o.ll
2 19 bench/meilisearch-rs/optimized/2zqq886j9ovgawmv.ll
0 70 bench/meilisearch-rs/optimized/4llghrvh6vzci59o.ll
8 10 bench/meilisearch-rs/optimized/4nfen0oz6o4cyiq8.ll
0 3 bench/meilisearch-rs/optimized/4rtt9oltj0ubuf08.ll
1 7 bench/meilisearch-rs/optimized/4rynht2gwvphprvy.ll
2 7 bench/meilisearch-rs/optimized/5788mfqwwp628q0b.ll
1 1 bench/meshlab/optimized/mainwindow_RunTime.ll
0 2 bench/mini-lsm-rs/optimized/1mavrvqu7b39yar1.ll
10 8 bench/ockam-rs/optimized/189wgg1obirl4k4t.ll
2 8 bench/ockam-rs/optimized/1j8f46ag92qmaepd.ll
2 5 bench/ockam-rs/optimized/4ie0aygpnuk5bzdx.ll
1 3 bench/ockam-rs/optimized/4t3y03rrak2rtjym.ll
25 24 bench/openmpi/optimized/state_dvm.ll
19 18 bench/openmpi/optimized/state_prted.ll
8 73 bench/php/optimized/ftok.ll
23 56 bench/php/optimized/info.ll
60 70 bench/php/optimized/password.ll
15 18 bench/php/optimized/phar.ll
60 67 bench/php/optimized/var.ll
13 20 bench/rand-rs/optimized/2wmck7c19vohagqu.ll
34 48 bench/ripgrep-rs/optimized/1tu4ff7k1l20r9ex.ll
0 4 bench/ripgrep-rs/optimized/f8chif48dhkcb7u.ll
11 16 bench/rocksdb/optimized/pessimistic_transaction_db.ll
3 4 bench/rust-analyzer-rs/optimized/25mimo7c8tgr4lg9.ll
9 12 bench/rust-analyzer-rs/optimized/2z8yitblr1xxwxav.ll
3 16 bench/rustfmt-rs/optimized/2iek5i6kf8wd1vt9.ll
92 112 bench/rustfmt-rs/optimized/2vbyym84o66crvo9.ll
13 17 bench/smol-rs/optimized/42mrm3r913zsut0b.ll
0 4 bench/tls-rs/optimized/4vg8hiu39ndz9uqe.ll
20 36 bench/tls-rs/optimized/59h61akxu6z29dlt.ll
16 19 bench/tokenizers-rs/optimized/1ve5rid4048y19bt.ll
0 4 bench/tokenizers-rs/optimized/4hn9gefsll13qr1r.ll
0 6 bench/tokio-rs/optimized/27wc5j4mui8auwxp.ll
6 14 bench/tokio-rs/optimized/um69cc05lgsv45r.ll
0 10 bench/tree-sitter-rs/optimized/1cv8rmziqotlzxv3.ll
0 10 bench/tree-sitter-rs/optimized/r2wcjjxpw45z4gt.ll
21 63 bench/typst-rs/optimized/26ex1w19ixz6ifuk.ll
28 31 bench/wasmedge/optimized/function.ll
8 15 bench/wasmedge/optimized/vm.ll
0 6 bench/wasmtime-rs/optimized/35t0vcavp8gy3o68.ll
8 4 bench/wasmtime-rs/optimized/399kmbdnjp4ndw8c.ll
0 6 bench/wasmtime-rs/optimized/4ab4rlryc5h7bf6z.ll
0 12 bench/wasmtime-rs/optimized/4jbigeyowzuvulmb.ll
4 2 bench/wasmtime-rs/optimized/5bnmgwn9lrqkuyf1.ll

Copy link
Contributor

Here's a summary of the major changes in the LLVM IR diffs:

  1. Removal of llvm.assume calls:

    • Many instances of icmp ne ptr ..., null followed by call void @llvm.assume(i1 ...) have been removed across multiple files. This eliminates unnecessary checks for null pointers that were previously assumed to be true.
  2. Alloca size adjustments:

    • In several places, alloca sizes for structs have been changed from { ptr, [3 x i64] } to { ptr, i64, i64, i64 }. This likely reflects a change in how struct layouts are being handled, potentially improving memory alignment or reducing padding.
  3. Simplified phi nodes:

    • Some phi nodes have been simplified or removed. For example, in entt/optimized/view.ll, a phi node was replaced with a simpler load/store sequence.
  4. Adjustments to metadata and TBAA (Type-Based Alias Analysis):

    • Numerous changes to metadata tags (!tbaa) have been made, adjusting the type descriptions and offsets. This could indicate improvements in alias analysis precision.
    • Metadata for loops (!llvm.loop) has been updated in some cases, potentially affecting loop optimizations.
  5. Function attribute updates:

    • The attributes for some functions have been modified. For instance, in ockam-rs/optimized/4ie0aygpnuk5bzdx.ll, the memory(inaccessiblemem: write) attribute was removed from llvm.assume, and other memory-related attributes were adjusted.
    • In grpc/optimized/transport.ll, function attributes like mustprogress, nocallback, nofree, etc., were updated for certain functions, possibly reflecting changes in their behavior or requirements.

These changes collectively suggest improvements in optimization passes, particularly in areas like redundant null checks elimination, more efficient struct handling, refined alias analysis, and updated function attributes for better code generation and safety guarantees. The removal of llvm.assume calls for null checks implies that the compiler can now infer these properties without explicit assumptions, leading to cleaner and potentially more efficient code.

model: qwen-plus-latest
CompletionUsage(completion_tokens=439, prompt_tokens=111035, total_tokens=111474, completion_tokens_details=None, prompt_tokens_details=None)

Copy link

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Some minor regressions. A common improvement is additional call slot optimization in hashbrown.

@@ -146,14 +146,14 @@ define hidden void @_ZNK8rawspeed10FileReader8readFileEv(ptr dead_on_unwind noal
br label %.body

"_ZNSt10unique_ptrI8_IO_FILEZNK8rawspeed10FileReader8readFileEvE3$_0ED2Ev.exit": ; preds = %28
%45 = load ptr, ptr %24, align 8, !tbaa !15, !nonnull !21, !noundef !21
%45 = load ptr, ptr %24, align 8, !tbaa !15
Copy link

Choose a reason for hiding this comment

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

Lost metadata.

Choose a reason for hiding this comment

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

This is caused when the assume is removed the load have no user and is removed before inline is done, but after inline there is other uses of the pointer.
before this PR as the load was ephemeral the fold was done first after inline when it was not ephemeral any more.
is it possible to only run this fold after inline is done?

store i64 %10, ptr %14, align 8, !alias.scope !770
%15 = getelementptr inbounds nuw i8, ptr %3, i64 40
store i64 %12, ptr %15, align 8, !alias.scope !770
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(48) %3, i64 48, i1 false)
Copy link

Choose a reason for hiding this comment

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

Regression

@@ -29786,7 +29786,7 @@ _ZNK10MainWindow3GLAEv.exit.thread: ; preds = %1, %_ZNK10MainWindo
br i1 %.not.i11, label %_ZNK10MainWindow3GLAEv.exit13, label %_ZNK10MainWindow3GLAEv.exit13.thread

_ZNK10MainWindow3GLAEv.exit13: ; preds = %8
%12 = load ptr, ptr inttoptr (i64 1464 to ptr), align 8, !nonnull !61, !noundef !61
%12 = load ptr, ptr inttoptr (i64 1464 to ptr), align 8
Copy link

Choose a reason for hiding this comment

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

Lost metadata

%8 = getelementptr inbounds nuw i8, ptr %4, i64 16
%9 = load i64, ptr %8, align 8, !noalias !330
%5 = load ptr, ptr %4, align 8, !noalias !330, !noundef !5
%6 = icmp eq ptr %5, null
Copy link

Choose a reason for hiding this comment

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

Regression

call void %674(ptr noundef nonnull %675, ptr noundef nonnull %525) #16
%673 = getelementptr inbounds nuw i8, ptr %525, i64 56
%674 = getelementptr inbounds nuw i8, ptr %525, i64 96
%675 = load ptr, ptr %674, align 8, !tbaa !169
Copy link

Choose a reason for hiding this comment

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

Lost metadata

br label %smart_str_free_ex.exit

smart_str_free_ex.exit: ; preds = %37, %41, %46, %36
%48 = phi i1 [ true, %36 ], [ %47, %46 ], [ true, %41 ], [ true, %37 ]
call void @llvm.assume(i1 %48)
Copy link

Choose a reason for hiding this comment

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

Side note: Should probably avoid sinking assumes if it makes the assume condition a phi node...

@@ -35,13 +35,15 @@ define void @"_ZN76_$LT$hashbrown..raw..RawTable$LT$T$C$A$GT$$u20$as$u20$core..c
call void @llvm.lifetime.start.p0(i64 0, ptr nonnull %3)
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4)
call void @_ZN9hashbrown3raw13RawTableInner17new_uninitialized17h12b3d16eb02b1eeaE(ptr nonnull sret({ ptr, [3 x i64] }) align 8 %4, ptr nonnull align 1 %3, i64 48, i64 16, i64 %12, i1 zeroext true)
%13 = load ptr, ptr %4, align 8, !nonnull !3, !noundef !3
%13 = load ptr, ptr %4, align 8, !noundef !3
%.not.i = icmp eq ptr %13, null
Copy link

Choose a reason for hiding this comment

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

Regression

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