M lib/scopes/compiler/noir/reduce.sc +22 -0
@@ 119,6 119,28 @@ struct Reduce
continue;
switch row.op
+ case 'case
+ a := getarg 0 Const
+ b := getarg 1 Const
+ aptr asz := 'data ('constof builder a)
+ bptr bsz := 'data ('constof builder b)
+ updates += 1
+ value := if
+ and (asz == bsz)
+ (memcmp (aptr as rawstring) (bptr as rawstring) asz) == 0
+ imply
+ 'wrap Module.Id.ConstEmpty 0
+ Module.Id.Value
+ else
+ imply
+ 'wrap Module.Id.ConstUndef 0
+ Module.Id.Value
+ row := getrow& ()
+ if (empty? row.deps)
+ row.op = Operation.ALIAS
+ else
+ row.op = Operation.pass
+ row.operands = typeinit value
pass 'iadd
pass 'isub
pass 'imul