Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

pre-commit: PR173022 - #3537

Closed
zyw-bot wants to merge 3 commits into
mainfrom
test-run22711182409
Closed

pre-commit: PR173022#3537
zyw-bot wants to merge 3 commits into
mainfrom
test-run22711182409

Conversation

@zyw-bot

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

Copy link
Copy Markdown
Collaborator

Link: llvm/llvm-project#173022
Requested by: @Camsyn

@github-actions github-actions Bot mentioned this pull request Mar 5, 2026
@zyw-bot

zyw-bot commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator Author

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@b0da64e
patch: llvm/llvm-project#173022
sha256: 839a9fc3d17e4961ed55c6affa60592a025a442123cd3f223f07a085cba85730
commit: 2544b0d

1380 files changed, 258558 insertions(+), 265955 deletions(-)

Improvements:
  dse.NumCFGChecks 640377 -> 640665 +0.04%
  tailcallelim.NumRetDuped 15447 -> 15449 +0.01%
  constmerge.NumIdenticalMerged 15307 -> 15308 +0.01%
  indvars.NumSameSign 40231 -> 40233 +0.00%
  instcombine.NumDeadStore 25948 -> 25949 +0.00%
  loop-instsimplify.NumSimplified 182164 -> 182171 +0.00%
  licm.NumPromotionCandidates 585344 -> 585364 +0.00%
  simple-loop-unswitch.NumBranches 104919 -> 104922 +0.00%
  sroa.NumLoadsSpeculated 316436 -> 316444 +0.00%
  jump-threading.NumFolds 2529509 -> 2529558 +0.00%
Regressions:
  instcombine.NegatorNumNegationsFoundInCache 4031 -> 4000 -0.77%
  simplifycfg.NumBitMaps 2228 -> 2221 -0.31%
  instcombine.NegatorMaxTotalValuesVisited 60531 -> 60512 -0.03%
  memdep.NumCacheDirtyNonLocalPtr 23144 -> 23137 -0.03%
  correlated-value-propagation.NumPhiCommon 51824 -> 51812 -0.02%
  loop-simplify.NumNested 11684 -> 11682 -0.02%
  correlated-value-propagation.NumDeadCases 65888 -> 65881 -0.01%
  simplifycfg.NumSpeculations 393029 -> 392992 -0.01%
  memcpyopt.NumStackMove 121257 -> 121247 -0.01%
  licm.NumLoadStorePromoted 62403 -> 62398 -0.01%

+14 hwloc/lstopo-ascii.ll
+3 boost/area.ll
+3 influxdb-rs/26y592k8de9dg2n1.ll
+3 ockam-rs/23pvw3nj6m0p9wnd.ll
+3 ockam-rs/2ngtaq92gcad4v6j.ll
+3 rust-analyzer-rs/1au8fupciwcmum6.ll
+1 casadi/dae_builder_internal.ll
-1 linux/exconvrt.ll
-1 llvm/ExprEngineCallAndReturn.ll
-1 uv-rs/8liujflwnkk5w198ln0kd3jvp.ll
-2 wasmi-rs/5j8r45rfbax70rfnan7wcjxtw.ll
-2 wireshark/prefs.ll
-3 abc/bzlib.ll
-3 boost/operations.ll
-3 cmake/setopt.ll
-3 cpython/action_helpers.ll
-3 cpython/descrobject.ll
-3 csmith/Type.ll
-3 darktable/blend_gui.ll
-3 duckdb/ub_duckdb_storage.ll
-3 entt/scheduler.ll
-3 freetype/sfnt.ll
-3 graphviz/trapezoid.ll
-3 gromacs/colvarbias_restraint.ll
-3 hdf5/H5LT.ll
-3 jsonnet/rapidyaml.ll
-3 libevent/evutil.ll
-3 libuv/tty.ll
-3 luau/ldebug.ll
-3 mold/passes.cc.X86_64.ll
-3 openssl/apps.ll
-3 php/html.ll
-3 php/simplexml.ll
-3 proj/conversion.ll
-3 proxygen/http_parser_cpp.ll
-3 pugixml/pugixml.ll
-3 recastnavigation/catch_amalgamated.ll
-3 ruby/prism.ll
-3 ruff-rs/3cdt95idrjky64soruf868sbx.ll
-3 ruff-rs/76riqt46vtynf4kgizavl3q88.ll
-3 rust-analyzer-rs/563918kfdqef84tz.ll
-3 rustfmt-rs/3xcdaapyewyrfogi.ll
-3 wireshark/packet-gtpv2.ll
-3 zed-rs/d31g6vudldcq1cl7b9cowxr8a.ll
-4 openjdk/vmIntrinsics.ll
-5 ffmpeg/vaapi_vc1.ll
-5 zxing/ODCode128Writer.ll
-6 abseil-cpp/cpu_detect.ll
-6 c3c/codegen_general.ll
-6 cpp-httplib/httplib.ll
-6 git/git-zlib.ll
-6 hermes/TargetParser.ll
-6 icu/tzrule.ll
-6 libigl/insert_into_cdt.ll
-6 mini-lsm-rs/3jirohyl4so2bgw0.ll
-6 mini-lsm-rs/a97dpb4syxv4ifo.ll
-6 ncnn/softmax_x86_avx.ll
-6 node/libnode.session.ll
-6 openjdk/vectornode.ll
-6 php/type.ll
-6 pola-rs/dfnuuwew9rjefyx0hf8efvszi.ll
-6 sdl/SDL_joystick.ll
-6 wasmtime-rs/16qf4j2oevjc61uc.ll
-6 wasmtime-rs/5hz2o78ldf0tu4d.ll
-7 duckdb/ub_duckdb_common.ll
-8 coreutils-rs/yeky3kbm8zdu7bp.ll
-9 clamav/libfreshclam.ll
-9 eastl/TestBitset.ll
-9 fish-rs/c38lur5pw95ohzh85gfwxtm3n.ll
-9 glslang/ParseHelper.ll
-9 meilisearch-rs/dbiolt81vho6nnb.ll
-9 mold/filetype.cc.X86_64.ll
-9 ncnn/softmax_x86_avx512.ll
-9 oiio/argparse.ll
-9 opencv/floodfill.ll
-9 yosys/smtlib.ll
-9 zed-rs/055l6m6wb4e4jq2j59cjsdkaz.ll
-12 abc/giaGig.ll
-12 assimp/JoinVerticesProcess.ll
-12 boost/self_intersection_points.ll
-12 glslang/SPVRemapper.ll
-12 hyperscan/ng_som.ll
-12 ockam-rs/8g2r22yshp3qi00.ll
-12 openusd/instanceAdapter.ll
-18 grpc/jwt_verifier.ll
-24 hdf5/H5SL.ll

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Here's a concise summary of the major changes in this LLVM IR diff:

  1. Switch Case Target Updates: Multiple switch instructions had their default or case targets updated to point to newly merged or renamed basic blocks (e.g., .split62.us.thread now used for both i32 3 and 4 cases in bzlib.ll; fc_strerror.exit.loopexit272fc_strerror.exit.loopexit279 in clamav.ll). This reflects CFG simplification or block merging.

  2. Dead/Redundant Block Elimination: Several trivial forwarding blocks were removed, including unconditional br-only blocks like .split65.us.thread, .fold.split38, and ..critedge_crit_edge16.i.i.i. Their predecessors now branch directly to the ultimate destination (e.g., .noexc124, %_ZN5boost9iteratorsne...exit.thread), reducing control flow overhead.

  3. Phi Node & Predecessor List Refinement: PHI nodes in merge points (e.g., isempty_RL.exit.thread, .noexc124, .critedge) were updated to reflect the new set of predecessors—removing entries for deleted blocks and adding entries for newly added predecessors (e.g., %_ZNK10aiVector3tIfEltERKS0_.exit.i now feeds .noexc124). This ensures correctness after CFG restructuring.

  4. Switch-to-Compare Conversion: In duckdb.ll, two switch i8 instructions (checking for 37 and 43) were replaced with explicit icmp eq + br i1 sequences. This likely enables better optimization (e.g., constant folding, predicate analysis) and avoids switch table overhead for small, sparse cases.

  5. Exception Handling & Cleanup Path Simplification: In grpc.ll, multiple __throw_bad_variant_access exit blocks (e.g., _ZSt26__throw_bad_variant_accessb.exit.i.i.i44.i) were merged into a single shared target (%_ZSt26__throw_bad_variant_accessb.exit.i.i.i39.i), reducing duplication and streamlining exception dispatch paths.

These changes collectively indicate aggressive CFG cleanup, dead code elimination, and canonicalization—typical of late-stage optimizations like -O3 or LTO, aimed at improving both compile-time efficiency and runtime performance.

model: qwen-plus-latest
CompletionUsage(completion_tokens=512, prompt_tokens=108446, total_tokens=108958, completion_tokens_details=None, prompt_tokens_details=None)

@Camsyn

Camsyn commented Mar 5, 2026

Copy link
Copy Markdown

No new regression was introduced compared with #3204.

@Camsyn

Camsyn commented Mar 5, 2026

Copy link
Copy Markdown

/close

@github-actions github-actions Bot closed this Mar 5, 2026
@dtcxzyw
dtcxzyw deleted the test-run22711182409 branch March 5, 2026 16:59
Camsyn added a commit to llvm/llvm-project that referenced this pull request Mar 12, 2026
When >1 predecessors of BB are identical, try to merge them into ONE.


---

Here is a simplified example (`sink` and `bb*`s share the same
predecessor `entry`, hindering the existing uncond br folding to
optimize such a case):
```diff
- entry:
-   switch to %br1, %br2, %br3, %sink
- bb1:
-   br label %sink
- bb2:
-   br label %sink
- bb3:
-   br label %sink
- sink:
-   %ret = phi i8 [ 0, %bb1 ], [ 0, %bb2 ], [ 0, %bb3 ], [ -1, %entry ]
+ entry:
+   switch to %br1, %sink
+ bb1:
+   br label %sink
+ sink:
+   %ret = phi i8 [ 0, %bb1 ], [ -1, %entry ]
```

Actually, `simplifyDuplicateSwitchArms` did similar things in a very
limited scope (only for switch arms), this patch generalizes its logic
to handle any BB with >1 identical predecessors.

---


This PR lands the
[discussion](dtcxzyw/llvm-opt-benchmark#3033 (comment)),
i.e., "merge identical predecessor bottom to up", and implements the
suggestion of
#114262 (comment).

- IR diff: dtcxzyw/llvm-opt-benchmark#3537
- CompTime Impact:
dtcxzyw/llvm-opt-benchmark#3538
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Mar 12, 2026
When >1 predecessors of BB are identical, try to merge them into ONE.

---

Here is a simplified example (`sink` and `bb*`s share the same
predecessor `entry`, hindering the existing uncond br folding to
optimize such a case):
```diff
- entry:
-   switch to %br1, %br2, %br3, %sink
- bb1:
-   br label %sink
- bb2:
-   br label %sink
- bb3:
-   br label %sink
- sink:
-   %ret = phi i8 [ 0, %bb1 ], [ 0, %bb2 ], [ 0, %bb3 ], [ -1, %entry ]
+ entry:
+   switch to %br1, %sink
+ bb1:
+   br label %sink
+ sink:
+   %ret = phi i8 [ 0, %bb1 ], [ -1, %entry ]
```

Actually, `simplifyDuplicateSwitchArms` did similar things in a very
limited scope (only for switch arms), this patch generalizes its logic
to handle any BB with >1 identical predecessors.

---

This PR lands the
[discussion](dtcxzyw/llvm-opt-benchmark#3033 (comment)),
i.e., "merge identical predecessor bottom to up", and implements the
suggestion of
llvm/llvm-project#114262 (comment).

- IR diff: dtcxzyw/llvm-opt-benchmark#3537
- CompTime Impact:
dtcxzyw/llvm-opt-benchmark#3538
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants