Constant folding in the intermediate language should reduce expressions such as BFieldElement::new(100) * BFieldElement::new(100) to BFieldElement::new(10_000).
The compiler will parse and graft let a: BFieldElement = BFieldElement::new(100) * BFieldElement::new(100); to this intermediate expression:
Constant folding in the intermediate language should reduce expressions such as
BFieldElement::new(100) * BFieldElement::new(100)
toBFieldElement::new(10_000)
.The compiler will parse and graft
let a: BFieldElement = BFieldElement::new(100) * BFieldElement::new(100);
to this intermediate expression:After the constant folding the
BinOp
of typeMul
should be removed and only oneBFE
element should remain.Constant folding on the intermediate language should be handled for these data types:
bool
, simplifying e.g.!!a
toa
BFieldElement
(internally calledBFE
)XFieldElement
(internally calledXFE
)u32
simplifying e.g.14u32 + 15u32
to29u32
u64
u128