Skip to content

Instantly share code, notes, and snippets.

@evanphx
Created January 26, 2009 07:12
Show Gist options
  • Save evanphx/52734 to your computer and use it in GitHub Desktop.
Save evanphx/52734 to your computer and use it in GitHub Desktop.
void something(int*,int,int,int);
int blah(int* vals) {
int a = vals[0];
int b = vals[1];
int c = vals[0];
something(vals,a,b,c);
int d = vals[1];
return d;
}
; ModuleID = 'aliasing.cpp'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9"
define i32 @_Z4blahPi(i32* %vals) {
entry:
%tmp3 = load i32* %vals, align 4 ; <i32> [#uses=2]
%tmp5 = getelementptr i32* %vals, i32 1 ; <i32*> [#uses=2]
%tmp6 = load i32* %tmp5, align 4 ; <i32> [#uses=1]
tail call void @_Z9somethingPiiii( i32* %vals, i32 %tmp3, i32 %tmp6, i32 %tmp3 )
%tmp16 = load i32* %tmp5, align 4 ; <i32> [#uses=1]
ret i32 %tmp16
}
declare void @_Z9somethingPiiii(i32*, i32, i32, i32)
__Z4blahPi:
Leh_func_begin1:
Llabel1:
pushl %esi
subl $24, %esp
movl 32(%esp), %esi
movl (%esi), %eax
movl 4(%esi), %ecx
movl %eax, 12(%esp)
movl %ecx, 8(%esp)
movl %eax, 4(%esp)
movl %esi, (%esp)
call L__Z9somethingPiiii$stub
movl 4(%esi), %eax
addl $24, %esp
popl %esi
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment