Merge pull request #627 from dbabokin/clang_build

Switch over to clang as default C++ compiler for build and test
This commit is contained in:
Dmitry Babokin
2013-10-11 07:13:35 -07:00
8 changed files with 91 additions and 15 deletions

View File

@@ -109,14 +109,13 @@ else
BUILD_VERSION:=$(GIT_REVISION)
endif
CXX=g++
CPP=cpp
CXX=clang++
OPT=-O2
CXXFLAGS=$(OPT) $(LLVM_CXXFLAGS) -I. -Iobjs/ -I$(CLANG_INCLUDE) \
$(LLVM_VERSION_DEF) \
-Wall \
-DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" \
-Wno-sign-compare
-Wno-sign-compare -Wno-unused-function
ifneq ($(LLVM_VERSION),LLVM_3_1)
CXXFLAGS+=-Werror
endif
@@ -202,9 +201,14 @@ ispc: print_llvm_src dirs $(OBJS)
@$(CXX) $(OPT) $(LDFLAGS) -o $@ $(OBJS) $(ISPC_LIBS)
# Use clang as a default compiler, instead of gcc
# This is default now.
clang: ispc
clang: CXX=clang++
# Use gcc as a default compiler, instead of gcc
gcc: ispc
gcc: CXX=clang++
# Build ispc with address sanitizer instrumentation using clang compiler
# Note that this is not portable build
asan: clang

View File

@@ -3066,7 +3066,7 @@ void CWriter::visitReturnInst(llvm::ReturnInst &I) {
// Don't output a void return if this is the last basic block in the function
if (I.getNumOperands() == 0 &&
&*--I.getParent()->getParent()->end() == I.getParent() &&
!I.getParent()->size() == 1) {
(!I.getParent()->size()) == 1) {
return;
}

View File

@@ -1,5 +1,5 @@
CXX=g++ -m64
CXX=clang++ -m64
CXXFLAGS=-Iobjs/ -g3 -Wall
ISPC=ispc
ISPCFLAGS=-O2 --instrument --arch=x86-64 --target=sse2

View File

@@ -3,14 +3,14 @@ TASK_CXX=../tasksys.cpp
TASK_LIB=-lpthread
TASK_OBJ=objs/tasksys.o
CXX=g++
CXXFLAGS=-Iobjs/ -O2
CC=gcc
CCFLAGS=-Iobjs/ -O2
CXX=clang++
CXXFLAGS+=-Iobjs/ -O2
CC=clang
CCFLAGS+=-Iobjs/ -O2
LIBS=-lm $(TASK_LIB) -lstdc++
ISPC=ispc
ISPC_FLAGS=-O2
ISPC_FLAGS+=-O2
ISPC_HEADER=objs/$(ISPC_SRC:.ispc=_ispc.h)
ARCH:=$(shell uname -m | sed -e s/x86_64/x86/ -e s/i686/x86/ -e s/arm.*/arm/ -e s/sa110/arm/)

View File

@@ -1,5 +1,5 @@
CXX=g++ -m64
CXX=clang++ -m64
CXXFLAGS=-Iobjs/ -O3 -Wall
ISPC=ispc
ISPCFLAGS=-O2 --arch=x86-64 --target=sse2

View File

@@ -891,3 +891,72 @@
.\tests\uint64-min-1.ispc runfail x86 avx1-i64x4 Windows LLVM 3.3 cl -O2 *
.\tests\uint64-min.ispc runfail x86 avx1-i64x4 Windows LLVM 3.3 cl -O2 *
.\tests\reduce-min-uint64.ispc runfail x86 avx1-i64x4 Windows LLVM 3.4 cl -O2 *
./tests/atomics-13.ispc compfail x86 sse4-i16x8 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/atomics-13.ispc compfail x86-64 sse4-i16x8 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-4.ispc runfail x86 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-5.ispc runfail x86 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-6.ispc runfail x86 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/atomics-13.ispc compfail x86 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-4.ispc runfail x86-64 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-5.ispc runfail x86-64 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-6.ispc runfail x86-64 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/atomics-13.ispc compfail x86-64 sse4-i8x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 generic-4 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/short-vec-8.ispc compfail x86-64 generic-4 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/test-141.ispc runfail x86-64 generic-16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/test-143.ispc runfail x86-64 generic-16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 generic-16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/avg-down-int8.ispc compfail x86 avx1.1-i32x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/avg-up-int8.ispc compfail x86 avx1.1-i32x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/avg-down-int8.ispc compfail x86-64 avx1.1-i32x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/avg-up-int8.ispc compfail x86-64 avx1.1-i32x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/test-141.ispc runfail x86 avx2-i32x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/test-141.ispc runfail x86-64 avx2-i32x16 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/reduce-equal-4.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.3 clang++3.3 -O2 *
./tests/funcptr-null-4.ispc runfail x86 sse4-i8x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/funcptr-null-5.ispc runfail x86 sse4-i8x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/funcptr-null-6.ispc runfail x86 sse4-i8x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/funcptr-null-4.ispc runfail x86-64 sse4-i8x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/funcptr-null-5.ispc runfail x86-64 sse4-i8x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/funcptr-null-6.ispc runfail x86-64 sse4-i8x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-down-int8.ispc compfail x86 avx1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-up-int8.ispc compfail x86 avx1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-down-int8.ispc compfail x86-64 avx1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-up-int8.ispc compfail x86-64 avx1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 generic-4 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/short-vec-8.ispc compfail x86-64 generic-4 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/test-141.ispc runfail x86-64 generic-16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/test-143.ispc runfail x86-64 generic-16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/ptr-assign-lhs-math-1.ispc compfail x86-64 generic-16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-down-int8.ispc compfail x86 avx1.1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-up-int8.ispc compfail x86 avx1.1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-down-int8.ispc compfail x86-64 avx1.1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/avg-up-int8.ispc compfail x86-64 avx1.1-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/atomics-varyingptr-2.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/atomics-varyingptr-3.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/atomics-varyingptr-4.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-11.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-12.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-13.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-4.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-5.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-6.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-7.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-8.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-swap.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-varyingptr-2.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-varyingptr-3.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/local-atomics-varyingptr-4.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/memset-varying.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-1.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-12.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-13.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-2.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-3.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-4.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-5.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-6.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal-7.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/reduce-equal.ispc compfail x86-64 avx2-i32x8 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/test-141.ispc runfail x86 avx2-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *
./tests/test-141.ispc runfail x86-64 avx2-i32x16 Linux LLVM 3.4 clang++3.3 -O2 *

View File

@@ -326,8 +326,8 @@ def perf(options1, args):
ref_compiler_exists = False
if is_windows == False:
ispc_test = "ispc"
ref_compiler = "g++"
refc_compiler = "gcc"
ref_compiler = "clang++"
refc_compiler = "clang"
if options.compiler != "":
if options.compiler == "clang" or options.compiler == "clang++":
ref_compiler = "clang++"
@@ -335,6 +335,9 @@ def perf(options1, args):
if options.compiler == "icc" or options.compiler == "icpc":
ref_compiler = "icpc"
refc_compiler = "icc"
if options.compiler == "gcc" or options.compiler == "g++":
ref_compiler = "g++"
refc_compiler = "gcc"
else:
ispc_test = "ispc.exe"
ref_compiler = "cl.exe"

View File

@@ -446,7 +446,7 @@ def verify():
f = open(test_states, 'r')
f_lines = f.readlines()
f.close()
check = [["g++", "clang", "cl"],["-O0", "-O2"],["x86","x86-64"],
check = [["g++", "clang++", "cl"],["-O0", "-O2"],["x86","x86-64"],
["Linux","Windows","Mac"],["LLVM 3.1","LLVM 3.2","LLVM 3.3","LLVM head"],
["sse2-i32x4", "sse2-i32x8", "sse4-i32x4", "sse4-i32x8", "sse4-i16x8",
"sse4-i8x16", "avx1-i32x8", "avx1-i32x16", "avx1-i64x4", "avx1.1-i32x8", "avx1.1-i32x16",
@@ -550,7 +550,7 @@ def run_tests(options1, args, print_version):
if is_windows:
options.compiler_exe = "cl.exe"
else:
options.compiler_exe = "g++"
options.compiler_exe = "clang++"
# checks the required compiler otherwise prints an error message
PATH_dir = string.split(os.getenv("PATH"), os.pathsep)