diff --git a/Makefile b/Makefile index 097da238..10d51bd5 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/cbackend.cpp b/cbackend.cpp index 7d4b4cfc..481ca3fd 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -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; } diff --git a/examples/aobench_instrumented/Makefile b/examples/aobench_instrumented/Makefile index 9921cf3e..d0b27cbf 100644 --- a/examples/aobench_instrumented/Makefile +++ b/examples/aobench_instrumented/Makefile @@ -1,5 +1,5 @@ -CXX=g++ -m64 +CXX=clang++ -m64 CXXFLAGS=-Iobjs/ -g3 -Wall ISPC=ispc ISPCFLAGS=-O2 --instrument --arch=x86-64 --target=sse2 diff --git a/examples/common.mk b/examples/common.mk index 367d3eb3..db7b8eee 100644 --- a/examples/common.mk +++ b/examples/common.mk @@ -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/) diff --git a/examples/simple/Makefile b/examples/simple/Makefile index 80f09193..dce7942b 100644 --- a/examples/simple/Makefile +++ b/examples/simple/Makefile @@ -1,5 +1,5 @@ -CXX=g++ -m64 +CXX=clang++ -m64 CXXFLAGS=-Iobjs/ -O3 -Wall ISPC=ispc ISPCFLAGS=-O2 --arch=x86-64 --target=sse2 diff --git a/fail_db.txt b/fail_db.txt index 886a4534..a9bf0031 100644 --- a/fail_db.txt +++ b/fail_db.txt @@ -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 * diff --git a/perf.py b/perf.py index 0d4926e0..2b5c6edd 100755 --- a/perf.py +++ b/perf.py @@ -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" diff --git a/run_tests.py b/run_tests.py index bf1b4a2b..803410b8 100755 --- a/run_tests.py +++ b/run_tests.py @@ -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)