Created
July 29, 2011 21:52
-
-
Save jeremytregunna/1114821 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| define i32 @fac(i32) { | |
| entry: | |
| %"n == 0" = icmp eq i32 %0, 0 | |
| br i1 %"n == 0", label %end, label %iffalse | |
| iffalse: ; preds = %entry | |
| %"n - 1" = add i32 %0, -1 | |
| %"fac(n - 1)" = call i32 @fac(i32 %"n - 1") | |
| %"n * fac(n - 1)" = mul i32 %"fac(n - 1)", %0 | |
| br label %end | |
| end: ; preds = %entry, %iffalse | |
| %result = phi i32 [ %"n * fac(n - 1)", %iffalse ], [ 1, %entry ] | |
| ret i32 %result | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment