diff --git a/test/test_loopy.py b/test/test_loopy.py
index 9498dab3573290ae130a0d6189dd47cf1710709b..e713dd7d47bb14435a4049d89125406504b1bb40 100644
--- a/test/test_loopy.py
+++ b/test/test_loopy.py
@@ -1843,7 +1843,40 @@ def test_precompute_confusing_subst_arguments(ctx_factory):
 
 
 def test_precompute_nested_subst(ctx_factory):
-    pass
+    ctx = ctx_factory()
+
+    knl = lp.make_kernel(
+        "{[i,j]: 0<=i<n and 0<=j<5}",
+        """
+        E:=a[i]
+        D:=E*E
+        b[i] = D
+        """)
+
+    knl = lp.add_and_infer_dtypes(knl, dict(a=np.float32))
+
+    ref_knl = knl
+
+    knl = lp.tag_inames(knl, dict(j="g.1"))
+    knl = lp.split_iname(knl, "i", 128, outer_tag="g.0", inner_tag="l.0")
+
+    from loopy.symbolic import get_dependencies
+    assert "i_inner" not in get_dependencies(knl.substitutions["D"].expression)
+    knl = lp.precompute(knl, "D", "i_inner")
+
+    # There's only one surviving 'E' rule.
+    assert len([
+        rule_name
+        for rule_name in knl.substitutions
+        if rule_name.startswith("E")]) == 1
+
+    # That rule should use the newly created prefetch inames,
+    # not the prior 'i_inner'
+    assert "i_inner" not in get_dependencies(knl.substitutions["E"].expression)
+
+    lp.auto_test_vs_ref(
+            ref_knl, ctx, knl,
+            parameters=dict(n=12345))
 
 
 def test_poisson(ctx_factory):