[cfe-commits] r64599 - in /cfe/trunk: Driver/clang.cpp test/CodeGen/PR3589-freestanding-libcalls.c

Daniel Dunbar daniel at zuster.org
Sun Feb 15 12:00:15 PST 2009


Author: ddunbar
Date: Sun Feb 15 14:00:15 2009
New Revision: 64599

URL: http://llvm.org/viewvc/llvm-project?rev=64599&view=rev
Log:
PR3589: Don't simplify libcalls with -ffreestanding.

Added:
    cfe/trunk/test/CodeGen/PR3589-freestanding-libcalls.c
Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=64599&r1=64598&r2=64599&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Sun Feb 15 14:00:15 2009
@@ -1271,7 +1271,7 @@
   // 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;

Added: cfe/trunk/test/CodeGen/PR3589-freestanding-libcalls.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/PR3589-freestanding-libcalls.c?rev=64599&view=auto

==============================================================================
--- cfe/trunk/test/CodeGen/PR3589-freestanding-libcalls.c (added)
+++ cfe/trunk/test/CodeGen/PR3589-freestanding-libcalls.c Sun Feb 15 14:00:15 2009
@@ -0,0 +1,9 @@
+// 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");
+}





More information about the cfe-commits mailing list