Skip to content

Instantly share code, notes, and snippets.

@antonijn
Created September 10, 2014 22:36
Show Gist options
  • Save antonijn/eada506ff88f512b9a8d to your computer and use it in GitHub Desktop.
Save antonijn/eada506ff88f512b9a8d to your computer and use it in GitHub Desktop.
int main(void)
{
int i;
for (i = 0; i < 10; ++i)
;
return i;
}
%0:
%1 = (ptr int) alloca int #phiable()
store int 0, (ptr int) %1
jmp block %2
%2:
%3 = int load (ptr int) %1
%4 = _Bool cmp lt int %3, int 10
split _Bool %4, block %5, block %10
%5:
jmp block %7
%7:
%8 = int load (ptr int) %1
%9 = int add int %8, int 1
store int %9, (ptr int) %1
jmp block %2
%10:
%11 = int load (ptr int) %1
ret int %11
%0:
jmp block %2
%2:
%3 = int phi block %0, int 0, block %7, int %8
%4 = _Bool cmp lt int %3, int 10
split _Bool %4, block %5, block %9
%5:
jmp block %7
%7:
%8 = int add int %3, int 1
jmp block %2
%9:
ret int %3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment