futhark-0.9.1: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.Optimise.CSE

Description

This module implements common-subexpression elimination. This module does not actually remove the duplicate, but only replaces one with a diference to the other. E.g:

  let a = x + y
  let b = x + y

becomes:

  let a = x + y
  let b = a

After which copy propagation in the simplifier will actually remove the definition of b.

Our CSE is still rather stupid. No normalisation is performed, so the expressions x+y and y+x will be considered distinct. Furthermore, no expression with its own binding will be considered equal to any other, since the variable names will be distinct. This affects SOACs in particular.

Synopsis

Documentation

performCSE :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> Pass lore lore Source #

Perform CSE on every functioon in a program.

class CSEInOp op Source #

The operations that permit CSE.

Minimal complete definition

cseInOp

Instances
CSEInOp () Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: () -> CSEM lore ()

(Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => CSEInOp (SOAC (Aliases lore)) Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: SOAC (Aliases lore) -> CSEM lore0 (SOAC (Aliases lore))

(Attributes lore, Aliased lore, CSEInOp (Op lore)) => CSEInOp (KernelExp lore) Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: KernelExp lore -> CSEM lore0 (KernelExp lore)

(Attributes lore, Aliased lore, CSEInOp (Op lore)) => CSEInOp (Kernel lore) Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: Kernel lore -> CSEM lore0 (Kernel lore)

CSEInOp op => CSEInOp (MemOp op) Source # 
Instance details

Defined in Futhark.Optimise.CSE

Methods

cseInOp :: MemOp op -> CSEM lore (MemOp op)