We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents da8c8b4 + 41aaaa1 commit 56b80bdCopy full SHA for 56b80bd
passes/pmgen/peepopt_shiftadd.pmg
@@ -53,6 +53,11 @@ match add
53
select port(add, constport).is_fully_const()
54
define <IdString> varport (constport == \A ? \B : \A)
55
56
+ // only optimize for constants up to a fixed width. this prevents cases
57
+ // with a blowup in internal term size and prevents larger constants being
58
+ // casted to int incorrectly
59
+ select (GetSize(port(add, constport)) <= 24)
60
+
61
// if a value of var is able to wrap the output, the transformation might give wrong results
62
// an addition/substraction can at most flip one more bit than the largest operand (the carry bit)
63
// as long as the output can show this bit, no wrap should occur (assuming all signed-ness make sense)
0 commit comments