-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor simplification to phi optimization
- Loading branch information
Showing
8 changed files
with
59 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=0; -11=-11 | ||
def main(a: int) -> int { | ||
var sum = a; | ||
for (i < 10) { | ||
sum = a; // phi for sum is recursive but redundant | ||
} | ||
return sum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
//@execute 1=1; 0=0 | ||
component opt_phi01 { | ||
def main(a: int) -> int { | ||
var i = 0; | ||
while (i < 1) i = i + 1; | ||
i = a; | ||
while (true) return i; | ||
return i; | ||
} | ||
def main(a: int) -> int { | ||
var i = 0; | ||
while (i < 1) i = i + 1; | ||
i = a; | ||
while (true) return i; | ||
return i; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
//@execute 1=3; 0=3 | ||
component opt_phi02 { | ||
def main(a: int) -> int { | ||
var i = 0; | ||
while (i < 1) i = i + 1; | ||
i = 1; | ||
while (true) return i + 2; | ||
return i + 2; | ||
} | ||
def main(a: int) -> int { | ||
var i = 0; | ||
while (i < 1) i = i + 1; | ||
i = 1; | ||
while (true) return i + 2; | ||
return i + 2; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
//@execute 1=1; 0=1 | ||
component opt_phi03 { | ||
def main(a: int) -> int { | ||
var i = 0; | ||
while (i < 1) i = i + 1; | ||
i = 1; | ||
while (i == 1) break; | ||
if (i == 1) return 1; | ||
return 2; | ||
} | ||
def main(a: int) -> int { | ||
var i = 0; | ||
while (i < 1) i = i + 1; | ||
i = 1; | ||
while (i == 1) break; | ||
if (i == 1) return 1; | ||
return 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=0; -11=-11 | ||
def main(a: int) -> int { | ||
var sum = a; | ||
for (i < 10) { | ||
sum = sum; // phi for sum is recursive but redundant | ||
} | ||
return sum; | ||
} |