Skip to content

Conversation

@dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 20, 2025

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

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

dtcxzyw commented Feb 20, 2025

runner: ariselab-64c-v2
baseline: llvm/llvm-project@62e4436
patch: llvm/llvm-project#127905
sha256: 54299241c44583f7267aef13cc80cfe810e552a4eb0397ed2f6fc52260e57db8
commit: e66cc59

580 files changed, 249479 insertions(+), 253680 deletions(-)

Improvements:
  licm.NumAddSubHoisted 939 -> 942 +0.32%
  instcombine.NegatorNumNegationsFoundInCache 4047 -> 4059 +0.30%
  simplifycfg.NumBitMaps 2104 -> 2106 +0.10%
  correlated-value-propagation.NumShlNSW 100079 -> 100168 +0.09%
  correlated-value-propagation.NumShlNW 225442 -> 225629 +0.08%
  correlated-value-propagation.NumOverflows 2539 -> 2541 +0.08%
  correlated-value-propagation.NumShlNUW 125363 -> 125461 +0.08%
  correlated-value-propagation.NumNNeg 77597 -> 77657 +0.08%
  instcombine.NumFactor 40510 -> 40529 +0.05%
  instcombine.NumReassoc 256441 -> 256550 +0.04%
Regressions:
  aggressive-instcombine.NumInstrsReduced 59799 -> 59608 -0.32%
  simplifycfg.NumLinearMaps 3001 -> 2993 -0.27%
  simple-loop-unswitch.NumSelects 2018 -> 2014 -0.20%
  aggressive-instcombine.NumExprsReduced 19402 -> 19371 -0.16%
  bdce.NumSimplified 5321 -> 5314 -0.13%
  instsimplify.NumExpand 135632 -> 135524 -0.08%
  instcombine.NegatorNumInstructionsCreatedTotal 51503 -> 51471 -0.06%
  instcombine.NegatorMaxInstructionsCreated 13753 -> 13745 -0.06%
  instcombine.NumSunkInst 2797524 -> 2796303 -0.04%
  instcombine.NegatorNumTreesNegated 37576 -> 37560 -0.04%

4 5 bench/actix-rs/optimized/2f4ardqpkkrvo3qj.ll
2 2 bench/arrow/optimized/bridge.ll
29 31 bench/boost/optimized/src.ll
7 7 bench/box2d/optimized/imgui_widgets.ll
4 4 bench/chibicc/optimized/codegen.ll
1 2 bench/cmake/optimized/lzma2_encoder.ll
1 1 bench/coreutils-rs/optimized/2jm5bfr1qa6ga934.ll
15 15 bench/coreutils-rs/optimized/3wh0yla9idangd55.ll
2 3 bench/coreutils-rs/optimized/czge978gjagq0cc.ll
37 34 bench/cvc5/optimized/inst_strategy_pool.ll
7 6 bench/darktable/optimized/load_mfbacks.ll
2 4 bench/delta-rs/optimized/1rw3q64nilk4jthd.ll
1 2 bench/delta-rs/optimized/5d242f2by7re2olg.ll
12 13 bench/duckdb/optimized/ub_duckdb_main_relation.ll
12 6 bench/duckdb/optimized/ub_duckdb_storage.ll
30 33 bench/folly/optimized/MemoryMapping.ll
16 16 bench/grpc/optimized/http_client_filter.ll
12 12 bench/hdf5/optimized/H5B2.ll
4 3 bench/hdf5/optimized/H5B2leaf.ll
3 2 bench/hdf5/optimized/H5HFdbg.ll
6 4 bench/hdf5/optimized/H5HFman.ll
66 67 bench/hdf5/optimized/H5Oginfo.ll
34 35 bench/hdf5/optimized/H5Pgcpl.ll
4 4 bench/hermes/optimized/Executor.ll
28 29 bench/image-rs/optimized/30755d6iao7ojcvl.ll
46 46 bench/jemalloc/optimized/extent.ll
25 29 bench/jemalloc/optimized/jemalloc.ll
49 50 bench/libquic/optimized/quic_framer.ll
62 62 bench/libquic/optimized/quic_protocol.ll
14 15 bench/libquic/optimized/spdy_framer.ll
5 4 bench/llvm/optimized/ASTMatchersInternal.ll
9 10 bench/llvm/optimized/ASTReaderStmt.ll
13 14 bench/llvm/optimized/CGExprAgg.ll
12 13 bench/llvm/optimized/Constant.ll
5 4 bench/llvm/optimized/DwarfCompileUnit.ll
38 39 bench/llvm/optimized/Instruction.ll
18 17 bench/llvm/optimized/ModuleSummaryAnalysis.ll
7 6 bench/llvm/optimized/ModuleSummaryIndex.ll
4 5 bench/llvm/optimized/RISCVTargetMachine.ll
77 67 bench/llvm/optimized/SelectionDAG.ll
17 18 bench/llvm/optimized/SemaExprCXX.ll
34 14 bench/luau/optimized/BytecodeBuilder.ll
5 7 bench/meilisearch-rs/optimized/4llghrvh6vzci59o.ll
6 6 bench/memcached/optimized/items.ll
2 2 bench/node/optimized/libnode.Protocol.ll
2 4 bench/ockam-rs/optimized/1145kugil9dl94a2.ll
1 2 bench/ockam-rs/optimized/13hx4edwj16k9wur.ll
1 2 bench/ockam-rs/optimized/1411u8drt798uxi8.ll
2 4 bench/ockam-rs/optimized/40iecfzh8kpu4oof.ll
2 4 bench/ockam-rs/optimized/lcclztcuaxx9mqt.ll
57 59 bench/openjdk/optimized/instanceKlass.ll
7 5 bench/openjdk/optimized/jfrKlassUnloading.ll
36 42 bench/openjdk/optimized/jfrModuleEvent.ll
46 50 bench/openjdk/optimized/jfrPeriodic.ll
46 50 bench/openjdk/optimized/metaspaceTracer.ll
16 18 bench/openjdk/optimized/objectSampleCheckpoint.ll
32 33 bench/openmpi/optimized/plm_base_launch_support.ll
156 84 bench/openvdb/optimized/SignedFloodFill.ll
4 5 bench/postgres/optimized/vacuumlazy.ll
2 2 bench/protobuf/optimized/extension_set_heavy.ll
2 2 bench/proxygen/optimized/StructuredHeadersEncoder.ll
8 8 bench/pybind11/optimized/test_numpy_dtypes.ll
9 9 bench/qemu/optimized/qemu-io-cmds.ll
47 47 bench/redis/optimized/extent.ll
35 29 bench/regex-rs/optimized/1pxsmct4oxs5dlep.ll
3 3 bench/regex-rs/optimized/33whcn8n29l9c6ys.ll
6 7 bench/rocksdb/optimized/block_based_table_reader.ll
4 4 bench/rocksdb/optimized/ldb_cmd.ll
4 8 bench/rust-analyzer-rs/optimized/1j91i64oabb508eh.ll
49 45 bench/rust-analyzer-rs/optimized/1yf6pyfk8ihkfv63.ll
1 2 bench/rust-analyzer-rs/optimized/2mbx5ptcpq6fo7sc.ll
37 33 bench/rust-analyzer-rs/optimized/2ydioyxkoxez3z9r.ll
4 2 bench/rust-analyzer-rs/optimized/44ayynfm08lnhjsw.ll
3 6 bench/rust-analyzer-rs/optimized/4baun3pe1avree5d.ll
2 1 bench/rust-analyzer-rs/optimized/5fgtm3ees9sdsrsg.ll
1 2 bench/rust-analyzer-rs/optimized/k5mtltw7nxmadpl.ll
58 59 bench/spike/optimized/remote_bitbang.ll
3 3 bench/tls-rs/optimized/4vvnrvl2eceao62c.ll
3 2 bench/tokio-rs/optimized/1rl1r5ea6bzd5c9z.ll
14 22 bench/tree-sitter-rs/optimized/50gi8jfmf82cuy8e.ll
8 9 bench/typst-rs/optimized/22a0ijn9jg8ilzgs.ll
9 10 bench/wasmtime-rs/optimized/2dcgoeji2y2j2nl0.ll
17 18 bench/wireshark/optimized/ngsniffer.ll
66 67 bench/wireshark/optimized/packet-vj-comp.ll
4 4 bench/xgboost/optimized/charconv.ll
4 4 bench/z3/optimized/nla_intervals.ll

@github-actions
Copy link
Contributor

Summary of Major Changes in the LLVM IR Diff

  1. Bitwise Operations Replacing Truncations and Selects:

    • Many instances of trunc followed by select have been replaced with bitwise operations such as shl, zext, and or. For example, in cvc5/optimized/inst_strategy_pool.ll, trunc nuw i8 %62 to i1 and select i1 %63, i32 2, i32 0 are replaced with shl nuw nsw i8 %62, 1 and zext nneg i8 %63 to i32. This change likely improves performance by reducing the number of instructions and leveraging more efficient bit manipulation.
  2. Pointer Arithmetic Adjustments:

    • In several files (e.g., llvm/optimized/ASTReaderStmt.ll, jemalloc/optimized/extent.ll), pointer arithmetic has been adjusted. For instance, getelementptr indices are updated, and some pointers are reused or recalculated differently. This could be an optimization to improve memory access patterns or reduce redundant calculations.
  3. Phi Node Simplifications:

    • Phi nodes have been simplified or reordered in multiple places. For example, in duckdb/optimized/ub_duckdb_main_relation.ll, the phi node %11 = select i1 %7, i1 true, i1 %10 is replaced with a simpler structure involving fewer instructions. Similarly, in llvm/optimized/ModuleSummaryIndex.ll, the phi node %16 = select i1 %.not.not, i32 1, i32 %17 is adjusted to %18 = select i1 %.not.not, i32 1, i32 %17. These changes aim to streamline control flow and reduce complexity.
  4. Function Call Parameter Adjustments:

    • Several function calls have their parameters adjusted. For instance, in llvm/optimized/Instruction.ll, the call to @_ZN4llvm9sandboxir7Tracker17emplaceIfTrackingINS0_13GenericSetterIXadL_ZNKS0_17AtomicCmpXchgInst6isWeakEvEEXadL_ZNS4_7setWeakEbEEEEJPS4_EEEbDpT0_ is updated to use different indices for getelementptr. This likely optimizes how arguments are passed or accessed.
  5. Control Flow Restructuring:

    • Control flow restructuring is evident in multiple files, such as openjdk/optimized/jfrPeriodic.ll and llvm/optimized/DwarfCompileUnit.ll. Branching conditions and labels are renamed or reorganized to simplify the logic. For example, in openjdk/optimized/jfrPeriodic.ll, the branch condition %zInside.1 = phi i1 [ %cmp44, %if.then41 ], [ %zInside.049, %if.else ] is replaced with %zInside.1 = phi i8 [ %frombool45, %if.then41 ], [ %zInside.049, %if.else ]. This improves readability and may enable further optimizations.

High-Level Overview

The patch primarily focuses on optimizing bitwise operations, simplifying phi nodes, adjusting pointer arithmetic, and restructuring control flow. These changes collectively aim to enhance performance by reducing the number of instructions, improving memory access patterns, and streamlining conditional logic. The transformations leverage LLVM's ability to handle bit manipulations efficiently, which can lead to faster execution in scenarios where boolean flags or small integer values are involved. Additionally, the adjustments to function calls and pointer handling ensure better alignment with modern LLVM optimizations and potentially enable further improvements during subsequent compilation stages. Overall, the patch appears to target low-level efficiency gains across various benchmarks.

model: qwen-plus-latest
CompletionUsage(completion_tokens=811, prompt_tokens=113187, total_tokens=113998, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this Feb 20, 2025
@dtcxzyw dtcxzyw deleted the test-run13428468162 branch February 24, 2025 06:19
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