Skip to main content
Make solution work for newer versions of LLVM
Source Link

LLVM IR 4.0.1, 149 145145 152 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@puts@puts(i8*getelementptr([14 x i8],[14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it's possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @puts(i8* getelementptr([14 x i8], [14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}

LLVM IR, 149 145 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@puts(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it's possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @puts(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}

LLVM IR 4.0.1, 149 145 152 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)@puts(i8*getelementptr([14 x i8],[14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it's possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*) @puts(i8* getelementptr([14 x i8], [14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}
added 2 characters in body
Source Link

LLVM IR, 149 145 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@puts(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that itit's possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @puts(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}

LLVM IR, 149 145 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@puts(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @puts(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}

LLVM IR, 149 145 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@puts(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it's possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @puts(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}
Use puts instead of printf. It's shorter!
Source Link

LLVM IR, 149149 145 bytes

declare i8@printfi8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@printf*@puts(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it possible with fewer bytes.

Ungolfed Version:

declare i8 @printf@puts(i8*) ; Declare printfputs from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @printf@puts(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to printfputs
    ret void
}

LLVM IR, 149 bytes

declare i8@printf(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@printf(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it possible with fewer bytes.

Ungolfed Version:

declare i8 @printf(i8*) ; Declare printf from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @printf(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to printf
    ret void
}

LLVM IR, 149 145 bytes

declare i8@puts(i8*)@t=global[14 x i8]c"Hello, World!\00"define void@main(){call i8(i8*)*@puts(i8*getelementptr([14 x i8]*@t,i1 0,i1 0))ret void}

I'm not very good in LLVM IR, so chances are good, that it possible with fewer bytes.

Ungolfed Version:

declare i8 @puts(i8*) ; Declare puts from C standard. i8, was the shortest return type possible.

@t=global [14 x i8] c"Hello, World!\00" ; Hello world string as global, to have a pointer to it.

define void @main(){
    call i8(i8*)* @puts(i8* getelementptr([14 x i8] *@t, i1 0, i1 0)) ; Get pointer to constant "Hello, World!" and pass it to puts
    ret void
}
Source Link
Loading