Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: af928c6a98558897edda9f81da2080c7881b7e01
      
https://github.com/WebKit/WebKit/commit/af928c6a98558897edda9f81da2080c7881b7e01
  Author: Dan Hecht <[email protected]>
  Date:   2025-11-11 (Tue, 11 Nov 2025)

  Changed paths:
    M Source/JavaScriptCore/b3/air/AirAllocateRegistersByGreedy.cpp

  Log Message:
  -----------
  [JSC] GreedyRegAlloc: remove dead defs of remateralized spilled Tmps
https://bugs.webkit.org/show_bug.cgi?id=302335
rdar://164491860

Reviewed by Yusuke Suzuki.

If a Tmp has only one def and that def is an integer constant, then
the register allocator inserts rematerializations of that constant
at each use rather than loading from the spill slot. However, that
constant def instruction survives as does the store to the
spill slot.

The spill slot store was being removed by the stack slot allocation
pass, however the instruction that moves the constant to register
remains, and we have no pass that removes it.

So, let's add some smarts to the register allocator so that if this
constant def instruction is no longer needed:
1. The original def instruction is removed
2. The unspillable Tmp used to store that constant to the stack is never
   created.
3. The store spill instruction to stack is never inserted.

Points 1 & 2 are new, and 2 can be important as it can reduce register
pressure in situations where we already know we have pressure.

Note that we don't perform this when the Tmp has cold uses since cold uses
are not rematerialized. The cold arg most likely needs to be on the
stack anyway.

Testing: covered by existing JSC stress tests
Canonical link: https://commits.webkit.org/302864@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to