Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
compiler\nativeGen\X86\CodeGen.hs:169:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for `verifyBasicBlock':
Patterns not matched: _ :: [Instr]
169 | verifyBasicBlock instrs
-- Verifying basic blocks is cheap, but not cheap enough to enable it unconditionally.
verifyBasicBlock :: [Instr] -> ()
verifyBasicBlock instrs
| debugIsOn = go False instrs
| not debugIsOn = ()
go _ [] = ()
go atEnd (i:instr)
= case i of
-- Start a new basic block
NEWBLOCK {} -> go False instr
-- Calls are not viable block terminators
CALL {} | atEnd -> faultyBlockWith i
| not atEnd -> go atEnd instr
-- All instructions ok, check if we reached the end and continue.
_ | not atEnd -> go (isJumpishInstr i) instr
-- Only jumps allowed at the end of basic blocks.
| otherwise -> if isJumpishInstr i
then go True instr
else faultyBlockWith i
faultyBlockWith i
= pprPanic "Non control flow instructions after end of basic block."
(ppr i <+> text "in:" $$ vcat (map ppr instrs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment