Skip to content

Instantly share code, notes, and snippets.

@asterite
Created February 11, 2016 16:14
Show Gist options
  • Save asterite/18db07b35d88941960a7 to your computer and use it in GitHub Desktop.
Save asterite/18db07b35d88941960a7 to your computer and use it in GitHub Desktop.
; ModuleID = 'main_module'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx"
@"$foo" = global i32 0
define i32 @main(i32 %argc, i8** %argv) {
entry:
%0 = call i32* @"*foo_ptr"()
store i32 1, i32* %0
%1 = call i32* @"*foo_ptr"()
%2 = load i32* %1
%3 = call i32* @"*foo_ptr"()
store i32 2, i32* %3
%4 = call i32* @"*foo_ptr"()
%5 = load i32* %4
ret i32 %5
}
define i32* @"*foo_ptr"() noinline {
entry:
ret i32* @"$foo"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment