[cfe-users] Improve build speeds?

Levo DeLellis via cfe-users cfe-users at lists.llvm.org
Fri Mar 15 14:22:51 PDT 2019

I have implemented a language and I'm planning to release it soon. One of
my goals is to have good build speeds so I can use it for web development.
I noticed building ll files is faster than building C. However I noticed
building a simple ll file can take 100+milliseconds on my desktop which
isn't terrible but isn't extremely fast either (-fsyntax-only is about

What can I do to build faster? I believe I saw some kind of C++ library. Is
using that directly any faster? I'm not writing my compiler in C++ and I'm
very likely to rewrite it in my language which will provide C linking. Am I
out of luck?

The test C file I used was

int main() {
    return 0;
I created the ll file by using `clang hello.c -S -emit-llvm` which
generated the below. Usually I program on linux but there's some debugging
I'm doing on windows atm however last time I checked I believe the speed
was comparable.

; ModuleID = 'hello.c'
source_filename = "hello.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.10.25017"

$"??_C at _05COLMCDPH@Hello?$AA@" = comdat any

@"??_C at _05COLMCDPH@Hello?$AA@" = linkonce_odr dso_local unnamed_addr
constant [6 x i8] c"Hello\00", comdat, align 1

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  store i32 0, i32* %1, align 4
  %2 = call i32 bitcast (i32 (...)* @puts to i32 (i8*)*)(i8* getelementptr
inbounds ([6 x i8], [6 x i8]* @"??_C at _05COLMCDPH@Hello?$AA@", i32 0, i32 0))
  ret i32 0

declare dso_local i32 @puts(...) #1

attributes #0 = { noinline nounwind optnone uwtable
"disable-tail-calls"="false" "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false"
"disable-tail-calls"="false" "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false"
"no-trapping-math"="false" "stack-protector-buffer-size"="8"
"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87"
"unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.module.flags = !{!0, !1}
!llvm.ident = !{!2}

!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{!"clang version 7.0.1 (tags/RELEASE_701/final)"}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20190315/47d89473/attachment.html>

More information about the cfe-users mailing list