Skip to content

JIT: Tail-merge don't produce empty blocks#129092

Open
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:tail-merge-remove-blocks
Open

JIT: Tail-merge don't produce empty blocks#129092
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:tail-merge-remove-blocks

Conversation

@BoyBaykiller
Copy link
Copy Markdown
Contributor

I had an other change for improving the crossJumpVictim selection logic in tail-merge, but it had random regressions because downstream phases get confused depending on where empty blocks are. This PR stops producing empty blocks in tail-merge which fixes that.
It also makes sense given how we are running directly after "optimize control flow" phase which just got rid of all empty blocks.

@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 7, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 7, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@BoyBaykiller
Copy link
Copy Markdown
Contributor Author

BoyBaykiller commented Jun 7, 2026

This itself has some interesting regressions related to how the backend deals with the block layout.
Particularly arround bbWeight=0 and BBJ_RETURN it seems, but haven't looked deeply.

I see cases like this where we get weird unnecessary jumps.

G_M48648_IG02:  ;; offset=0x0000
       vucomiss xmm0, xmm1
       jp       SHORT G_M48648_IG03
       je       SHORT G_M48648_IG08
						;; size=8 bbWeight=1 PerfScore 4.00
G_M48648_IG03:  ;; offset=0x0008
       vucomiss xmm0, xmm0
       jp       SHORT G_M48648_IG04
       vucomiss xmm0, xmm1
       jbe      SHORT G_M48648_IG07
						;; size=12 bbWeight=1 PerfScore 6.00
G_M48648_IG04:  ;; offset=0x0014
       vmovaps  xmm1, xmm0
						;; size=4 bbWeight=1 PerfScore 0.25
G_M48648_IG05:  ;; offset=0x0018
       vmovaps  xmm0, xmm1
						;; size=4 bbWeight=1 PerfScore 0.25
G_M48648_IG06:  ;; offset=0x001C
       ret      
						;; size=1 bbWeight=1 PerfScore 1.00
G_M48648_IG07:  ;; offset=0x001D
       jmp      SHORT G_M48648_IG05
						;; size=2 bbWeight=0 PerfScore 0.00
G_M48648_IG08:  ;; offset=0x001F
       vmovd    eax, xmm1
       test     eax, eax
       jl       SHORT G_M48648_IG04
       jmp      SHORT G_M48648_IG07
						;; size=10 bbWeight=0 PerfScore 0.00

@BoyBaykiller
Copy link
Copy Markdown
Contributor Author

@AndyAyersMS PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant