diff --git a/compiler/nativeGen/Dwarf.hs b/compiler/nativeGen/Dwarf.hs
index b858b7734dbe6edc654627533d9ebcffbfbe06fc..8ccf408e7ed4b36c9ead05e8f4afbc193b7d9fbb 100644
--- a/compiler/nativeGen/Dwarf.hs
+++ b/compiler/nativeGen/Dwarf.hs
@@ -182,10 +182,17 @@ procToDwarf df prc
                          _otherwise -> showSDocDump df $ ppr $ dblLabel prc
                     , dwLabel    = dblCLabel prc
                     , dwParent   = fmap mkAsmTempDieLabel
-                                   $ mfilter (/= dblCLabel prc)
+                                   $ mfilter goodParent
                                    $ fmap dblCLabel (dblParent prc)
-                      -- Omit parent if it would be self-referential
                     }
+  where
+  goodParent a | a == dblCLabel prc = False
+               -- Omit parent if it would be self-referential
+  goodParent a | not (externallyVisibleCLabel a)
+               , debugLevel df < 2 = False
+               -- We strip block information when running -g0 or -g1, don't
+               -- refer to blocks in that case. Fixes #14894.
+  goodParent _ = True
 
 -- | Generate DWARF info for a block
 blockToDwarf :: DynFlags -> DebugBlock -> DwarfInfo
diff --git a/testsuite/tests/simplCore/should_run/T14894.hs b/testsuite/tests/simplCore/should_run/T14894.hs
new file mode 100644
index 0000000000000000000000000000000000000000..420b85e466a76bb5a29a4f0166216468b4d73fea
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T14894.hs
@@ -0,0 +1,9 @@
+{-# OPTIONS_GHC -g1 -O #-}
+import System.Environment
+summap :: (Int -> Int) -> (Int -> Int)
+summap f n = f 10
+{-# NOINLINE summap #-}
+
+main = do
+  n <- length `fmap` getArgs
+  print $ summap (+ n) n
diff --git a/testsuite/tests/simplCore/should_run/T14894.stdout b/testsuite/tests/simplCore/should_run/T14894.stdout
new file mode 100644
index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T14894.stdout
@@ -0,0 +1 @@
+10
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index d1ea496af3724585344b07299e9db9bfd34487fb..d697605754cef4b1e1d101425536c1dea978fe36 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -82,3 +82,4 @@ test('T14768', reqlib('vector'), compile_and_run, [''])
 test('T14868',
      [when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261))],
      compile_and_run, [''])
+test('T14894', normal, compile_and_run, [''])