Skip to content

Conversation

@dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Apr 23, 2025

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

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

dtcxzyw commented Apr 23, 2025

Diff mode

runner: ariselab-64c-v2
baseline: llvm/llvm-project@d0cd6f3
patch: llvm/llvm-project#134403
sha256: d2834d0a27dd26368fab090a6f56834b8eabd02e0e80a3e53fba7dfa0300e253
commit: 17ffe63

7418 files changed, 3049752 insertions(+), 3055548 deletions(-)

Improvements:
Regressions:
  globalopt.NumLocalized 79 -> 14 -82.28%
  attributor.NumFnDeleted 23 -> 7 -69.57%
  globalopt.NumGlobUses 304 -> 178 -41.45%
  gvn.NumPRELoopLoad 2040 -> 1241 -39.17%
  globalopt.NumCXXDtorsRemoved 2124 -> 1361 -35.92%
  globalopt.NumAliasesResolved 6640 -> 4416 -33.49%
  memdep.NumCacheNonLocal 21096 -> 14263 -32.39%
  early-cse.NumCSECall 29278 -> 20075 -31.43%
  correlated-value-propagation.NumMinMax 13358 -> 9306 -30.33%
  sroa.NumStoresPredicated 3766 -> 2632 -30.11%

duckdb/background_thread.ll fail
ncnn/detectionoutput.ll fail
ncnn/yolodetectionoutput.ll fail
duckdb/format.ll fail
ncnn/yolov3detectionoutput.ll fail
ncnn/proposal.ll fail
ncnn/packing.ll fail
linux/cleanup.ll fail
graphviz/tlayout.ll fail
graphviz/patchwork.ll fail
graphviz/gvdevice.ll fail
graphviz/shortest.ll fail
graphviz/closest.ll fail
graphviz/tree_map.ll fail
graphviz/block.ll fail
graphviz/gmlscan.ll fail
graphviz/blockpath.ll fail
graphviz/exparse.ll fail
abseil-cpp/cord.ll fail
abseil-cpp/cord_test.ll fail
sundials/idas.ll fail
duckdb/ub_duckdb_core_functions_holistic.ll fail
lightgbm/objective_function.ll fail
lightgbm/dataset.ll fail
zstd/zstd_v04.ll fail
mini-lsm-rs/3jirohyl4so2bgw0.ll fail
postgres/clog.ll fail
postgres/tab-complete.ll fail
rocksdb/memtable_list.ll fail
rocksdb/filename.ll fail
rocksdb/db_impl_write.ll fail
hermes/SegmentedArray.ll fail
cpp-httplib/httplib.ll fail
luajit/lj_ctype.ll fail
openspiel/stones_and_gems.ll fail
git/oidset.ll fail
git/credential-cache--daemon.ll fail
git/pack-bitmap-write.ll fail
git/delta-islands.ll fail
git/reftable-backend.ll fail
git/diffcore-rename.ll fail
git/fsck.ll fail
git/pack-bitmap.ll fail
git/ref-filter.ll fail
git/commit-reach.ll fail
git/show-branch.ll fail
git/files-backend.ll fail
git/pretty.ll fail
git/parallel-checkout.ll fail
git/loose.ll fail
git/unpack-objects.ll fail
git/fast-export.ll fail
git/bloom.ll fail
git/fast-import.ll fail
git/pseudo-merge.ll fail
git/replay.ll fail
git/basics.ll fail
git/archive-tar.ll fail
git/clar.ll fail
git/index-pack.ll fail
git/receive-pack.ll fail
git/fetch-pack.ll fail
git/commit-graph.ll fail
git/path.ll fail
git/archive.ll fail
git/pack-objects.ll fail
git/diff.ll fail
oiio/filesystem.ll fail
oiio/xmp.ll fail
gromacs/gmx_hbond.ll fail
gromacs/gmx_rms.ll fail
gromacs/pme.ll fail
gromacs/gmx_disre.ll fail
gromacs/gmx_energy.ll fail
gromacs/gmx_confrms.ll fail
gromacs/gmx_wham.ll fail
gromacs/gmx_anaeig.ll fail
gromacs/box.ll fail
gromacs/gmx_rmsf.ll fail
gromacs/gmx_vanhove.ll fail
gromacs/tng_io.ll fail
gromacs/make_ndx.ll fail
gromacs/genrestr.ll fail
gromacs/partition.ll fail
gromacs/constraint_gpu_helpers.ll fail
gromacs/gmx_dielectric.ll fail
gromacs/pairlist.ll fail
llvm/CodeMoverUtils.ll fail
llvm/ParseDeclCXX.ll fail
llvm/MachinePipeliner.ll fail
llvm/LoopUnrollPass.ll fail
llvm/CGCleanup.ll fail
llvm/PPDirectives.ll fail
llvm/CommentParser.ll fail
llvm/Visitor.ll fail
llvm/ParseTemplate.ll fail
llvm/ConstantRangeList.ll fail
llvm/regcomp.ll fail
llvm/YAMLParser.ll fail
llvm/ParentMapContext.ll fail

1 1 bench/abc/optimized/abcBm.ll
2 1 bench/actix-rs/optimized/47vbyna8d7p4fmvu.ll
12 15 bench/actix-rs/optimized/xcr5yeosl21p44j.ll
6 6 bench/anki-rs/optimized/2lb7ct7ebbwm4pw.ll
7 8 bench/box2d/optimized/imgui_demo.ll
3 3 bench/chibicc/optimized/parse.ll
2 2 bench/clap-rs/optimized/58cs3pckwcmstm46.ll
15 18 bench/coreutils-rs/optimized/1w8bjqmsfkf0ntfz.ll
9 10 bench/coreutils-rs/optimized/3ri12qup21vdgfw4.ll
19 25 bench/coreutils-rs/optimized/qcad8r5ga44hvbl.ll
12 12 bench/crow/optimized/example_middleware.ll
8 8 bench/cxxopts/optimized/example.ll
10 11 bench/delta-rs/optimized/43rqrp2cinp33t64.ll
6 9 bench/diesel-rs/optimized/1z3qificwegqnhb.ll
7 13 bench/diesel-rs/optimized/2v5qbz8ymz403d7r.ll
3 6 bench/diesel-rs/optimized/4l61q7h3mw8r4045.ll
7 10 bench/diesel-rs/optimized/vl08vh3jfmwhanx.ll
7 7 bench/glog/optimized/logging.ll
4 5 bench/gromacs/optimized/coordinatefile.ll
2 3 bench/gromacs/optimized/forcetable.ll
11 10 bench/grpc/optimized/random_early_detection.ll
8 9 bench/html5ever-rs/optimized/1mf2h4bh94yx6is.ll
84 83 bench/html5ever-rs/optimized/38n20yzo26sy51uu.ll
10 10 bench/image-rs/optimized/254ue5dpb10tdnze.ll
54 53 bench/ipopt/optimized/IpDiagMatrix.ll
47 46 bench/ipopt/optimized/IpMatrix.ll
41 42 bench/just-rs/optimized/2sotx4bdu006z307.ll
3 4 bench/linux/optimized/intel_ddi.ll
52 50 bench/linux/optimized/reboot.ll
4 4 bench/lodepng/optimized/lodepng_util.ll
8 9 bench/meilisearch-rs/optimized/54ajasddlqavlxt2.ll
5 6 bench/minetest/optimized/content_mapblock.ll
92 91 bench/nix/optimized/lexer-tab.ll
37 44 bench/ockam-rs/optimized/1y67jc2e8hldxzxu.ll
15 16 bench/ockam-rs/optimized/2n0s7h3mrzul4f05.ll
11 12 bench/ockam-rs/optimized/548tb0vgebzwk35z.ll
37 45 bench/ockam-rs/optimized/u4cgd14nodyt386.ll
39 38 bench/opencv/optimized/emdL1.ll
50 49 bench/openmpi/optimized/pmdl_mpich.ll
2 5 bench/openmpi/optimized/pmix_hash.ll
78 77 bench/openspiel/optimized/pathfinding.ll
4 3 bench/openusd/optimized/textFileFormat.lex.ll
13 12 bench/php/optimized/html.ll
6 5 bench/postgres/optimized/hashpage.ll
9 8 bench/postgres/optimized/psqlscanslash.ll
12 11 bench/protobuf/optimized/context.ll
53 52 bench/protobuf/optimized/text_format.ll
23 32 bench/qdrant-rs/optimized/4a3k1lnyyshtxc9t.ll
6 3 bench/quantlib/optimized/analyticgjrgarchengine.ll
28 27 bench/quantlib/optimized/glued1dmesher.ll
50 49 bench/re2/optimized/compile.ll
36 45 bench/ripgrep-rs/optimized/3st324p1krxj76od.ll
35 30 bench/ripgrep-rs/optimized/48ebkfcy4wdt2bov.ll
7 9 bench/rocksdb/optimized/compaction_job.ll
3 4 bench/rocksdb/optimized/plain_table_key_coding.ll
14 8 bench/ruby/optimized/compile.ll
14 15 bench/rust-analyzer-rs/optimized/2gfo4qfvfsgl8tkl.ll
18 19 bench/rust-analyzer-rs/optimized/3bcyxdd3fm70gs30.ll
5 8 bench/rust-analyzer-rs/optimized/4nk4vk785ylcn5k7.ll
15 17 bench/smol-rs/optimized/42mrm3r913zsut0b.ll
25 28 bench/syn/optimized/ofvfd67uyaewjlc.ll
72 76 bench/tokenizers-rs/optimized/2d3ht47jz0iets91.ll
81 85 bench/tokenizers-rs/optimized/40hmx6rev8evi2bx.ll
5 6 bench/tree-sitter-rs/optimized/2xun21ofbsn7p9xn.ll
45 46 bench/tree-sitter-rs/optimized/3w8fnbh84xi9yzxl.ll
17 18 bench/tree-sitter-rs/optimized/4x741xowia4bwziy.ll
7 8 bench/turborepo-rs/optimized/3l7xg3ikfppult5o2lclnyys7.ll
67 69 bench/turborepo-rs/optimized/eyin3u3cupdp2wcinr2t4x92g.ll
44 50 bench/wasmtime-rs/optimized/1r2x5absurxbrq18.ll
15 16 bench/wasmtime-rs/optimized/2x1mxlm9f496za8a.ll
4 2 bench/wasmtime-rs/optimized/322yw2dra6hhv794.ll
6 4 bench/wasmtime-rs/optimized/3kgdlzjlx2p3jthq.ll
5 4 bench/wasmtime-rs/optimized/3w5lei6xclrfo3sz.ll
8 4 bench/wasmtime-rs/optimized/4nkh38vfk0kb3m00.ll
30 29 bench/z3/optimized/dl_mk_filter_rules.ll
9 10 bench/zed-rs/optimized/35x08quqxvun4xbcwdjh3cm4j.ll

@github-actions
Copy link
Contributor

Summary of Major Changes in the LLVM IR Patch

1. Addition of !noundef Metadata to Load Instructions

Several load instructions now include the !noundef metadata, which indicates that the loaded value is guaranteed not to be undefined. This change enhances optimization opportunities by allowing the compiler to assume that the loaded value is always valid and does not require additional checks for undefined behavior. For example:

%.pre = load i64, ptr %1, align 8, !range !13, !alias.scope !30, !noalias !251, !noundef !12

2. Update of Branch Conditions with !llvm.loop Metadata

Branch conditions in loops have been updated to include !llvm.loop metadata, which provides loop-specific information to the optimizer. This can help the compiler perform more aggressive loop optimizations, such as unrolling or vectorization. For instance:

br i1 %42, label %24, label %._crit_edge.loopexit.i.i.i.i, !llvm.loop !76

3. Removal of freeze Intrinsics

The freeze intrinsic has been removed from several instructions, simplifying the code and reducing unnecessary operations. The freeze intrinsic was used to ensure that a value is not undefined, but with the addition of !noundef, it is no longer needed. Example:

%spec.select = select i1 %233, i64 %.pre16.i, i64 %232

Previously, this would have included a freeze operation on %pre16.i.

4. Alignment of Metadata Indices

Some metadata indices have been aligned or reordered to improve consistency and clarity. For example, the alignment of !tbaa (Type-Based Alias Analysis) and !range metadata ensures that the optimizer has better information about memory access patterns. Example:

%.pre = load i8, ptr %9, align 1, !tbaa !93, !range !92, !noundef !30

5. Simplification of Conditional Logic

In some cases, complex conditional logic involving multiple select or and operations has been simplified. For example, instead of using select to combine conditions, an and operation is now used:

%or.cond.i.i.i = and i1 %99, %101

This simplification reduces instruction complexity and improves readability while maintaining equivalent functionality.

High-Level Overview

The patch primarily focuses on enhancing the safety and optimization potential of the LLVM IR by:

  • Adding !noundef metadata to load instructions, ensuring that values are always defined.
  • Updating branch conditions with !llvm.loop metadata to enable advanced loop optimizations.
  • Removing redundant freeze intrinsics, streamlining the IR.
  • Aligning and reordering metadata indices for improved alias analysis and range information.
  • Simplifying conditional logic to reduce complexity and improve performance.

These changes collectively aim to improve the generated code's efficiency and reliability, leveraging modern LLVM optimization techniques while adhering to stricter safety guarantees.

model: qwen-plus-latest
CompletionUsage(completion_tokens=677, prompt_tokens=109801, total_tokens=110478, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw added the crash label Apr 23, 2025
@dtcxzyw dtcxzyw closed this Apr 23, 2025
@dtcxzyw dtcxzyw deleted the test-run14614053668 branch May 18, 2025 09:31
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