summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/RegAlloc/Linear/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nativeGen/RegAlloc/Linear/Main.hs')
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/Main.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs
index fc5b992603..fa71457808 100644
--- a/compiler/nativeGen/RegAlloc/Linear/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs
@@ -116,7 +116,7 @@ import Instruction
import Reg
import BlockId
-import OldCmm hiding (RegSet)
+import Cmm hiding (RegSet)
import Digraph
import DynFlags
@@ -743,12 +743,13 @@ allocateRegsAndSpill reading keep spills alloc (r:rs)
Just (InMem slot) | reading -> doSpill (ReadMem slot)
| otherwise -> doSpill WriteMem
Nothing | reading ->
- -- pprPanic "allocateRegsAndSpill: Cannot read from uninitialized register" (ppr r)
- -- ToDo: This case should be a panic, but we
- -- sometimes see an unreachable basic block which
- -- triggers this because the register allocator
- -- will start with an empty assignment.
- doSpill WriteNew
+ pprPanic "allocateRegsAndSpill: Cannot read from uninitialized register" (ppr r)
+ -- NOTE: if the input to the NCG contains some
+ -- unreachable blocks with junk code, this panic
+ -- might be triggered. Make sure you only feed
+ -- sensible code into the NCG. In CmmPipeline we
+ -- call removeUnreachableBlocks at the end for this
+ -- reason.
| otherwise -> doSpill WriteNew