Merge "Add --check to check LLVM"
diff --git a/build/tools/build-host-prebuilts.sh b/build/tools/build-host-prebuilts.sh
index f0c578b..9f63e5c 100755
--- a/build/tools/build-host-prebuilts.sh
+++ b/build/tools/build-host-prebuilts.sh
@@ -53,6 +53,10 @@
 LLVM_VERSION_LIST=$DEFAULT_LLVM_VERSION_LIST
 register_var_option "--llvm-version-list=<vers>" LLVM_VERSION_LIST "List of LLVM release versions"
 
+CHECK_FLAG=
+do_check_option () { CHECK_FLAG="--check"; }
+register_option "--check" do_check_option "Check host prebuilts"
+
 register_try64_option
 
 PROGRAM_PARAMETERS="<toolchain-src-dir>"
@@ -264,7 +268,7 @@
     fi
     for LLVM_VERSION in $LLVM_VERSION_LIST; do
         echo "Building $SYSTEM clang/llvm-$LLVM_VERSION"
-        run $BUILDTOOLS/build-llvm.sh "$SRC_DIR" "$NDK_DIR" "llvm-$LLVM_VERSION" $TOOLCHAIN_FLAGS $POLLY_FLAGS
+        run $BUILDTOOLS/build-llvm.sh "$SRC_DIR" "$NDK_DIR" "llvm-$LLVM_VERSION" $TOOLCHAIN_FLAGS $POLLY_FLAGS $CHECK_FLAG
         fail_panic "Could not build llvm for $SYSTEM"
     done
 
diff --git a/build/tools/build-llvm.sh b/build/tools/build-llvm.sh
index 2da41ea..44ad805 100755
--- a/build/tools/build-llvm.sh
+++ b/build/tools/build-llvm.sh
@@ -47,9 +47,12 @@
 
 POLLY=no
 do_polly_option () { POLLY=yes; }
-
 register_option "--with-polly" do_polly_option "Enable Polyhedral optimizations for LLVM"
 
+CHECK=no
+do_check_option () { CHECK=yes; }
+register_option "--check" do_check_option "Check LLVM"
+
 register_jobs_option
 register_mingw_option
 register_try64_option
@@ -214,7 +217,7 @@
 run make -j$NUM_JOBS
 fail_panic "Couldn't compile llvm toolchain"
 
-if [ "$MINGW" != "yes" ] ; then
+if [ "$CHECK" = "yes" -a "$MINGW" != "yes" ] ; then
     # run the regression test
     dump "Running  : llvm toolchain regression test"
     cd $LLVM_BUILD_OUT