Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e0d2a13f551fe60f4893b41479de31884fe84751
      
https://github.com/WebKit/WebKit/commit/e0d2a13f551fe60f4893b41479de31884fe84751
  Author: Yijia Huang <yijia_hu...@apple.com>
  Date:   2025-01-06 (Mon, 06 Jan 2025)

  Changed paths:
    A JSTests/stress/loop-unrolling-branch.js
    M Source/JavaScriptCore/dfg/DFGLoopUnrollingPhase.cpp

  Log Message:
  -----------
  [JSC] Loop unrolling phase should inverse the condition if needed before 
computing the iteration count
https://bugs.webkit.org/show_bug.cgi?id=285473
rdar://142439066

Reviewed by Yusuke Suzuki.

Previously, loop unrolling failed to handle cases where the loop's
"not taken" branch pointed back into the loop, requiring condition
inversion. This led to incorrect comparisons, invalid iteration
counts, and missed optimization opportunities.

This fix introduces `inverseCondition` to track whether the condition
needs inversion and updates `comparisonFunction` to apply the correct
comparison logic dynamically. It improves robustness, ensures accurate
unrolling for complex branching structures, and adds better debug information.

* JSTests/stress/loop-unrolling-branch.js: Added.
* Source/JavaScriptCore/dfg/DFGLoopUnrollingPhase.cpp:
(JSC::DFG::LoopUnrollingPhase::LoopData::condition const):
(JSC::DFG::LoopUnrollingPhase::locateTail):
(JSC::DFG::LoopUnrollingPhase::identifyInductionVariable):
(JSC::DFG::LoopUnrollingPhase::LoopData::dump const):
(JSC::DFG::LoopUnrollingPhase::comparisonFunction):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to