[dragonegg] r179666 - Turn off libcall simplification when -fno-builtin is specified. Patch by Peter
Duncan Sands
baldrick at free.fr
Tue Apr 16 23:04:01 PDT 2013
Author: baldrick
Date: Wed Apr 17 01:04:00 2013
New Revision: 179666
URL: http://llvm.org/viewvc/llvm-project?rev=179666&view=rev
Log:
Turn off libcall simplification when -fno-builtin is specified. Patch by Peter
Collingbourne.
Added:
dragonegg/trunk/test/validator/c/NoBuiltin.c
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=179666&r1=179665&r2=179666&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Wed Apr 17 01:04:00 2013
@@ -104,6 +104,12 @@ using namespace llvm;
// Non-zero if libcalls should not be simplified.
int flag_no_simplify_libcalls;
+// Whether -fno-builtin was specified.
+// In GCC < 4.6, this variable is only defined in C family front ends.
+#if (GCC_MINOR < 6)
+extern int flag_no_builtin __attribute__((weak));
+#endif
+
// Non-zero if red-zone is disabled.
//TODOstatic int flag_disable_red_zone = 0;
@@ -563,8 +569,10 @@ static void InstallLanguageSettings() {
flag_default_initialize_globals = false; // Uninitialized means what it says
flag_odr = true; // Ada obeys the one-definition-rule
} else if (LanguageName == "GNU C") {
+ flag_no_simplify_libcalls = flag_no_builtin;
} else if (LanguageName == "GNU C++") {
flag_odr = true; // C++ obeys the one-definition-rule
+ flag_no_simplify_libcalls = flag_no_builtin;
} else if (LanguageName == "GNU Fortran") {
flag_functions_from_args = true;
} else if (LanguageName == "GNU GIMPLE") { // LTO gold plugin
Added: dragonegg/trunk/test/validator/c/NoBuiltin.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/NoBuiltin.c?rev=179666&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/NoBuiltin.c (added)
+++ dragonegg/trunk/test/validator/c/NoBuiltin.c Wed Apr 17 01:04:00 2013
@@ -0,0 +1,7 @@
+// RUN: %dragonegg -fno-builtin -O2 -S %s -o - | FileCheck %s
+
+void foo(char *c, unsigned n) {
+ // CHECK-NOT: memset
+ while (n--)
+ *(c++) = 0;
+}
More information about the llvm-commits
mailing list