// FIXME: There are llvm-gcc options to control these selectively.
Opts.InlineFunctions = (Opts.OptimizationLevel > 1);
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
- Opts.SimplifyLibCalls = 1;
+ Opts.SimplifyLibCalls = !Freestanding;
#ifdef NDEBUG
Opts.VerifyModule = 0;
--- /dev/null
+// RUN: clang -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1 &&
+// RUN: clang -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1 &&
+// RUN: clang -ffreestanding -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 0
+
+#include <stdio.h>
+
+void f0() {
+ printf("hello\n");
+}