diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts
index 1cd789cb874d2..75f3086011fd0 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts
+++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts
@@ -223,7 +223,7 @@ const EnvironmentConfigSchema = z.object({
*/
enableUseTypeAnnotations: z.boolean().default(false),
- enablePropagateDepsInHIR: z.boolean().default(true),
+ enablePropagateDepsInHIR: z.boolean().default(false),
/**
* Enables inference of optional dependency chains. Without this flag
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md
index 2623806ba9534..c34b79a848ba8 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md
@@ -2,7 +2,7 @@
## Input
```javascript
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
function Component(props) {
const data = useMemo(() => {
return props?.items.edges?.nodes.map();
@@ -15,7 +15,7 @@ function Component(props) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
function Component(props) {
const $ = _c(4);
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.js
index bbccbab90e2dd..d82d36b547970 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.js
@@ -1,4 +1,4 @@
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
function Component(props) {
const data = useMemo(() => {
return props?.items.edges?.nodes.map();
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.expect.md
index e61d8d5b3919d..98fcfbe7f0f6f 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.expect.md
@@ -2,7 +2,7 @@
## Input
```javascript
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
@@ -19,7 +19,7 @@ function Component(props) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import { ValidateMemoization } from "shared-runtime";
function Component(props) {
const $ = _c(2);
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.js
index cf8d17b60fe0d..563b0bbf0f418 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.js
@@ -1,4 +1,4 @@
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md
index a153c3d046595..46767056bdcdf 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md
@@ -2,7 +2,7 @@
## Input
```javascript
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
@@ -19,7 +19,7 @@ function Component(props) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import { ValidateMemoization } from "shared-runtime";
function Component(props) {
const $ = _c(7);
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.js
index 0a9d9bd9af247..8e6275bf921eb 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.js
@@ -1,4 +1,4 @@
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md
index f7091dc8dcd6a..a4cf6d767d1c3 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md
@@ -2,7 +2,7 @@
## Input
```javascript
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
@@ -18,7 +18,7 @@ function Component(props) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import { ValidateMemoization } from "shared-runtime";
function Component(props) {
const $ = _c(7);
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.js
index 4e7268e1bf9e1..5750d7af3a0e0 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.js
@@ -1,4 +1,4 @@
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md
index c8069ea47d27c..77ded20d939bd 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md
@@ -2,7 +2,7 @@
## Input
```javascript
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
@@ -23,7 +23,7 @@ function Component(props) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import { ValidateMemoization } from "shared-runtime";
function Component(props) {
const $ = _c(9);
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.js
index 2245a700f2e6c..760f345e90210 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.js
@@ -1,4 +1,4 @@
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md
index df498e0ad06aa..10c23085d8e6b 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md
@@ -2,7 +2,7 @@
## Input
```javascript
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
@@ -23,7 +23,7 @@ function Component(props) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import { ValidateMemoization } from "shared-runtime";
function Component(props) {
const $ = _c(9);
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.js
index 006e516ae546e..3f773f4fe4e4b 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.js
@@ -1,4 +1,4 @@
-// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR:false
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies
import {ValidateMemoization} from 'shared-runtime';
function Component(props) {
const data = useMemo(() => {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md
new file mode 100644
index 0000000000000..4c4eee6cb5fa2
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md
@@ -0,0 +1,48 @@
+
+## Input
+
+```javascript
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+function Component(props) {
+ const data = useMemo(() => {
+ return props?.items.edges?.nodes.map();
+ }, [props?.items.edges?.nodes]);
+ return ;
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+function Component(props) {
+ const $ = _c(4);
+
+ props?.items.edges?.nodes;
+ let t0;
+ let t1;
+ if ($[0] !== props?.items.edges?.nodes) {
+ t1 = props?.items.edges?.nodes.map();
+ $[0] = props?.items.edges?.nodes;
+ $[1] = t1;
+ } else {
+ t1 = $[1];
+ }
+ t0 = t1;
+ const data = t0;
+ let t2;
+ if ($[2] !== data) {
+ t2 = ;
+ $[2] = data;
+ $[3] = t2;
+ } else {
+ t2 = $[3];
+ }
+ return t2;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.js
new file mode 100644
index 0000000000000..6ff87d0c46329
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.js
@@ -0,0 +1,7 @@
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+function Component(props) {
+ const data = useMemo(() => {
+ return props?.items.edges?.nodes.map();
+ }, [props?.items.edges?.nodes]);
+ return ;
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.expect.md
new file mode 100644
index 0000000000000..60ae4e49d328c
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.expect.md
@@ -0,0 +1,46 @@
+
+## Input
+
+```javascript
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.a.b?.c.d?.e);
+ x.push(props.a?.b.c?.d.e);
+ return x;
+ }, [props.a.b.c.d.e]);
+ return ;
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import { ValidateMemoization } from "shared-runtime";
+function Component(props) {
+ const $ = _c(2);
+ let t0;
+
+ const x$0 = [];
+ x$0.push(props?.a.b?.c.d?.e);
+ x$0.push(props.a?.b.c?.d.e);
+ t0 = x$0;
+ let t1;
+ if ($[0] !== props.a.b.c.d.e) {
+ t1 = ;
+ $[0] = props.a.b.c.d.e;
+ $[1] = t1;
+ } else {
+ t1 = $[1];
+ }
+ return t1;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.js
new file mode 100644
index 0000000000000..091912f957370
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.js
@@ -0,0 +1,11 @@
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.a.b?.c.d?.e);
+ x.push(props.a?.b.c?.d.e);
+ return x;
+ }, [props.a.b.c.d.e]);
+ return ;
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md
new file mode 100644
index 0000000000000..b4a55fcb61eee
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md
@@ -0,0 +1,62 @@
+
+## Input
+
+```javascript
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ x.push(props.items);
+ return x;
+ }, [props.items]);
+ return ;
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import { ValidateMemoization } from "shared-runtime";
+function Component(props) {
+ const $ = _c(7);
+ let t0;
+ let x;
+ if ($[0] !== props.items) {
+ x = [];
+ x.push(props?.items);
+ x.push(props.items);
+ $[0] = props.items;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ t0 = x;
+ const data = t0;
+ let t1;
+ if ($[2] !== props.items) {
+ t1 = [props.items];
+ $[2] = props.items;
+ $[3] = t1;
+ } else {
+ t1 = $[3];
+ }
+ let t2;
+ if ($[4] !== t1 || $[5] !== data) {
+ t2 = ;
+ $[4] = t1;
+ $[5] = data;
+ $[6] = t2;
+ } else {
+ t2 = $[6];
+ }
+ return t2;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.js
new file mode 100644
index 0000000000000..a3f8ba41bd886
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.js
@@ -0,0 +1,11 @@
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ x.push(props.items);
+ return x;
+ }, [props.items]);
+ return ;
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md
new file mode 100644
index 0000000000000..73bac78f93bea
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md
@@ -0,0 +1,63 @@
+
+## Input
+
+```javascript
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ return x;
+ }, [props?.items]);
+ return ;
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import { ValidateMemoization } from "shared-runtime";
+function Component(props) {
+ const $ = _c(7);
+
+ props?.items;
+ let t0;
+ let x;
+ if ($[0] !== props?.items) {
+ x = [];
+ x.push(props?.items);
+ $[0] = props?.items;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ t0 = x;
+ const data = t0;
+ const t1 = props?.items;
+ let t2;
+ if ($[2] !== t1) {
+ t2 = [t1];
+ $[2] = t1;
+ $[3] = t2;
+ } else {
+ t2 = $[3];
+ }
+ let t3;
+ if ($[4] !== t2 || $[5] !== data) {
+ t3 = ;
+ $[4] = t2;
+ $[5] = data;
+ $[6] = t3;
+ } else {
+ t3 = $[6];
+ }
+ return t3;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.js
new file mode 100644
index 0000000000000..535a0ce074419
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.js
@@ -0,0 +1,10 @@
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ return x;
+ }, [props?.items]);
+ return ;
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional-optional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional-optional.expect.md
new file mode 100644
index 0000000000000..59db7ab3c3426
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional-optional.expect.md
@@ -0,0 +1,74 @@
+
+## Input
+
+```javascript
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ if (props.cond) {
+ x.push(props?.items);
+ }
+ return x;
+ }, [props?.items, props.cond]);
+ return (
+
+ );
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import { ValidateMemoization } from "shared-runtime";
+function Component(props) {
+ const $ = _c(9);
+
+ props?.items;
+ let t0;
+ let x;
+ if ($[0] !== props?.items || $[1] !== props.cond) {
+ x = [];
+ x.push(props?.items);
+ if (props.cond) {
+ x.push(props?.items);
+ }
+ $[0] = props?.items;
+ $[1] = props.cond;
+ $[2] = x;
+ } else {
+ x = $[2];
+ }
+ t0 = x;
+ const data = t0;
+
+ const t1 = props?.items;
+ let t2;
+ if ($[3] !== t1 || $[4] !== props.cond) {
+ t2 = [t1, props.cond];
+ $[3] = t1;
+ $[4] = props.cond;
+ $[5] = t2;
+ } else {
+ t2 = $[5];
+ }
+ let t3;
+ if ($[6] !== t2 || $[7] !== data) {
+ t3 = ;
+ $[6] = t2;
+ $[7] = data;
+ $[8] = t3;
+ } else {
+ t3 = $[8];
+ }
+ return t3;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional-optional.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional-optional.js
new file mode 100644
index 0000000000000..b2ae1032b27a1
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional-optional.js
@@ -0,0 +1,15 @@
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ if (props.cond) {
+ x.push(props?.items);
+ }
+ return x;
+ }, [props?.items, props.cond]);
+ return (
+
+ );
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional.expect.md
new file mode 100644
index 0000000000000..8d656e231aa3f
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional.expect.md
@@ -0,0 +1,74 @@
+
+## Input
+
+```javascript
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ if (props.cond) {
+ x.push(props.items);
+ }
+ return x;
+ }, [props?.items, props.cond]);
+ return (
+
+ );
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import { ValidateMemoization } from "shared-runtime";
+function Component(props) {
+ const $ = _c(9);
+
+ props?.items;
+ let t0;
+ let x;
+ if ($[0] !== props?.items || $[1] !== props.cond) {
+ x = [];
+ x.push(props?.items);
+ if (props.cond) {
+ x.push(props.items);
+ }
+ $[0] = props?.items;
+ $[1] = props.cond;
+ $[2] = x;
+ } else {
+ x = $[2];
+ }
+ t0 = x;
+ const data = t0;
+
+ const t1 = props?.items;
+ let t2;
+ if ($[3] !== t1 || $[4] !== props.cond) {
+ t2 = [t1, props.cond];
+ $[3] = t1;
+ $[4] = props.cond;
+ $[5] = t2;
+ } else {
+ t2 = $[5];
+ }
+ let t3;
+ if ($[6] !== t2 || $[7] !== data) {
+ t3 = ;
+ $[6] = t2;
+ $[7] = data;
+ $[8] = t3;
+ } else {
+ t3 = $[8];
+ }
+ return t3;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional.js
new file mode 100644
index 0000000000000..aa1997022207a
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-with-conditional.js
@@ -0,0 +1,15 @@
+// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR
+import {ValidateMemoization} from 'shared-runtime';
+function Component(props) {
+ const data = useMemo(() => {
+ const x = [];
+ x.push(props?.items);
+ if (props.cond) {
+ x.push(props.items);
+ }
+ return x;
+ }, [props?.items, props.cond]);
+ return (
+
+ );
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/conditional-member-expr.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/conditional-member-expr.expect.md
new file mode 100644
index 0000000000000..f13bfe7d61705
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/conditional-member-expr.expect.md
@@ -0,0 +1,53 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+// To preserve the nullthrows behavior and reactive deps of this code,
+// Forget needs to add `props.a` as a dependency (since `props.a.b` is
+// a conditional dependency, i.e. gated behind control flow)
+
+function Component(props) {
+ let x = [];
+ x.push(props.a?.b);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: null}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+// To preserve the nullthrows behavior and reactive deps of this code,
+// Forget needs to add `props.a` as a dependency (since `props.a.b` is
+// a conditional dependency, i.e. gated behind control flow)
+
+function Component(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props.a?.b) {
+ x = [];
+ x.push(props.a?.b);
+ $[0] = props.a?.b;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: null }],
+};
+
+```
+
+### Eval output
+(kind: ok) [null]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/conditional-member-expr.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/conditional-member-expr.js
new file mode 100644
index 0000000000000..447665425e7d7
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/conditional-member-expr.js
@@ -0,0 +1,15 @@
+// @enablePropagateDepsInHIR
+// To preserve the nullthrows behavior and reactive deps of this code,
+// Forget needs to add `props.a` as a dependency (since `props.a.b` is
+// a conditional dependency, i.e. gated behind control flow)
+
+function Component(props) {
+ let x = [];
+ x.push(props.a?.b);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: null}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md
new file mode 100644
index 0000000000000..733657746cc5c
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md
@@ -0,0 +1,100 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+// This tests an optimization, NOT a correctness property.
+// When propagating reactive dependencies of an inner scope up to its parent,
+// we prefer to retain granularity.
+//
+// In this test, we check that Forget propagates the inner scope's conditional
+// dependencies (e.g. props.a.b) instead of only its derived minimal
+// unconditional dependencies (e.g. props).
+// ```javascript
+// scope @0 (deps=[???] decls=[x, y]) {
+// let y = {};
+// scope @1 (deps=[props] decls=[x]) {
+// let x = {};
+// if (foo) mutate1(x, props.a.b);
+// }
+// mutate2(y, props.a.b);
+// }
+
+import {CONST_TRUE, setProperty} from 'shared-runtime';
+
+function useJoinCondDepsInUncondScopes(props) {
+ let y = {};
+ let x = {};
+ if (CONST_TRUE) {
+ setProperty(x, props.a.b);
+ }
+ setProperty(y, props.a.b);
+ return [x, y];
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useJoinCondDepsInUncondScopes,
+ params: [{a: {b: 3}}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+// This tests an optimization, NOT a correctness property.
+// When propagating reactive dependencies of an inner scope up to its parent,
+// we prefer to retain granularity.
+//
+// In this test, we check that Forget propagates the inner scope's conditional
+// dependencies (e.g. props.a.b) instead of only its derived minimal
+// unconditional dependencies (e.g. props).
+// ```javascript
+// scope @0 (deps=[???] decls=[x, y]) {
+// let y = {};
+// scope @1 (deps=[props] decls=[x]) {
+// let x = {};
+// if (foo) mutate1(x, props.a.b);
+// }
+// mutate2(y, props.a.b);
+// }
+
+import { CONST_TRUE, setProperty } from "shared-runtime";
+
+function useJoinCondDepsInUncondScopes(props) {
+ const $ = _c(4);
+ let t0;
+ if ($[0] !== props.a.b) {
+ const y = {};
+ let x;
+ if ($[2] !== props) {
+ x = {};
+ if (CONST_TRUE) {
+ setProperty(x, props.a.b);
+ }
+ $[2] = props;
+ $[3] = x;
+ } else {
+ x = $[3];
+ }
+
+ setProperty(y, props.a.b);
+ t0 = [x, y];
+ $[0] = props.a.b;
+ $[1] = t0;
+ } else {
+ t0 = $[1];
+ }
+ return t0;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useJoinCondDepsInUncondScopes,
+ params: [{ a: { b: 3 } }],
+};
+
+```
+
+### Eval output
+(kind: ok) [{"wat0":3},{"wat0":3}]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.js
new file mode 100644
index 0000000000000..950dbd187edba
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.js
@@ -0,0 +1,34 @@
+// @enablePropagateDepsInHIR
+// This tests an optimization, NOT a correctness property.
+// When propagating reactive dependencies of an inner scope up to its parent,
+// we prefer to retain granularity.
+//
+// In this test, we check that Forget propagates the inner scope's conditional
+// dependencies (e.g. props.a.b) instead of only its derived minimal
+// unconditional dependencies (e.g. props).
+// ```javascript
+// scope @0 (deps=[???] decls=[x, y]) {
+// let y = {};
+// scope @1 (deps=[props] decls=[x]) {
+// let x = {};
+// if (foo) mutate1(x, props.a.b);
+// }
+// mutate2(y, props.a.b);
+// }
+
+import {CONST_TRUE, setProperty} from 'shared-runtime';
+
+function useJoinCondDepsInUncondScopes(props) {
+ let y = {};
+ let x = {};
+ if (CONST_TRUE) {
+ setProperty(x, props.a.b);
+ }
+ setProperty(y, props.a.b);
+ return [x, y];
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useJoinCondDepsInUncondScopes,
+ params: [{a: {b: 3}}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain.expect.md
new file mode 100644
index 0000000000000..a13a918a312cb
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain.expect.md
@@ -0,0 +1,69 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+// To preserve the nullthrows behavior and reactive deps of this code,
+// Forget needs to add `props.a.b` or a subpath as a dependency.
+//
+// (1) Since the reactive block producing x unconditionally read props.a.<...>,
+// reading `props.a.b` outside of the block would still preserve nullthrows
+// semantics of source code
+// (2) Technically, props.a, props.a.b, and props.a.b.c are all reactive deps.
+// However, `props.a?.b` is only dependent on whether `props.a` is nullish,
+// not its actual value. Since we already preserve nullthrows on `props.a`,
+// we technically do not need to add `props.a` as a dependency.
+
+function Component(props) {
+ let x = [];
+ x.push(props.a?.b);
+ x.push(props.a.b.c);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: {b: {c: 1}}}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+// To preserve the nullthrows behavior and reactive deps of this code,
+// Forget needs to add `props.a.b` or a subpath as a dependency.
+//
+// (1) Since the reactive block producing x unconditionally read props.a.<...>,
+// reading `props.a.b` outside of the block would still preserve nullthrows
+// semantics of source code
+// (2) Technically, props.a, props.a.b, and props.a.b.c are all reactive deps.
+// However, `props.a?.b` is only dependent on whether `props.a` is nullish,
+// not its actual value. Since we already preserve nullthrows on `props.a`,
+// we technically do not need to add `props.a` as a dependency.
+
+function Component(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props.a.b) {
+ x = [];
+ x.push(props.a?.b);
+ x.push(props.a.b.c);
+ $[0] = props.a.b;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: { b: { c: 1 } } }],
+};
+
+```
+
+### Eval output
+(kind: ok) [{"c":1},1]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain.ts b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain.ts
new file mode 100644
index 0000000000000..6f1d99761dd46
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain.ts
@@ -0,0 +1,23 @@
+// @enablePropagateDepsInHIR
+// To preserve the nullthrows behavior and reactive deps of this code,
+// Forget needs to add `props.a.b` or a subpath as a dependency.
+//
+// (1) Since the reactive block producing x unconditionally read props.a.<...>,
+// reading `props.a.b` outside of the block would still preserve nullthrows
+// semantics of source code
+// (2) Technically, props.a, props.a.b, and props.a.b.c are all reactive deps.
+// However, `props.a?.b` is only dependent on whether `props.a` is nullish,
+// not its actual value. Since we already preserve nullthrows on `props.a`,
+// we technically do not need to add `props.a` as a dependency.
+
+function Component(props) {
+ let x = [];
+ x.push(props.a?.b);
+ x.push(props.a.b.c);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: {b: {c: 1}}}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.expect.md
new file mode 100644
index 0000000000000..df9dec4fb6827
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.expect.md
@@ -0,0 +1,56 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function Component(props) {
+ const x = [];
+ x.push(props.items?.length);
+ x.push(props.items?.edges?.map?.(render)?.filter?.(Boolean) ?? []);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{items: {edges: null, length: 0}}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function Component(props) {
+ const $ = _c(5);
+ let x;
+ if ($[0] !== props.items?.length || $[1] !== props.items?.edges) {
+ x = [];
+ x.push(props.items?.length);
+ let t0;
+ if ($[3] !== props.items?.edges) {
+ t0 = props.items?.edges?.map?.(render)?.filter?.(Boolean) ?? [];
+ $[3] = props.items?.edges;
+ $[4] = t0;
+ } else {
+ t0 = $[4];
+ }
+ x.push(t0);
+ $[0] = props.items?.length;
+ $[1] = props.items?.edges;
+ $[2] = x;
+ } else {
+ x = $[2];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ items: { edges: null, length: 0 } }],
+};
+
+```
+
+### Eval output
+(kind: ok) [0,[]]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.ts b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.ts
new file mode 100644
index 0000000000000..cc696e15d05df
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.ts
@@ -0,0 +1,12 @@
+// @enablePropagateDepsInHIR
+function Component(props) {
+ const x = [];
+ x.push(props.items?.length);
+ x.push(props.items?.edges?.map?.(render)?.filter?.(Boolean) ?? []);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{items: {edges: null, length: 0}}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md
new file mode 100644
index 0000000000000..81d972d5b9113
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md
@@ -0,0 +1,64 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+// When a conditional dependency `props.a.b.c` has no unconditional dependency
+// in its subpath or superpath, we should find the nearest unconditional access
+
+import {identity} from 'shared-runtime';
+
+// and promote it to an unconditional dependency.
+function usePromoteUnconditionalAccessToDependency(props, other) {
+ const x = {};
+ x.a = props.a.a.a;
+ if (identity(other)) {
+ x.c = props.a.b.c;
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: usePromoteUnconditionalAccessToDependency,
+ params: [{a: {a: {a: 3}}}, false],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+// When a conditional dependency `props.a.b.c` has no unconditional dependency
+// in its subpath or superpath, we should find the nearest unconditional access
+
+import { identity } from "shared-runtime";
+
+// and promote it to an unconditional dependency.
+function usePromoteUnconditionalAccessToDependency(props, other) {
+ const $ = _c(3);
+ let x;
+ if ($[0] !== props.a || $[1] !== other) {
+ x = {};
+ x.a = props.a.a.a;
+ if (identity(other)) {
+ x.c = props.a.b.c;
+ }
+ $[0] = props.a;
+ $[1] = other;
+ $[2] = x;
+ } else {
+ x = $[2];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: usePromoteUnconditionalAccessToDependency,
+ params: [{ a: { a: { a: 3 } } }, false],
+};
+
+```
+
+### Eval output
+(kind: ok) {"a":3}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.js
new file mode 100644
index 0000000000000..ef585f19ea565
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.js
@@ -0,0 +1,20 @@
+// @enablePropagateDepsInHIR
+// When a conditional dependency `props.a.b.c` has no unconditional dependency
+// in its subpath or superpath, we should find the nearest unconditional access
+
+import {identity} from 'shared-runtime';
+
+// and promote it to an unconditional dependency.
+function usePromoteUnconditionalAccessToDependency(props, other) {
+ const x = {};
+ x.a = props.a.a.a;
+ if (identity(other)) {
+ x.c = props.a.b.c;
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: usePromoteUnconditionalAccessToDependency,
+ params: [{a: {a: {a: 3}}}, false],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/repro-scope-missing-mutable-range.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/repro-scope-missing-mutable-range.expect.md
new file mode 100644
index 0000000000000..39f301432e51f
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/repro-scope-missing-mutable-range.expect.md
@@ -0,0 +1,55 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function HomeDiscoStoreItemTileRating(props) {
+ const item = useFragment();
+ let count = 0;
+ const aggregates = item?.aggregates || [];
+ aggregates.forEach(aggregate => {
+ count += aggregate.count || 0;
+ });
+
+ return {count};
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function HomeDiscoStoreItemTileRating(props) {
+ const $ = _c(4);
+ const item = useFragment();
+ let count;
+ if ($[0] !== item?.aggregates) {
+ count = 0;
+ const aggregates = item?.aggregates || [];
+ aggregates.forEach((aggregate) => {
+ count = count + (aggregate.count || 0);
+ count;
+ });
+ $[0] = item?.aggregates;
+ $[1] = count;
+ } else {
+ count = $[1];
+ }
+
+ const t0 = count;
+ let t1;
+ if ($[2] !== t0) {
+ t1 = {t0};
+ $[2] = t0;
+ $[3] = t1;
+ } else {
+ t1 = $[3];
+ }
+ return t1;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/repro-scope-missing-mutable-range.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/repro-scope-missing-mutable-range.js
new file mode 100644
index 0000000000000..71933018ccb28
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/repro-scope-missing-mutable-range.js
@@ -0,0 +1,11 @@
+// @enablePropagateDepsInHIR
+function HomeDiscoStoreItemTileRating(props) {
+ const item = useFragment();
+ let count = 0;
+ const aggregates = item?.aggregates || [];
+ aggregates.forEach(aggregate => {
+ count += aggregate.count || 0;
+ });
+
+ return {count};
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-cascading-eliminated-phis.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-cascading-eliminated-phis.expect.md
new file mode 100644
index 0000000000000..f11300a7557df
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-cascading-eliminated-phis.expect.md
@@ -0,0 +1,85 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function Component(props) {
+ let x = 0;
+ const values = [];
+ const y = props.a || props.b;
+ values.push(y);
+ if (props.c) {
+ x = 1;
+ }
+ values.push(x);
+ if (props.d) {
+ x = 2;
+ }
+ values.push(x);
+ return values;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 0, b: 1, c: true, d: true}],
+ sequentialRenders: [
+ {a: 0, b: 1, c: true, d: true},
+ {a: 4, b: 1, c: true, d: true},
+ {a: 4, b: 1, c: false, d: true},
+ {a: 4, b: 1, c: false, d: false},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function Component(props) {
+ const $ = _c(4);
+ let x = 0;
+ let values;
+ if ($[0] !== props || $[1] !== x) {
+ values = [];
+ const y = props.a || props.b;
+ values.push(y);
+ if (props.c) {
+ x = 1;
+ }
+
+ values.push(x);
+ if (props.d) {
+ x = 2;
+ }
+
+ values.push(x);
+ $[0] = props;
+ $[1] = x;
+ $[2] = values;
+ $[3] = x;
+ } else {
+ values = $[2];
+ x = $[3];
+ }
+ return values;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 0, b: 1, c: true, d: true }],
+ sequentialRenders: [
+ { a: 0, b: 1, c: true, d: true },
+ { a: 4, b: 1, c: true, d: true },
+ { a: 4, b: 1, c: false, d: true },
+ { a: 4, b: 1, c: false, d: false },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [1,1,2]
+[4,1,2]
+[4,0,2]
+[4,0,0]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-cascading-eliminated-phis.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-cascading-eliminated-phis.js
new file mode 100644
index 0000000000000..eb1dde9a9d607
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-cascading-eliminated-phis.js
@@ -0,0 +1,27 @@
+// @enablePropagateDepsInHIR
+function Component(props) {
+ let x = 0;
+ const values = [];
+ const y = props.a || props.b;
+ values.push(y);
+ if (props.c) {
+ x = 1;
+ }
+ values.push(x);
+ if (props.d) {
+ x = 2;
+ }
+ values.push(x);
+ return values;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 0, b: 1, c: true, d: true}],
+ sequentialRenders: [
+ {a: 0, b: 1, c: true, d: true},
+ {a: 4, b: 1, c: true, d: true},
+ {a: 4, b: 1, c: false, d: true},
+ {a: 4, b: 1, c: false, d: false},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md
new file mode 100644
index 0000000000000..6205a6e50900f
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md
@@ -0,0 +1,84 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {Stringify} from 'shared-runtime';
+
+function Component(props) {
+ let x = [];
+ let y;
+ if (props.p0) {
+ x.push(props.p1);
+ y = x;
+ }
+ return (
+
+ {x}
+ {y}
+
+ );
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{p0: false, p1: 2}],
+ sequentialRenders: [
+ {p0: false, p1: 2},
+ {p0: false, p1: 2},
+ {p0: true, p1: 2},
+ {p0: true, p1: 3},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { Stringify } from "shared-runtime";
+
+function Component(props) {
+ const $ = _c(2);
+ let t0;
+ if ($[0] !== props) {
+ const x = [];
+ let y;
+ if (props.p0) {
+ x.push(props.p1);
+ y = x;
+ }
+
+ t0 = (
+
+ {x}
+ {y}
+
+ );
+ $[0] = props;
+ $[1] = t0;
+ } else {
+ t0 = $[1];
+ }
+ return t0;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ p0: false, p1: 2 }],
+ sequentialRenders: [
+ { p0: false, p1: 2 },
+ { p0: false, p1: 2 },
+ { p0: true, p1: 2 },
+ { p0: true, p1: 3 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok)
{"children":[[],null]}
+{"children":[[],null]}
+{"children":[[2],"[[ cyclic ref *2 ]]"]}
+{"children":[[3],"[[ cyclic ref *2 ]]"]}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.js
new file mode 100644
index 0000000000000..f13f66c590ab7
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.js
@@ -0,0 +1,28 @@
+// @enablePropagateDepsInHIR
+import {Stringify} from 'shared-runtime';
+
+function Component(props) {
+ let x = [];
+ let y;
+ if (props.p0) {
+ x.push(props.p1);
+ y = x;
+ }
+ return (
+
+ {x}
+ {y}
+
+ );
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{p0: false, p1: 2}],
+ sequentialRenders: [
+ {p0: false, p1: 2},
+ {p0: false, p1: 2},
+ {p0: true, p1: 2},
+ {p0: true, p1: 3},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction-with-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction-with-mutation.expect.md
new file mode 100644
index 0000000000000..6dfdb906bd26d
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction-with-mutation.expect.md
@@ -0,0 +1,65 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? (({x} = {x: {}}), ([x] = [[]]), x.push(props.foo)) : null;
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { mutate } from "shared-runtime";
+
+function useFoo(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props) {
+ x = [];
+ x.push(props.bar);
+ props.cond ? (([x] = [[]]), x.push(props.foo)) : null;
+ mutate(x);
+ $[0] = props;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ cond: false, foo: 2, bar: 55 }],
+ sequentialRenders: [
+ { cond: false, foo: 2, bar: 55 },
+ { cond: false, foo: 3, bar: 55 },
+ { cond: true, foo: 3, bar: 55 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [55,"joe"]
+[55,"joe"]
+[3,"joe"]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction-with-mutation.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction-with-mutation.js
new file mode 100644
index 0000000000000..1ea8b35addd9d
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction-with-mutation.js
@@ -0,0 +1,20 @@
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? (({x} = {x: {}}), ([x] = [[]]), x.push(props.foo)) : null;
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction.expect.md
new file mode 100644
index 0000000000000..1f2bb8f4f933b
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction.expect.md
@@ -0,0 +1,65 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? (({x} = {x: {}}), ([x] = [[]]), x.push(props.foo)) : null;
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function useFoo(props) {
+ const $ = _c(4);
+ let x;
+ if ($[0] !== props.bar) {
+ x = [];
+ x.push(props.bar);
+ $[0] = props.bar;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ if ($[2] !== props) {
+ props.cond ? (([x] = [[]]), x.push(props.foo)) : null;
+ $[2] = props;
+ $[3] = x;
+ } else {
+ x = $[3];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ cond: false, foo: 2, bar: 55 }],
+ sequentialRenders: [
+ { cond: false, foo: 2, bar: 55 },
+ { cond: false, foo: 3, bar: 55 },
+ { cond: true, foo: 3, bar: 55 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [55]
+[55]
+[3]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction.js
new file mode 100644
index 0000000000000..2f37cdabb47f5
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-destruction.js
@@ -0,0 +1,17 @@
+// @enablePropagateDepsInHIR
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? (({x} = {x: {}}), ([x] = [[]]), x.push(props.foo)) : null;
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-with-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-with-mutation.expect.md
new file mode 100644
index 0000000000000..e8808bd9520fe
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-with-mutation.expect.md
@@ -0,0 +1,65 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? ((x = {}), (x = []), x.push(props.foo)) : null;
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { mutate } from "shared-runtime";
+
+function useFoo(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props) {
+ x = [];
+ x.push(props.bar);
+ props.cond ? ((x = []), x.push(props.foo)) : null;
+ mutate(x);
+ $[0] = props;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ cond: false, foo: 2, bar: 55 }],
+ sequentialRenders: [
+ { cond: false, foo: 2, bar: 55 },
+ { cond: false, foo: 3, bar: 55 },
+ { cond: true, foo: 3, bar: 55 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [55,"joe"]
+[55,"joe"]
+[3,"joe"]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-with-mutation.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-with-mutation.js
new file mode 100644
index 0000000000000..a8fce44135419
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary-with-mutation.js
@@ -0,0 +1,20 @@
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? ((x = {}), (x = []), x.push(props.foo)) : null;
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary.expect.md
new file mode 100644
index 0000000000000..1ba20962f74e0
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary.expect.md
@@ -0,0 +1,65 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? ((x = {}), (x = []), x.push(props.foo)) : null;
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function useFoo(props) {
+ const $ = _c(4);
+ let x;
+ if ($[0] !== props.bar) {
+ x = [];
+ x.push(props.bar);
+ $[0] = props.bar;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ if ($[2] !== props) {
+ props.cond ? ((x = []), x.push(props.foo)) : null;
+ $[2] = props;
+ $[3] = x;
+ } else {
+ x = $[3];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ cond: false, foo: 2, bar: 55 }],
+ sequentialRenders: [
+ { cond: false, foo: 2, bar: 55 },
+ { cond: false, foo: 3, bar: 55 },
+ { cond: true, foo: 3, bar: 55 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [55]
+[55]
+[3]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary.js
new file mode 100644
index 0000000000000..3cafcd9f0bda2
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-ternary.js
@@ -0,0 +1,17 @@
+// @enablePropagateDepsInHIR
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond ? ((x = {}), (x = []), x.push(props.foo)) : null;
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary-with-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary-with-mutation.expect.md
new file mode 100644
index 0000000000000..00917d11efc7d
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary-with-mutation.expect.md
@@ -0,0 +1,65 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {arrayPush} from 'shared-runtime';
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond
+ ? ((x = {}), (x = []), x.push(props.foo))
+ : ((x = []), (x = []), x.push(props.bar));
+ arrayPush(x, 4);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { arrayPush } from "shared-runtime";
+function useFoo(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props) {
+ x = [];
+ x.push(props.bar);
+ props.cond ? ((x = []), x.push(props.foo)) : ((x = []), x.push(props.bar));
+ arrayPush(x, 4);
+ $[0] = props;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ cond: false, foo: 2, bar: 55 }],
+ sequentialRenders: [
+ { cond: false, foo: 2, bar: 55 },
+ { cond: false, foo: 3, bar: 55 },
+ { cond: true, foo: 3, bar: 55 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [55,4]
+[55,4]
+[3,4]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary-with-mutation.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary-with-mutation.js
new file mode 100644
index 0000000000000..2b7134fa20863
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary-with-mutation.js
@@ -0,0 +1,21 @@
+// @enablePropagateDepsInHIR
+import {arrayPush} from 'shared-runtime';
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond
+ ? ((x = {}), (x = []), x.push(props.foo))
+ : ((x = []), (x = []), x.push(props.bar));
+ arrayPush(x, 4);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.expect.md
new file mode 100644
index 0000000000000..67590ad846242
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.expect.md
@@ -0,0 +1,67 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond
+ ? ((x = {}), (x = []), x.push(props.foo))
+ : ((x = []), (x = []), x.push(props.bar));
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function useFoo(props) {
+ const $ = _c(4);
+ let x;
+ if ($[0] !== props.bar) {
+ x = [];
+ x.push(props.bar);
+ $[0] = props.bar;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ if ($[2] !== props) {
+ props.cond ? ((x = []), x.push(props.foo)) : ((x = []), x.push(props.bar));
+ $[2] = props;
+ $[3] = x;
+ } else {
+ x = $[3];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ cond: false, foo: 2, bar: 55 }],
+ sequentialRenders: [
+ { cond: false, foo: 2, bar: 55 },
+ { cond: false, foo: 3, bar: 55 },
+ { cond: true, foo: 3, bar: 55 },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) [55]
+[55]
+[3]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.js
new file mode 100644
index 0000000000000..d131c3bbc0ac2
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.js
@@ -0,0 +1,19 @@
+// @enablePropagateDepsInHIR
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ props.cond
+ ? ((x = {}), (x = []), x.push(props.foo))
+ : ((x = []), (x = []), x.push(props.bar));
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{cond: false, foo: 2, bar: 55}],
+ sequentialRenders: [
+ {cond: false, foo: 2, bar: 55},
+ {cond: false, foo: 3, bar: 55},
+ {cond: true, foo: 3, bar: 55},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-via-destructuring-with-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-via-destructuring-with-mutation.expect.md
new file mode 100644
index 0000000000000..583c32f2f63df
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-via-destructuring-with-mutation.expect.md
@@ -0,0 +1,73 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let {x} = {x: []};
+ x.push(props.bar);
+ if (props.cond) {
+ ({x} = {x: {}});
+ ({x} = {x: []});
+ x.push(props.foo);
+ }
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{bar: 'bar', foo: 'foo', cond: true}],
+ sequentialRenders: [
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: false},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { mutate } from "shared-runtime";
+
+function useFoo(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props) {
+ ({ x } = { x: [] });
+ x.push(props.bar);
+ if (props.cond) {
+ ({ x } = { x: [] });
+ x.push(props.foo);
+ }
+
+ mutate(x);
+ $[0] = props;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ bar: "bar", foo: "foo", cond: true }],
+ sequentialRenders: [
+ { bar: "bar", foo: "foo", cond: true },
+ { bar: "bar", foo: "foo", cond: true },
+ { bar: "bar", foo: "foo", cond: false },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) ["foo","joe"]
+["foo","joe"]
+["bar","joe"]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-via-destructuring-with-mutation.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-via-destructuring-with-mutation.js
new file mode 100644
index 0000000000000..e83596e91b6a4
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-via-destructuring-with-mutation.js
@@ -0,0 +1,24 @@
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let {x} = {x: []};
+ x.push(props.bar);
+ if (props.cond) {
+ ({x} = {x: {}});
+ ({x} = {x: []});
+ x.push(props.foo);
+ }
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{bar: 'bar', foo: 'foo', cond: true}],
+ sequentialRenders: [
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: false},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-with-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-with-mutation.expect.md
new file mode 100644
index 0000000000000..92a7e6b25c79c
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-with-mutation.expect.md
@@ -0,0 +1,73 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ if (props.cond) {
+ x = {};
+ x = [];
+ x.push(props.foo);
+ }
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{bar: 'bar', foo: 'foo', cond: true}],
+ sequentialRenders: [
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: false},
+ ],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { mutate } from "shared-runtime";
+
+function useFoo(props) {
+ const $ = _c(2);
+ let x;
+ if ($[0] !== props) {
+ x = [];
+ x.push(props.bar);
+ if (props.cond) {
+ x = [];
+ x.push(props.foo);
+ }
+
+ mutate(x);
+ $[0] = props;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{ bar: "bar", foo: "foo", cond: true }],
+ sequentialRenders: [
+ { bar: "bar", foo: "foo", cond: true },
+ { bar: "bar", foo: "foo", cond: true },
+ { bar: "bar", foo: "foo", cond: false },
+ ],
+};
+
+```
+
+### Eval output
+(kind: ok) ["foo","joe"]
+["foo","joe"]
+["bar","joe"]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-with-mutation.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-with-mutation.js
new file mode 100644
index 0000000000000..ac7b8007d8c4c
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-with-mutation.js
@@ -0,0 +1,24 @@
+// @enablePropagateDepsInHIR
+import {mutate} from 'shared-runtime';
+
+function useFoo(props) {
+ let x = [];
+ x.push(props.bar);
+ if (props.cond) {
+ x = {};
+ x = [];
+ x.push(props.foo);
+ }
+ mutate(x);
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useFoo,
+ params: [{bar: 'bar', foo: 'foo', cond: true}],
+ sequentialRenders: [
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: true},
+ {bar: 'bar', foo: 'foo', cond: false},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md
new file mode 100644
index 0000000000000..aa122bc849039
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md
@@ -0,0 +1,90 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function Component(props) {
+ let x = [];
+ let y;
+ switch (props.p0) {
+ case 1: {
+ break;
+ }
+ case true: {
+ x.push(props.p2);
+ y = [];
+ }
+ default: {
+ break;
+ }
+ case false: {
+ y = x;
+ break;
+ }
+ }
+ const child = ;
+ y.push(props.p4);
+ return {child};
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function Component(props) {
+ const $ = _c(7);
+ let y;
+ let t0;
+ if ($[0] !== props) {
+ const x = [];
+ bb0: switch (props.p0) {
+ case 1: {
+ break bb0;
+ }
+ case true: {
+ x.push(props.p2);
+ let t1;
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
+ t1 = [];
+ $[3] = t1;
+ } else {
+ t1 = $[3];
+ }
+ y = t1;
+ }
+ default: {
+ break bb0;
+ }
+ case false: {
+ y = x;
+ }
+ }
+
+ t0 = ;
+ $[0] = props;
+ $[1] = y;
+ $[2] = t0;
+ } else {
+ y = $[1];
+ t0 = $[2];
+ }
+ const child = t0;
+ y.push(props.p4);
+ let t1;
+ if ($[4] !== y || $[5] !== child) {
+ t1 = {child};
+ $[4] = y;
+ $[5] = child;
+ $[6] = t1;
+ } else {
+ t1 = $[6];
+ }
+ return t1;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.js
new file mode 100644
index 0000000000000..7a73d054d54e8
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.js
@@ -0,0 +1,24 @@
+// @enablePropagateDepsInHIR
+function Component(props) {
+ let x = [];
+ let y;
+ switch (props.p0) {
+ case 1: {
+ break;
+ }
+ case true: {
+ x.push(props.p2);
+ y = [];
+ }
+ default: {
+ break;
+ }
+ case false: {
+ y = x;
+ break;
+ }
+ }
+ const child = ;
+ y.push(props.p4);
+ return {child};
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md
new file mode 100644
index 0000000000000..6c48b781a2992
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md
@@ -0,0 +1,72 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+function Component(props) {
+ let x = [];
+ let y;
+ switch (props.p0) {
+ case true: {
+ x.push(props.p2);
+ x.push(props.p3);
+ y = [];
+ }
+ case false: {
+ y = x;
+ break;
+ }
+ }
+ const child = ;
+ y.push(props.p4);
+ return {child};
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+function Component(props) {
+ const $ = _c(6);
+ let y;
+ let t0;
+ if ($[0] !== props) {
+ const x = [];
+ switch (props.p0) {
+ case true: {
+ x.push(props.p2);
+ x.push(props.p3);
+ }
+ case false: {
+ y = x;
+ }
+ }
+
+ t0 = ;
+ $[0] = props;
+ $[1] = y;
+ $[2] = t0;
+ } else {
+ y = $[1];
+ t0 = $[2];
+ }
+ const child = t0;
+ y.push(props.p4);
+ let t1;
+ if ($[3] !== y || $[4] !== child) {
+ t1 = {child};
+ $[3] = y;
+ $[4] = child;
+ $[5] = t1;
+ } else {
+ t1 = $[5];
+ }
+ return t1;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.js
new file mode 100644
index 0000000000000..187fffd39ec82
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.js
@@ -0,0 +1,19 @@
+// @enablePropagateDepsInHIR
+function Component(props) {
+ let x = [];
+ let y;
+ switch (props.p0) {
+ case true: {
+ x.push(props.p2);
+ x.push(props.p3);
+ y = [];
+ }
+ case false: {
+ y = x;
+ break;
+ }
+ }
+ const child = ;
+ y.push(props.p4);
+ return {child};
+}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-mutate-outer-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-mutate-outer-value.expect.md
new file mode 100644
index 0000000000000..e47a528fd375a
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-mutate-outer-value.expect.md
@@ -0,0 +1,64 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+const {shallowCopy, throwErrorWithMessage} = require('shared-runtime');
+
+function Component(props) {
+ const x = [];
+ try {
+ x.push(throwErrorWithMessage('oops'));
+ } catch {
+ x.push(shallowCopy({a: props.a}));
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 1}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+const { shallowCopy, throwErrorWithMessage } = require("shared-runtime");
+
+function Component(props) {
+ const $ = _c(3);
+ let x;
+ if ($[0] !== props.a) {
+ x = [];
+ try {
+ let t0;
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
+ t0 = throwErrorWithMessage("oops");
+ $[2] = t0;
+ } else {
+ t0 = $[2];
+ }
+ x.push(t0);
+ } catch {
+ x.push(shallowCopy({ a: props.a }));
+ }
+ $[0] = props.a;
+ $[1] = x;
+ } else {
+ x = $[1];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 1 }],
+};
+
+```
+
+### Eval output
+(kind: ok) [{"a":1}]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-mutate-outer-value.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-mutate-outer-value.js
new file mode 100644
index 0000000000000..97e4250b2277a
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-mutate-outer-value.js
@@ -0,0 +1,17 @@
+// @enablePropagateDepsInHIR
+const {shallowCopy, throwErrorWithMessage} = require('shared-runtime');
+
+function Component(props) {
+ const x = [];
+ try {
+ x.push(throwErrorWithMessage('oops'));
+ } catch {
+ x.push(shallowCopy({a: props.a}));
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 1}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.expect.md
new file mode 100644
index 0000000000000..f69994b0a8531
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.expect.md
@@ -0,0 +1,64 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+const {throwInput} = require('shared-runtime');
+
+function Component(props) {
+ let x;
+ try {
+ const y = [];
+ y.push(props.y);
+ throwInput(y);
+ } catch (e) {
+ e.push(props.e);
+ x = e;
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{y: 'foo', e: 'bar'}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+const { throwInput } = require("shared-runtime");
+
+function Component(props) {
+ const $ = _c(3);
+ let x;
+ if ($[0] !== props.y || $[1] !== props.e) {
+ try {
+ const y = [];
+ y.push(props.y);
+ throwInput(y);
+ } catch (t0) {
+ const e = t0;
+ e.push(props.e);
+ x = e;
+ }
+ $[0] = props.y;
+ $[1] = props.e;
+ $[2] = x;
+ } else {
+ x = $[2];
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ y: "foo", e: "bar" }],
+};
+
+```
+
+### Eval output
+(kind: ok) ["foo","bar"]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.js
new file mode 100644
index 0000000000000..5a0864118ba8f
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.js
@@ -0,0 +1,20 @@
+// @enablePropagateDepsInHIR
+const {throwInput} = require('shared-runtime');
+
+function Component(props) {
+ let x;
+ try {
+ const y = [];
+ y.push(props.y);
+ throwInput(y);
+ } catch (e) {
+ e.push(props.e);
+ x = e;
+ }
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{y: 'foo', e: 'bar'}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.expect.md
new file mode 100644
index 0000000000000..bc47228371f87
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.expect.md
@@ -0,0 +1,70 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+const {throwInput} = require('shared-runtime');
+
+function Component(props) {
+ try {
+ const y = [];
+ y.push(props.y);
+ throwInput(y);
+ } catch (e) {
+ e.push(props.e);
+ return e;
+ }
+ return null;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{y: 'foo', e: 'bar'}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+const { throwInput } = require("shared-runtime");
+
+function Component(props) {
+ const $ = _c(3);
+ let t0;
+ if ($[0] !== props.y || $[1] !== props.e) {
+ t0 = Symbol.for("react.early_return_sentinel");
+ bb0: {
+ try {
+ const y = [];
+ y.push(props.y);
+ throwInput(y);
+ } catch (t1) {
+ const e = t1;
+ e.push(props.e);
+ t0 = e;
+ break bb0;
+ }
+ }
+ $[0] = props.y;
+ $[1] = props.e;
+ $[2] = t0;
+ } else {
+ t0 = $[2];
+ }
+ if (t0 !== Symbol.for("react.early_return_sentinel")) {
+ return t0;
+ }
+ return null;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ y: "foo", e: "bar" }],
+};
+
+```
+
+### Eval output
+(kind: ok) ["foo","bar"]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.js
new file mode 100644
index 0000000000000..97d650453c175
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.js
@@ -0,0 +1,19 @@
+// @enablePropagateDepsInHIR
+const {throwInput} = require('shared-runtime');
+
+function Component(props) {
+ try {
+ const y = [];
+ y.push(props.y);
+ throwInput(y);
+ } catch (e) {
+ e.push(props.e);
+ return e;
+ }
+ return null;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{y: 'foo', e: 'bar'}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.expect.md
new file mode 100644
index 0000000000000..2c37f63189e8b
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.expect.md
@@ -0,0 +1,73 @@
+
+## Input
+
+```javascript
+// @enablePropagateDepsInHIR
+import {useMemo} from 'react';
+
+function Component(props) {
+ const x = useMemo(() => {
+ let y = [];
+ if (props.cond) {
+ y.push(props.a);
+ }
+ if (props.cond2) {
+ return y;
+ }
+ y.push(props.b);
+ return y;
+ });
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 1, b: 2, cond2: false}],
+};
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
+import { useMemo } from "react";
+
+function Component(props) {
+ const $ = _c(3);
+ let t0;
+ bb0: {
+ let y;
+ if ($[0] !== props) {
+ y = [];
+ if (props.cond) {
+ y.push(props.a);
+ }
+ if (props.cond2) {
+ t0 = y;
+ break bb0;
+ }
+
+ y.push(props.b);
+ $[0] = props;
+ $[1] = y;
+ $[2] = t0;
+ } else {
+ y = $[1];
+ t0 = $[2];
+ }
+ t0 = y;
+ }
+ const x = t0;
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 1, b: 2, cond2: false }],
+};
+
+```
+
+### Eval output
+(kind: ok) [2]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.js
new file mode 100644
index 0000000000000..7075ecaac53c4
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.js
@@ -0,0 +1,22 @@
+// @enablePropagateDepsInHIR
+import {useMemo} from 'react';
+
+function Component(props) {
+ const x = useMemo(() => {
+ let y = [];
+ if (props.cond) {
+ y.push(props.a);
+ }
+ if (props.cond2) {
+ return y;
+ }
+ y.push(props.b);
+ return y;
+ });
+ return x;
+}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 1, b: 2, cond2: false}],
+};