From 6c7bddb28babbd2e5b8bdac2d1dc5a49016714a1 Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Sun, 15 May 2016 16:41:58 +0000 Subject: [PATCH] Use __builtin_alloca with __GNUC__ llvm-svn: 269592 --- compiler-rt/lib/profile/InstrProfilingPort.h | 5 ++--- compiler-rt/lib/profile/InstrProfilingWriter.c | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h index 0f826cbc9cd2..9e3fb8389aa2 100644 --- a/compiler-rt/lib/profile/InstrProfilingPort.h +++ b/compiler-rt/lib/profile/InstrProfilingPort.h @@ -14,10 +14,12 @@ #define COMPILER_RT_ALIGNAS(x) __declspec(align(x)) #define COMPILER_RT_VISIBILITY #define COMPILER_RT_WEAK __declspec(selectany) +#define COMPILER_RT_ALLOCA _alloca #elif __GNUC__ #define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x))) #define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden"))) #define COMPILER_RT_WEAK __attribute__((weak)) +#define COMPILER_RT_ALLOCA __builtin_alloca #endif #define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect))) @@ -25,14 +27,11 @@ #define COMPILER_RT_MAX_HOSTLEN 128 #ifdef _MSC_VER #define COMPILER_RT_GETHOSTNAME(Name, Len) gethostname(Name, Len) -#define COMPILER_RT_ALLOCA _alloca #elif defined(__PS4__) #define COMPILER_RT_GETHOSTNAME(Name, Len) (-1) -#define COMPILER_RT_ALLOCA alloca #else #define COMPILER_RT_GETHOSTNAME(Name, Len) lprofGetHostName(Name, Len) #define COMPILER_RT_HAS_UNAME 1 -#define COMPILER_RT_ALLOCA alloca #endif #if COMPILER_RT_HAS_ATOMICS == 1 diff --git a/compiler-rt/lib/profile/InstrProfilingWriter.c b/compiler-rt/lib/profile/InstrProfilingWriter.c index da0b58df0821..3e90b1d496aa 100644 --- a/compiler-rt/lib/profile/InstrProfilingWriter.c +++ b/compiler-rt/lib/profile/InstrProfilingWriter.c @@ -10,11 +10,8 @@ #include "InstrProfiling.h" #include "InstrProfilingInternal.h" #ifdef _MSC_VER +/* For _alloca */ #include -#elif defined(__FreeBSD__) -#include -#else -#include #endif #include