Skip to content

Conversation

@zyw-bot
Copy link
Collaborator

@zyw-bot zyw-bot commented Dec 23, 2025

Link: llvm/llvm-project#173022

Requested by: @Camsyn

@github-actions github-actions bot mentioned this pull request Dec 23, 2025
@zyw-bot
Copy link
Collaborator Author

zyw-bot commented Dec 23, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@f788216
patch: llvm/llvm-project#173022
sha256: ee9f9590a3a1aa9e00eceb59f13647cde1a6bf2dd320ed6c0066d4aa3a4a082a
commit: 8be37ca

2704 files changed, 644161 insertions(+), 651408 deletions(-)

Improvements:
  simplifycfg.NumFoldValueComparisonIntoPredecessors 512837 -> 514357 +0.30%
  simplifycfg.NumSpeculations 395946 -> 396559 +0.15%
  simplifycfg.NumLinearMaps 4240 -> 4246 +0.14%
  simple-loop-unswitch.NumSwitches 1736 -> 1737 +0.06%
  simplifycfg.NumFoldBranchToCommonDest 747848 -> 748211 +0.05%
  dse.NumCFGChecks 635250 -> 635532 +0.04%
  instcombine.NegatorNumNegationsFoundInCache 4018 -> 4019 +0.02%
  instcount.NumSwitchInst 624511 -> 624625 +0.02%
  instcount.NumExtractElementInst 55388 -> 55394 +0.01%
  tailcallelim.NumRetDuped 15557 -> 15558 +0.01%
Regressions:
  simplifycfg.NumBitMaps 2244 -> 2238 -0.27%
  simplifycfg.NumLookupTablesHoles 2395 -> 2393 -0.08%
  loop-simplify.NumNested 11680 -> 11674 -0.05%
  move-auto-init.NumMoved 2502 -> 2501 -0.04%
  simple-loop-unswitch.NumSelects 2551 -> 2550 -0.04%
  memdep.NumCacheDirtyNonLocalPtr 22164 -> 22157 -0.03%
  licm.NumBOAssociationsHoisted 3514 -> 3513 -0.03%
  simplifycfg.NumHoistCommonInstrs 2507750 -> 2507039 -0.03%
  correlated-value-propagation.NumAddNSW 216351 -> 216301 -0.02%
  correlated-value-propagation.NumPhiCommon 52041 -> 52029 -0.02%

+29 box2d/distance.ll
+15 lief/psa_crypto_mac.ll
+14 hwloc/lstopo-ascii.ll
+5 zed-rs/bktyyhuk5fekatq647qx0ox8v.ll
+3 hermes/BlockScopingTransformations.ll
+3 influxdb-rs/26y592k8de9dg2n1.ll
+3 meilisearch-rs/2bqmf34tdvo23w8l.ll
+3 ockam-rs/23pvw3nj6m0p9wnd.ll
+3 ockam-rs/2ngtaq92gcad4v6j.ll
+3 rust-analyzer-rs/1yf6pyfk8ihkfv63.ll
+2 zed-rs/25fxlhz3kxu1eqndtge46j52s.ll
+1 grpc/ssl_utils.ll
+1 openjdk/shenandoahSupport.ll
+1 pola-rs/1rsrmy2r4dk76n6ayk75n7qe2.ll
-1 arrow/metadata_internal.ll
-1 darktable/sqliteicu.ll
-1 opencv/trackerBoostingModel.ll
-2 wasmi-rs/5j8r45rfbax70rfnan7wcjxtw.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 just-rs/1uppz7l1e89fp8n7.ll
-3 just-rs/xt6bvrk4jdo7mpy.ll
-3 libevent/evutil.ll
-3 libuv/tty.ll
-3 luau/ldebug.ll
-3 minetest/mapnode.ll
-3 mold/passes.cc.X86_64.ll
-3 openusd/TestPcpDynamicFileFormatPlugin.ll
-3 php/html.ll
-3 php/simplexml.ll
-3 proj/conversion.ll
-3 proxygen/http_parser_cpp.ll
-3 recastnavigation/catch_amalgamated.ll
-3 ruby/prism.ll
-3 rustfmt-rs/3xcdaapyewyrfogi.ll
-3 wireshark/packet-gtpv2.ll
-4 ruff-rs/17peh9ovw3u407gepgedp0k6w.ll
-6 abseil-cpp/cpu_detect.ll
-6 c3c/codegen_general.ll
-6 cpp-httplib/httplib.ll
-6 git/git-zlib.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 php/type.ll
-6 pola-rs/dfnuuwew9rjefyx0hf8efvszi.ll
-6 typst-rs/d6l9ieo9tcw33dn.ll
-6 wasmtime-rs/16qf4j2oevjc61uc.ll
-7 image-rs/1clnprdgqfw2q9lq.ll
-8 coreutils-rs/yeky3kbm8zdu7bp.ll
-8 uv-rs/04k1g14qovgvvxh8xugi869y8.ll
-8 wasmedge/controlInstr.ll
-9 clamav/libfreshclam.ll
-9 cpython/xmltok.ll
-9 eastl/TestBitset.ll
-9 meilisearch-rs/dbiolt81vho6nnb.ll
-9 mold/filetype.cc.X86_64.ll
-9 ncnn/softmax_x86_avx512.ll
-9 yosys/smtlib.ll
-9 zed-rs/055l6m6wb4e4jq2j59cjsdkaz.ll
-12 abc/giaGig.ll
-12 assimp/JoinVerticesProcess.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
Copy link
Contributor

Here's a concise summary of the major changes in the patch:

  1. Switch Target Updates: Multiple switch instructions had their default case targets updated (e.g., %.split62.us.thread%.split65.us.thread in bzlib.ll, %.loopexit.loopexit%.fold.split in giaGig.ll). This reflects restructured control flow, likely due to optimization passes reordering or merging basic blocks.

  2. Basic Block Merging and Cleanup: Several redundant blocks were removed or merged—e.g., .split62.us.thread, .fold.split38, .fold.split39, and .fold.split40 were deleted in giaGig.ll, with their predecessors redirected to shared exit points like .fold.split. Similar cleanup occurred in clamav, coreutils-rs, and xmltok.

  3. Phi Node Adjustments: PHI nodes in merge points (e.g., isempty_RL.exit.thread, fc_strerror.exit, b2ComputeSimplexWitnessPoints.exit) were updated to reflect new predecessor lists and correct value mapping—often removing stale entries and reordering operands to match revised control flow.

  4. Alignment Improvements: In box2d, multiple memory operations (load, store, alloca, memcpy) had alignment specifiers increased from 4 to 8 bytes for float, <2 x float>, and %struct.b2Simplex, improving memory access efficiency on aligned data.

  5. Control Flow Simplification: Several functions saw reduction in edge complexity: e.g., ssl_connect_or_accept_nonblocking in cpp-httplib consolidated critical edges; property_get___isabstractmethod__ in cpython simplified nested conditionals by flattening branches and updating switch labels and phi inputs.

These changes collectively reflect aggressive IR-level optimizations—particularly CFG simplification, dead block elimination, alignment-aware codegen, and precise phi maintenance—across diverse codebases.

model: qwen-plus-latest
CompletionUsage(completion_tokens=418, prompt_tokens=108432, total_tokens=108850, completion_tokens_details=None, prompt_tokens_details=None)

i32 3, label %226
i32 1, label %210
i32 2, label %213
]
Copy link

@Camsyn Camsyn Dec 24, 2025

Choose a reason for hiding this comment

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

correlated-propagation is sensitive to the difference in PHI incoming value order, causing such regression.

original: LVI infered that %212 ∈ [4,3)

%212 = phi i32 [ 1, %b2SolveSimplex2.exit.thread.thread ], [ 2, %203 ], [ %202, %b2SolveSimplex2.exit ]
  1. init: from pred %b2SolveSimplex2.exit.thread.thread ], %212 ∈ [1, 2)
  2. merge: from pred %203, %212 ∈ [1, 3) = [1,2) ∪ [2, 3)
  3. merge: from pred %b2SolveSimplex2.exit, %212 ∈ [4, 3) = [1, 3) ∪ [4, 1)
    • %b2SolveSimplex2.exit is switch default with arms 1, 2, 3, thus we can infer that %202 ∈ [4, 1)
  4. finally: %212 ∈ [4, 3), i.e., %212 != 3

new: : LVI infered that %212 = overdefined

%212 = phi i32 [ 2, %203 ], [ %202, %b2SolveSimplex2.exit ], [ 1, %b2SolveSimplex2.exit.thread.thread ]
  1. init: from pred %b2SolveSimplex2.exit.thread.thread ], %212 ∈ [2, 3)
  2. merge: from pred %b2SolveSimplex2.exit, %212 ∈ [2,1) = [2, 3) ∪ [4, 1)
    • %b2SolveSimplex2.exit is switch default with arms 1, 2, 3, thus we can infer that %202 ∈ [4, 1)
  3. merge: from pred %203, %212 = overdefined = [2,1) ∪ [1,2)
  4. finally: %212 = overdefined

Comment on lines +164 to +178
switch.edge80.i: ; preds = %30
br label %.thread93.i

.fold.split77.i: ; preds = %30
br label %.thread93.i

.fold.split78.i: ; preds = %30
br label %.thread93.i

.fold.split79.i: ; preds = %30
br label %.thread93.i

.fold.split81.i: ; preds = %30, %30, %30, %30
br label %.thread93.i

Copy link

@Camsyn Camsyn Dec 24, 2025

Choose a reason for hiding this comment

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

These arms should have been folded into a switch table lookup by `simplifycfg.

Comment on lines +1036 to +1038
%41 = and i32 %4, 3
%42 = xor i32 %41, 3
%43 = or i32 %42, %3
Copy link

Choose a reason for hiding this comment

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

These are speculative insns, which could not be sunk by simplifycfg<sink-common-insts>

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