Last active
November 29, 2016 01:00
-
-
Save minjang/67dc3a2eb46017ecfd9fcedc429737dd to your computer and use it in GitHub Desktop.
After mem2reg, gvn, and inline optimizations
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
define i32 @_Z4testv() #0 { | |
entry: | |
%a = alloca i32, align 4 | |
%b = alloca i32, align 4 | |
%call = call i32 @_Z3getv() ; int a = get(); | |
store i32 %call, i32* %a, align 4 | |
%call1 = call i32 @_Z3getv() ; int b = get(); | |
store i32 %call1, i32* %b, align 4 | |
%0 = load i32, i32* %a, align 4 ; temp_swap(a, b); | |
%1 = load i32, i32* %b, align 4 | |
store i32 %1, i32* %a, align 4 | |
store i32 %0, i32* %b, align 4 | |
%2 = load i32, i32* %b, align 4 ; xor_swap(a, b); | |
%3 = load i32, i32* %a, align 4 | |
%xor.i = xor i32 %3, %2 | |
store i32 %xor.i, i32* %a, align 4 | |
%4 = load i32, i32* %b, align 4 | |
%xor1.i = xor i32 %4, %xor.i | |
store i32 %xor1.i, i32* %b, align 4 | |
%5 = load i32, i32* %a, align 4 | |
%xor2.i = xor i32 %5, %xor1.i | |
store i32 %xor2.i, i32* %a, align 4 | |
%6 = load i32, i32* %a, align 4 ; return process(a, b); | |
%7 = load i32, i32* %b, align 4 | |
%call2 = call i32 @_Z7processii(i32 %6, i32 %7) | |
ret i32 %call2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment