Skip to content

pre-commit: PR184182#3528

Open
zyw-bot wants to merge 3 commits intomainfrom
test-run22587935568
Open

pre-commit: PR184182#3528
zyw-bot wants to merge 3 commits intomainfrom
test-run22587935568

Conversation

@zyw-bot
Copy link
Collaborator

@zyw-bot zyw-bot commented Mar 2, 2026

Link: llvm/llvm-project#184182
Requested by: @andjo403

@github-actions github-actions bot mentioned this pull request Mar 2, 2026
@zyw-bot
Copy link
Collaborator Author

zyw-bot commented Mar 2, 2026

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@b11a424
patch: llvm/llvm-project#184182
sha256: 8f3173abd0f5a57b9058daac5f447ab6aacf02def745ba2b3f22582eacfcb5ee
commit: 4dc2780

3364 files changed, 2123743 insertions(+), 2096266 deletions(-)

Improvements:
  instsimplify.NumExpand 291222 -> 298851 +2.62%
  correlated-value-propagation.NumNNeg 95896 -> 97485 +1.66%
  correlated-value-propagation.NumShlNSW 116433 -> 118126 +1.45%
  bdce.NumRemoved 378049 -> 382263 +1.11%
  correlated-value-propagation.NumShlNW 268712 -> 270411 +0.63%
  gvn.NumGVNLoad 1318293 -> 1325766 +0.57%
  instsimplify.NumReassoc 815152 -> 819522 +0.54%
  instcount.NumOrInst 1142633 -> 1148327 +0.50%
  instcount.NumTruncInst 2935508 -> 2949446 +0.47%
  instcombine.NumExpand 2699 -> 2708 +0.33%
Regressions:
  aggressive-instcombine.NumAnyOrAllBitsSet 70 -> 20 -71.43%
  aggressive-instcombine.NumInstrsReduced 45455 -> 43478 -4.35%
  tailcallelim.NumAccumAdded 151 -> 149 -1.32%
  aggressive-instcombine.NumExprsReduced 15651 -> 15553 -0.63%
  correlated-value-propagation.NumAnd 44210 -> 43967 -0.55%
  indvars.NumElimIdentity 1833 -> 1823 -0.55%
  correlated-value-propagation.NumCmps 109384 -> 108793 -0.54%
  correlated-value-propagation.NumSaturating 2573 -> 2562 -0.43%
  correlated-value-propagation.NumOverflows 4343 -> 4330 -0.30%
  constraint-elimination.NumCondsRemoved 2633915 -> 2629322 -0.17%

+26 grpc/ssl_transport_security.ll
+24 ocio/MatrixOp.ll
+16 rocksdb/clock_cache.ll
+12 sdl/SDL_gamepad.ll
+8 nori/widget.ll
+8 rocksdb/lru_cache.ll
+6 z3/dl_mk_interp_tail_simplifier.ll
+5 ffmpeg/vc1_block.ll
+5 grpc/tls_security_connector.ll
+5 hermes/DCE.ll
+5 hyperscan/ng_literal_component.ll
+5 nuttx/sched_removereadytorun.ll
+5 proxygen/HTTP1xCodec.ll
+4 hermes/BigIntSupport.ll
+4 openssl/cmp_genm.ll
+4 pola-rs/4k9mmppgjee0j2w63yqma6wuu.ll
+4 rust-analyzer-rs/2334ao9w0k9d7973.ll
+4 rust-analyzer-rs/rilullg9p294yp1.ll
+3 openjdk/cfgnode.ll
+3 postgres/ruleutils.ll
+3 rustfmt-rs/llbxf4pclolbp5s.ll
+2 cmake/zstd_compress_superblock.ll
+2 duckdb/serialize_parquet.ll
+2 duckdb/ub_duckdb_common.ll
+2 llvm/Scalarizer.ll
+2 pbrt-v4/integrator.ll
+2 slurm/hostlist.ll
+2 uv-rs/13uh81w4oy46nmpmfbcefagqn.ll
+2 verilator/V3Expand.ll
+2 wireshark/disabled_protos.ll
+1 coreutils-rs/2i3dvgzkmy2gn6v1.ll
+1 cpython/complexobject.ll
+1 cpython/pylifecycle.ll
+1 cpython/textio.ll
+1 delta-rs/11w0at10aiwuq3yr.ll
+1 foundations-rs/208outlkq19x3hykb3fof84u4.ll
+1 jemalloc/extent_dss.ll
+1 linux/offchannel.ll
+1 llvm/CodeMetrics.ll
+1 luau/Quantify.ll
+1 mitsuba3/path.ll
+1 opencv/matmul.dispatch.ll
+1 php/session.ll
+1 pola-rs/akny94jrhz4eylr1elklgkf62.ll
+1 protobuf/tokenizer.ll
+1 qemu/job.ll
+1 redis/extent_dss.ll
+1 rust-analyzer-rs/54fx8hdjlkc0fd42.ll
+1 tokenizers-rs/4hn9gefsll13qr1r.ll
+1 tree-sitter-rs/3akexam875pc2p1h.ll
+1 wasmtime-rs/35xpok2vrm65hidj.ll
+1 wireshark/packet-fcswils.ll
+0 abseil-cpp/gtest-all.ll
+0 brotli/decode.ll
+0 bullet3/btConvexHull.ll
-1 abc/bmcCexTools.ll
-1 cmake/archive_read_support_format_mtree.ll
-1 coreutils-rs/2pqvixtdp9wizsl2.ll
-1 cpython/preconfig.ll
-1 cvc5/SimpSolver.ll
-1 darktable/thumbtable.ll
-1 delta-rs/47qjbhol909h8zu7.ll
-1 ffmpeg/mss12.ll
-1 ffmpeg/remove_extradata.ll
-1 folly/AsyncSocket.ll
-1 git/config.ll
-1 git/remote-curl.ll
-1 grpc/alts_handshaker_client.ll
-1 just-rs/2sblcsgax6v4zfcc.ll
-1 libphonenumber/phonemetadata.pb.ll
-1 linux/buffer.ll
-1 linux/hda_auto_parser.ll
-1 luajit/lj_carith.ll
-1 minetest/CSkinnedMesh.ll
-1 minetest/nodedef.ll
-1 mitsuba3/scene.ll
-1 openspiel/go_board.ll
-1 openusd/changes.ll
-1 postgres/brin_minmax_multi.ll
-1 quiche-rs/5lgkl05cn1nxa92c04lryr5y4.ll
-1 quickjs/libbf.ll
-1 recastnavigation/catch_amalgamated.ll
-1 ruby/rational.ll
-1 ruby/re.ll
-1 rust-analyzer-rs/leba1wmgxgrzxkl.ll
-1 rustfmt-rs/2vbyym84o66crvo9.ll
-1 stb/stb_vorbis.ll
-1 wireshark/packet-bacapp.ll
-2 abc/abcBalance.ll
-2 boost/algorithm.ll
-2 coreutils-rs/4gs2z359bfnc1tys.ll
-2 freetype/cff.ll
-2 freetype/ftbase.ll
-2 image-rs/1clnprdgqfw2q9lq.ll
-2 libwebp/vp8l_dec.ll
-2 lief/ASN1Reader.ll
-2 oiio/argparse.ll
-2 openssl/threadstest.ll
-2 quest/QuEST_validation.ll
-2 verilator/V3Split.ll
-2 wasmtime-rs/4bsmuvpz9r22ks1w.ll
-3 abc/sbdCut2.ll
-3 hermes/RegAlloc.ll
-3 icu/xmlparser.ll
-3 openjdk/modRefBarrierSetC1.ll
-3 proj/geodsigntest.ll
-3 regex-rs/32jw1oy2yofrhudk.ll
-3 vcpkg/commands.set-installed.ll
-3 yosys/SimpSolver.ll
-4 abc/giaSupp.ll
-4 arrow/api_vector.ll
-4 cvc5/theory_arith_private.ll
-4 ffmpeg/format.ll
-4 git/notes-utils.ll
-4 linux/main.ll
-4 linux/trace_dynevent.ll
-4 linux/waitid.ll
-4 llvm/EvaluationResult.ll
-4 openusd/loopPatchBuilder.ll
-4 php/array.ll
-4 sundials/sunmatrix_sparse.ll
-5 graphviz/strmatch.ll
-5 libwebp/webpdec.ll
-5 llvm/DWARFDie.ll
-6 g2o/hyper_graph.ll
-8 ockam-rs/on09w5afel7x9qz.ll
-8 rust-analyzer-rs/2mbx5ptcpq6fo7sc.ll
-9 icu/udata.ll
-12 luau/Unifier2.ll
-20 ruby/range.ll
-29 openssl/x_pubkey.ll

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

This patch contains numerous low-level LLVM IR optimizations across many benchmarks, primarily focused on improving boolean logic and control flow. The major changes are:

  1. Boolean Logic Simplification: Replaced icmp ne/icmp eq comparisons followed by zext with direct trunc operations (e.g., %x = trunc nuw i32 %y to i1) where the integer is known to be 0 or 1. This eliminates unnecessary comparison instructions and reduces instruction count.

  2. Conditional Logic Refactoring: Converted chains of icmp + select + and/or into more efficient patterns — often using select directly with boolean operands instead of integer-based branching logic, and simplifying boolean algebra (e.g., replacing and i1 %a, %b with select i1 %b, i1 %a, i1 false when appropriate).

  3. Phi Node Type Corrections: Updated phi node types from i8/i32 to i1 in loops and conditionals where the values being merged are logically boolean (e.g., phi i1 [true, ...] instead of phi i8 [1, ...]), improving type safety and enabling downstream optimizations.

  4. Control Flow Merging & Edge Correction: Fixed misaligned branch targets and critical edge handling (e.g., updating .crit_edge, .thread, and loop exit labels), corrected phi operand order in merged blocks, and removed redundant branches — especially around early-exit conditions and error-handling paths.

  5. Cleanup of Redundant Instructions: Removed unused or dead instructions (e.g., unused phi inputs, redundant zext/icmp, stale br targets) and consolidated landing pads and exception handling logic to reduce IR size and improve correctness.

These changes collectively enhance code generation quality by tightening boolean semantics, reducing instruction overhead, and improving CFG structure — all without altering program behavior.

model: qwen-plus-latest
CompletionUsage(completion_tokens=409, prompt_tokens=107715, total_tokens=108124, completion_tokens_details=None, prompt_tokens_details=None)

%.val3.i5.i.i.i.i = load i32, ptr %12, align 4, !tbaa !696
%13 = icmp eq i32 %.val.i4.i.i.i.i, %.val3.i5.i.i.i.i
%14 = and i1 %8, %13
%14 = select i1 %13, i1 %8, i1 false
Copy link

Choose a reason for hiding this comment

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

Copy link

@andjo403 andjo403 left a comment

Choose a reason for hiding this comment

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

from local run 860 files with less lines, 1668 same line count and 840 files that is more lines many due to more inlining

47: ; preds = %38
%48 = icmp ne i32 %4, 0
%or.cond = or i1 %48, %46
%48 = trunc nuw i32 %4 to i1
Copy link

@andjo403 andjo403 Mar 2, 2026

Choose a reason for hiding this comment

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

shall isGuaranteedNotToBePoison check the range for %4 so the select can be folded to or?

Comment on lines +9188 to +9189
%15 = trunc nuw i8 %14 to i1
%16 = xor i1 %15, true
Copy link

@andjo403 andjo403 Mar 2, 2026

Choose a reason for hiding this comment

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

shall xor (trunc nuw x to i1), true be folded to icmp eq x, 0 ?
will lose information about the range of %14

Comment on lines +2142 to +2144
%.not = xor i1 %68, true
%69 = trunc nuw i8 %.pre22 to i1
%or.cond = select i1 %.not, i1 %69, i1 false
Copy link

Choose a reason for hiding this comment

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

missing demorgan when trunc is one of values

%5 = icmp eq i8 %4, 0
br i1 %5, label %.lr.ph, label %"_ZN4itoa55_$LT$impl$u20$itoa..private..Sealed$u20$for$u20$u32$GT$5write17hb7b886c46e130987E.exit"
%5 = tail call i8 @llvm.usub.sat.i8(i8 1, i8 %4)
%6 = trunc nuw i8 %5 to i1
Copy link

Choose a reason for hiding this comment

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

trunc usub.sat(1,X) to i1 -> icmp eq X, 0

Choose a reason for hiding this comment

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

Comment on lines +1265 to +1268
%276 = trunc nuw i8 %275 to i1
%277 = or i1 %273, %276
%278 = zext i1 %277 to i8
store i8 %278, ptr %274, align 2, !tbaa !129
Copy link

Choose a reason for hiding this comment

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

zext (or X, (trunc nuw Y)) -> or (zext X), Y
maybe is llvm/llvm-project#98017
many times in this diff shall this have a special fold

Comment on lines +3890 to +3891
%or.cond142.i.i = trunc nuw i8 %.sink.i.i.i319 to i1
%or.cond143.i.i = select i1 %or.cond142.i.i, i1 %.sroa.14.0.i138.i.i, 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

Choose a reason for hiding this comment

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

Comment on lines +101 to +102
%.1 = phi i8 [ %46, %42 ], [ %.034, %36 ]
%48 = trunc nuw i8 %.1 to i1
Copy link

Choose a reason for hiding this comment

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

missing that the type can be change to i1 for the phi

Comment on lines +9953 to +9955
%4 = icmp eq i64 %3, 2
%5 = trunc nuw i64 %3 to i1
%spec.select = select i1 %4, i1 true, i1 %5
Copy link

Choose a reason for hiding this comment

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

as the range for %3 is (0,3]

X == 2 && X != 0 -> X != 0

Copy link

Choose a reason for hiding this comment

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

as we know that the range for %x is not (0,2] shall trunc nuw %x to i1 be converted to icmp ne %x , 0 or maybe at least if it is a second operand in a logical and/or

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