Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b2a5db1e5138d9ee9a25d35696ed8149d47d97ba
      
https://github.com/WebKit/WebKit/commit/b2a5db1e5138d9ee9a25d35696ed8149d47d97ba
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-10-13 (Tue, 13 Oct 2026)

  Changed paths:
    A JSTests/wasm/stress/struct-get-forwarding-across-dead-arm.js
    M Source/JavaScriptCore/b3/B3ReduceStrength.cpp
    M Source/JavaScriptCore/b3/testb3.h
    M Source/JavaScriptCore/b3/testb3_1.cpp
    M Source/JavaScriptCore/b3/testb3_4.cpp

  Log Message:
  -----------
  [JSC] Fold Phis during the B3 ReduceStrength walk and drop the second value 
walk
https://bugs.webkit.org/show_bug.cgi?id=326678
rdar://189414617

Reviewed by Dan Hecht.

B3 ReduceStrength's second walk is largely for `Phi` folding which can
be seen due to dropping Branch's edge. This patch does this Phi
optimization much more incrementally while visiting values so that we
avoid the second iteration of ReduceStrength.

We detect unreachable blocks by checking predecessor's visiting state.
Then we remove Upsilon from them, and making Phi simplification work.

* JSTests/wasm/stress/struct-get-forwarding-across-dead-arm.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.const.wat.module.type.S.struct.field.mut.i32.func.export.string_appeared_here.param.value.i32.result.ref.S.struct.new.S.local.value.func.deadArm.param.s.ref.S.param.x.i32.result.i32.local.t.i32.local.t.struct.S.0.local.s.i32.and.local.x.i32.const.0.then.struct.S.0.local.s.i32.add.local.t.i32.const.1.i32.add.local.t.struct.S.0.local.s.func.liveArm.param.s.ref.S.param.x.i32.result.i32.local.t.i32.local.t.struct.S.0.local.s.i32.and.local.x.i32.const.1.then.struct.S.0.local.s.i32.add.local.t.i32.const.1.i32.add.local.t.struct.S.0.local.s.func.foldedArm.param.s.ref.S.param.x.i32.result.i32.local.t.i32.local.t.struct.S.0.local.s.i32.or.local.x.i32.const.1.then.struct.S.0.local.s.i32.const.5.i32.add.local.t.struct.S.0.local.s.func.export.string_appeared_here.param.s.ref.S.param.n.i32.result.i32.local.i.i32.local.acc.i32.loop.l.local.acc.i32.add.local.acc.call.deadArm.local.s.local.i.local.i.i32.add.local.i.i32.const.1.br_if.l.i32.lt_u.local.i.local.n.local.acc.func.export.string_appeared_here.param.s.ref.S.param.n.i32.result.i32.local.i.i32.local.acc.i32.loop.l.local.acc.i32.add.local.acc.call.liveArm.local.s.local.i.local.i.i32.add.local.i.i32.const.1.br_if.l.i32.lt_u.local.i.local.n.local.acc.func.export.string_appeared_here.param.s.ref.S.param.n.i32.result.i32.local.i.i32.local.acc.i32.loop.l.local.acc.i32.add.local.acc.call.foldedArm.local.s.local.i.local.i.i32.add.local.i.i32.const.1.br_if.l.i32.lt_u.local.i.local.n.local.acc.async
 test):
* Source/JavaScriptCore/b3/B3ReduceStrength.cpp:
* Source/JavaScriptCore/b3/testb3.h:
* Source/JavaScriptCore/b3/testb3_1.cpp:
(run):
* Source/JavaScriptCore/b3/testb3_4.cpp:
(valueCount):
(onlyReturnedValue):
(testPhiFoldChain):
(testPhiFoldKeepsUpsilonBeforeFoldedBranch):
(testPhiFoldUpsilonAwayFromJoin):
(testPhiFoldLoopUnderConstantBranch):
(testPhiFoldLoopInvariantPhis):
(testPhiFoldDeadLoopSelfReference):
(testPhiFoldDeadIrreducibleCycle):
(testPhiFoldDeadLoopFeedingBranch):
(setReturn42Generator):
(testPhiFoldCheckAlwaysExitsBeforePhi):
(testPhiFoldEqualConstantFromBackEdge):
(testPhiFoldDeadLoopWithStalePredecessor):
(testPhiFoldConstantInBlockReachedOnlyByRetreatingEdge):
(testPhiFoldInBlockReachedOnlyByRetreatingEdge):
(testPhiFoldDeadLoopHeaderEnteredFromRoot):
(testPhiFoldLoopPhiTrivialAfterLatch):

Canonical link: https://commits.webkit.org/323635@main



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

Reply via email to