about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-05-27 10:26:43 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-10-26 13:31:07 +0100
commit0a7963e0dd119285b9730473ba417d181583ad0a (patch)
tree523088dae85f3cb34cd88ebc9213c8bc66d27d15
parent1f1569510990a3330b6eb8e3499198294964a88e (diff)
downloadklee-0a7963e0dd119285b9730473ba417d181583ad0a.tar.gz
llvm5: test, add -disable-O0-optnone to -O0
Otherwise optimizations done in klee won't have any effect.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r--runtime/CMakeLists.txt8
-rw-r--r--runtime/Makefile.cmake.bitcode.rules2
-rw-r--r--test/CXX/ArrayNew.cpp2
-rw-r--r--test/CXX/New.cpp2
-rw-r--r--test/CXX/SimpleVirtual.cpp2
-rw-r--r--test/CXX/StaticConstructor.cpp2
-rw-r--r--test/CXX/StaticDestructor.cpp2
-rw-r--r--test/CXX/Trivial.cpp2
-rw-r--r--test/Coverage/ReadArgs.c2
-rw-r--r--test/Coverage/ReplayOutDir.c2
-rw-r--r--test/Feature/AliasFunction.c2
-rw-r--r--test/Feature/AliasFunctionExit.c2
-rw-r--r--test/Feature/ByteSwap.c2
-rw-r--r--test/Feature/CheckForImpliedValue.c.failing2
-rw-r--r--test/Feature/CompressedExprLogging.c2
-rw-r--r--test/Feature/DanglingConcreteReadExpr.c2
-rw-r--r--test/Feature/DoubleFree.c2
-rw-r--r--test/Feature/DumpStatesOnHalt.c2
-rw-r--r--test/Feature/ExitOnErrorType.c2
-rw-r--r--test/Feature/ExprLogging.c2
-rw-r--r--test/Feature/FloatingPt.c2
-rw-r--r--test/Feature/InAndOutOfBounds.c2
-rw-r--r--test/Feature/IsSymbolic.c2
-rw-r--r--test/Feature/KleeReportError.c2
-rw-r--r--test/Feature/LargeReturnTypes.cpp2
-rw-r--r--test/Feature/LinkLLVMLib.c4
-rw-r--r--test/Feature/LongDouble.c2
-rw-r--r--test/Feature/LongDoubleSupport.c2
-rw-r--r--test/Feature/MultipleFreeResolution.c2
-rw-r--r--test/Feature/MultipleReadResolution.c2
-rw-r--r--test/Feature/MultipleReallocResolution.c2
-rw-r--r--test/Feature/MultipleWriteResolution.c2
-rw-r--r--test/Feature/OneFreeError.c2
-rw-r--r--test/Feature/OneOutOfBounds.c2
-rw-r--r--test/Feature/Optimize.c2
-rw-r--r--test/Feature/OverlappedError.c2
-rw-r--r--test/Feature/OvershiftCheck.c2
-rw-r--r--test/Feature/PreferCex.c2
-rw-r--r--test/Feature/RaiseAsm.c2
-rw-r--r--test/Feature/Realloc.c2
-rw-r--r--test/Feature/ReplayPath.c4
-rw-r--r--test/Feature/RewriteEqualities.c2
-rw-r--r--test/Feature/Searchers.c2
-rw-r--r--test/Feature/SolverTimeout.c2
-rw-r--r--test/Feature/SourceMapping.c2
-rw-r--r--test/Feature/VarArgLongDouble.c2
-rw-r--r--test/Feature/Vararg.c2
-rw-r--r--test/Feature/WithLibc.c2
-rw-r--r--test/Feature/arithmetic-right-overshift-sym-conc.c2
-rw-r--r--test/Feature/consecutive_divide_by_zero.c2
-rw-r--r--test/Feature/const_array_opt1.c2
-rw-r--r--test/Feature/left-overshift-sym-conc.c2
-rw-r--r--test/Feature/logical-right-overshift-sym-conc.c2
-rw-r--r--test/Feature/srem.c2
-rw-r--r--test/Feature/ubsan_signed_overflow.c2
-rw-r--r--test/Feature/ubsan_unsigned_overflow.c2
-rw-r--r--test/Programs/pcregrep.c2
-rw-r--r--test/Replay/libkleeruntest/replay_invalid_klee_assume.c2
-rw-r--r--test/Replay/libkleeruntest/replay_invalid_klee_choose.c2
-rw-r--r--test/Replay/libkleeruntest/replay_invalid_klee_range.c2
-rw-r--r--test/Replay/libkleeruntest/replay_invalid_num_objects.c2
-rw-r--r--test/Replay/libkleeruntest/replay_invalid_object_names.c2
-rw-r--r--test/Replay/libkleeruntest/replay_invalid_object_size.c2
-rw-r--r--test/Replay/libkleeruntest/replay_klee_prefer_cex.c2
-rw-r--r--test/Replay/libkleeruntest/replay_posix_runtime.c2
-rw-r--r--test/Replay/libkleeruntest/replay_simple.c2
-rw-r--r--test/Replay/libkleeruntest/replay_two_objects.c2
-rw-r--r--test/Runtime/POSIX/DirConsistency.c4
-rw-r--r--test/Runtime/POSIX/DirSeek.c2
-rw-r--r--test/Runtime/POSIX/FDNumbers.c2
-rw-r--r--test/Runtime/POSIX/FD_Fail.c2
-rw-r--r--test/Runtime/POSIX/FD_Fail2.c2
-rw-r--r--test/Runtime/POSIX/Fcntl.c2
-rw-r--r--test/Runtime/POSIX/FilePerm.c2
-rw-r--r--test/Runtime/POSIX/FileTime.c2
-rw-r--r--test/Runtime/POSIX/FreeArgv.c2
-rw-r--r--test/Runtime/POSIX/Futimesat.c2
-rw-r--r--test/Runtime/POSIX/Getenv.c2
-rw-r--r--test/Runtime/POSIX/Ioctl.c2
-rw-r--r--test/Runtime/POSIX/Isatty.c2
-rw-r--r--test/Runtime/POSIX/MixedConcreteSymbolic.c2
-rw-r--r--test/Runtime/POSIX/Openat.c2
-rw-r--r--test/Runtime/POSIX/PrgName.c2
-rw-r--r--test/Runtime/POSIX/Read1.c2
-rw-r--r--test/Runtime/POSIX/Replay.c2
-rw-r--r--test/Runtime/POSIX/SELinux/SELinux.c2
-rw-r--r--test/Runtime/POSIX/SeedAndFail.c2
-rw-r--r--test/Runtime/POSIX/Stdin.c2
-rw-r--r--test/Runtime/POSIX/Write1.c2
-rw-r--r--test/Runtime/POSIX/Write2.c2
-rw-r--r--test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c2
-rw-r--r--test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c2
-rw-r--r--test/Solver/Z3ConstantArray.c2
-rw-r--r--test/VectorInstructions/extract_element.c2
-rw-r--r--test/VectorInstructions/extract_element_symbolic.c2
-rw-r--r--test/VectorInstructions/floating_point_ops_constant.c2
-rw-r--r--test/VectorInstructions/insert_element.c2
-rw-r--r--test/VectorInstructions/insert_element_symbolic.c2
-rw-r--r--test/VectorInstructions/integer_ops_constant.c2
-rw-r--r--test/VectorInstructions/integer_ops_signed_symbolic.c2
-rw-r--r--test/VectorInstructions/integer_ops_unsigned_symbolic.c2
-rw-r--r--test/VectorInstructions/shuffle_element.c2
-rw-r--r--test/lit.cfg2
-rw-r--r--test/lit.site.cfg.in4
-rw-r--r--test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c2
-rw-r--r--test/regression/2007-07-30-unflushed-byte.c2
-rw-r--r--test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c2
-rw-r--r--test/regression/2007-08-06-64bit-shift.c2
-rw-r--r--test/regression/2007-08-06-access-after-free.c2
-rw-r--r--test/regression/2007-08-08-free-zero.c2
-rw-r--r--test/regression/2007-08-16-valid-write-to-freed-object.c2
-rw-r--r--test/regression/2007-10-11-free-of-alloca.c2
-rw-r--r--test/regression/2007-10-12-failed-make-symbolic-after-copy.c2
-rw-r--r--test/regression/2008-03-04-free-of-global.c2
-rw-r--r--test/regression/2008-03-11-free-of-malloc-zero.c2
-rw-r--r--test/regression/2008-04-10-bad-alloca-free.c2
-rw-r--r--test/regression/2008-05-23-gep-with-global-const.c2
-rw-r--r--test/regression/2012-05-13-asm-causes-aborts.c2
-rw-r--r--test/regression/2014-07-04-unflushed-error-report.c2
-rw-r--r--test/regression/2014-09-13-debug-info.c2
-rw-r--r--test/regression/2014-12-08-ashr.c2
-rw-r--r--test/regression/2015-06-22-struct-write.c2
-rw-r--r--test/regression/2015-08-05-invalid-fork.c2
-rw-r--r--test/regression/2015-08-30-empty-constraints.c2
-rw-r--r--test/regression/2015-08-30-sdiv-1.c2
-rw-r--r--test/regression/2016-04-14-sdiv-2.c2
-rw-r--r--test/regression/2016-06-28-div-zero-bug.c2
-rw-r--r--test/regression/2016-08-06-klee-get-obj-size.c2
-rw-r--r--test/regression/2016-08-11-entry-point-internalize-pass.c2
-rw-r--r--test/regression/2016-08-12-empty-file.c2
-rw-r--r--test/regression/2016-11-24-bitcast-weak-alias.c2
-rw-r--r--test/regression/2016-12-14-alloc-alignment.c2
-rw-r--r--test/regression/2017-02-21-pathOS-id.c2
-rw-r--r--test/regression/2017-03-23-early-exit-log-stats.c2
-rw-r--r--test/regression/2018-05-05-number-instructions-dumped-states.c2
135 files changed, 147 insertions, 137 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 61693afc..e3619f3d 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -91,13 +91,19 @@ ExternalProject_Add(BuildKLEERuntimes
   INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "" # Dummy command
 )
 
+set(O0OPT "-O0")
+if (${LLVM_VERSION_MAJOR} GREATER 4)
+	set(O0OPT "${O0OPT} -Xclang -disable-O0-optnone")
+endif()
+
+
 # Use `ExternalProject_Add_Step` with `ALWAYS` argument instead of directly
 # building in `ExternalProject_Add` with `BUILD_ALWAYS` argument due to lack of
 # support for the `BUILD_ALWAYS` argument in CMake < 3.1.
 ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild
   # `env` is used here to make sure `MAKEFLAGS` of KLEE's build
   # is not propagated into the bitcode build system.
-  COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode all
+  COMMAND ${ENV_BINARY} MAKEFLAGS="" O0OPT=${O0OPT} ${MAKE_BINARY} -f Makefile.cmake.bitcode all
   ALWAYS ${EXTERNAL_PROJECT_BUILD_ALWAYS_ARG}
   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
   ${EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG}
diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules
index 41b2814e..db731ac5 100644
--- a/runtime/Makefile.cmake.bitcode.rules
+++ b/runtime/Makefile.cmake.bitcode.rules
@@ -40,7 +40,7 @@ endif
 ifeq ($(IS_RELEASE),1)
 LLVMCC.Flags += -O2
 else
-LLVMCC.Flags += -O0
+LLVMCC.Flags += $(O0OPT)
 endif
 
 # Handle assertion flags
diff --git a/test/CXX/ArrayNew.cpp b/test/CXX/ArrayNew.cpp
index 6a54083a..baad95fe 100644
--- a/test/CXX/ArrayNew.cpp
+++ b/test/CXX/ArrayNew.cpp
@@ -1,4 +1,4 @@
-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc
 
diff --git a/test/CXX/New.cpp b/test/CXX/New.cpp
index 5b90c7a4..71784f9f 100644
--- a/test/CXX/New.cpp
+++ b/test/CXX/New.cpp
@@ -1,4 +1,4 @@
-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc
 
diff --git a/test/CXX/SimpleVirtual.cpp b/test/CXX/SimpleVirtual.cpp
index b2db980d..7d0faa08 100644
--- a/test/CXX/SimpleVirtual.cpp
+++ b/test/CXX/SimpleVirtual.cpp
@@ -1,4 +1,4 @@
-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc
 
diff --git a/test/CXX/StaticConstructor.cpp b/test/CXX/StaticConstructor.cpp
index c184526e..3c61aec4 100644
--- a/test/CXX/StaticConstructor.cpp
+++ b/test/CXX/StaticConstructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t1.bc
 
diff --git a/test/CXX/StaticDestructor.cpp b/test/CXX/StaticDestructor.cpp
index 2cf01e3b..15520fc4 100644
--- a/test/CXX/StaticDestructor.cpp
+++ b/test/CXX/StaticDestructor.cpp
@@ -1,6 +1,6 @@
 // don't optimize this, llvm likes to turn the *p into unreachable
 
-// RUN: %llvmgxx %s -emit-llvm -g -O0 -c -o %t1.bc
+// RUN: %llvmgxx %s -emit-llvm -g %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --optimize=false --libc=klee --no-output %t1.bc 2> %t1.log
 // RUN: FileCheck --input-file %t1.log %s
diff --git a/test/CXX/Trivial.cpp b/test/CXX/Trivial.cpp
index 2b8ceed3..18845820 100644
--- a/test/CXX/Trivial.cpp
+++ b/test/CXX/Trivial.cpp
@@ -1,4 +1,4 @@
-// RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgxx %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error %t1.bc
 
diff --git a/test/Coverage/ReadArgs.c b/test/Coverage/ReadArgs.c
index 8eae53a1..531cc0a1 100644
--- a/test/Coverage/ReadArgs.c
+++ b/test/Coverage/ReadArgs.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: echo " --output-dir=%t.klee-out " > %t1.args
 // RUN: %klee @%t1.args %t1.bc
diff --git a/test/Coverage/ReplayOutDir.c b/test/Coverage/ReplayOutDir.c
index d9bffea0..fa06a269 100644
--- a/test/Coverage/ReplayOutDir.c
+++ b/test/Coverage/ReplayOutDir.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t1.out %t1.replay
 // RUN: %klee --output-dir=%t1.out %t1.bc
 // RUN: %klee --output-dir=%t1.replay --replay-ktest-dir=%t1.out %t1.bc
diff --git a/test/Feature/AliasFunction.c b/test/Feature/AliasFunction.c
index 019ebe67..1fd9d0e5 100644
--- a/test/Feature/AliasFunction.c
+++ b/test/Feature/AliasFunction.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: grep -c foo %t1.log | grep 5
diff --git a/test/Feature/AliasFunctionExit.c b/test/Feature/AliasFunctionExit.c
index 09ca8f46..4f0f8359 100644
--- a/test/Feature/AliasFunctionExit.c
+++ b/test/Feature/AliasFunctionExit.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: grep -c START %t1.log | grep 1
diff --git a/test/Feature/ByteSwap.c b/test/Feature/ByteSwap.c
index a2228905..da764fc0 100644
--- a/test/Feature/ByteSwap.c
+++ b/test/Feature/ByteSwap.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc
 
diff --git a/test/Feature/CheckForImpliedValue.c.failing b/test/Feature/CheckForImpliedValue.c.failing
index 0aa50f0b..2f45ec2e 100644
--- a/test/Feature/CheckForImpliedValue.c.failing
+++ b/test/Feature/CheckForImpliedValue.c.failing
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -f %t1.log
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --log-file %t1.log --debug-check-for-implied-values %t1.bc
diff --git a/test/Feature/CompressedExprLogging.c b/test/Feature/CompressedExprLogging.c
index 4813190d..30f8ad3c 100644
--- a/test/Feature/CompressedExprLogging.c
+++ b/test/Feature/CompressedExprLogging.c
@@ -1,5 +1,5 @@
 // REQUIRES: zlib
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t1.bc
 // We disable the cex-cache to eliminate nondeterminism across different
 // solvers, in particular when counting the number of queries in the last two
 // commands
diff --git a/test/Feature/DanglingConcreteReadExpr.c b/test/Feature/DanglingConcreteReadExpr.c
index 861f93eb..d904fd98 100644
--- a/test/Feature/DanglingConcreteReadExpr.c
+++ b/test/Feature/DanglingConcreteReadExpr.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --optimize=false --output-dir=%t.klee-out %t1.bc
 // RUN: grep "total queries = 2" %t.klee-out/info
diff --git a/test/Feature/DoubleFree.c b/test/Feature/DoubleFree.c
index b24de17d..3dbe4b24 100644
--- a/test/Feature/DoubleFree.c
+++ b/test/Feature/DoubleFree.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ptr.err
diff --git a/test/Feature/DumpStatesOnHalt.c b/test/Feature/DumpStatesOnHalt.c
index bc302456..21767798 100644
--- a/test/Feature/DumpStatesOnHalt.c
+++ b/test/Feature/DumpStatesOnHalt.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --stop-after-n-instructions=1 --dump-states-on-halt=true %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Feature/ExitOnErrorType.c b/test/Feature/ExitOnErrorType.c
index a68a92e0..0cbde8aa 100644
--- a/test/Feature/ExitOnErrorType.c
+++ b/test/Feature/ExitOnErrorType.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -exit-on-error-type Assert %t1.bc 2>&1
 
diff --git a/test/Feature/ExprLogging.c b/test/Feature/ExprLogging.c
index a85afc1b..142c4167 100644
--- a/test/Feature/ExprLogging.c
+++ b/test/Feature/ExprLogging.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t1.bc
 // We disable the cex-cache to eliminate nondeterminism across different solvers, in particular when counting the number of queries in the last two commands
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --use-cex-cache=false --use-query-log=all:kquery,all:smt2,solver:kquery,solver:smt2 --write-kqueries --write-cvcs --write-smt2s %t1.bc 2> %t2.log
diff --git a/test/Feature/FloatingPt.c b/test/Feature/FloatingPt.c
index be087935..e6e695ca 100644
--- a/test/Feature/FloatingPt.c
+++ b/test/Feature/FloatingPt.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c
index 9b913609..3c6fe37e 100644
--- a/test/Feature/InAndOutOfBounds.c
+++ b/test/Feature/InAndOutOfBounds.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ptr.err -o -f %t.klee-out/test000002.ptr.err
diff --git a/test/Feature/IsSymbolic.c b/test/Feature/IsSymbolic.c
index 02aa2332..8e39b99f 100644
--- a/test/Feature/IsSymbolic.c
+++ b/test/Feature/IsSymbolic.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/Feature/KleeReportError.c b/test/Feature/KleeReportError.c
index 96879a55..b8347254 100644
--- a/test/Feature/KleeReportError.c
+++ b/test/Feature/KleeReportError.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --emit-all-errors %t2.bc 2>&1 | FileCheck %s
 // RUN: ls %t.klee-out/ | grep .my.err | wc -l | grep 2
diff --git a/test/Feature/LargeReturnTypes.cpp b/test/Feature/LargeReturnTypes.cpp
index 84119624..92be31c2 100644
--- a/test/Feature/LargeReturnTypes.cpp
+++ b/test/Feature/LargeReturnTypes.cpp
@@ -1,5 +1,5 @@
 // REQUIRES: not-darwin
-// RUN: %llvmgxx -g -fno-exceptions -emit-llvm -O0 -c -o %t.bc %s
+// RUN: %llvmgxx -g -fno-exceptions -emit-llvm %O0opt -c -o %t.bc %s
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t.bc > %t.log
 
diff --git a/test/Feature/LinkLLVMLib.c b/test/Feature/LinkLLVMLib.c
index 34931409..1ad0fd38 100644
--- a/test/Feature/LinkLLVMLib.c
+++ b/test/Feature/LinkLLVMLib.c
@@ -1,7 +1,7 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc -DLINK_LLVM_LIB_TEST_LIB
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc -DLINK_LLVM_LIB_TEST_LIB
 // RUN: %llvmar r %t1.a %t1.bc
 //
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t2.bc -DLINK_LLVM_LIB_TEST_EXEC
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t2.bc -DLINK_LLVM_LIB_TEST_EXEC
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --link-llvm-lib %t1.a --output-dir=%t.klee-out --emit-all-errors --warnings-only-to-file=false %t2.bc 2>&1 | FileCheck %s
 
diff --git a/test/Feature/LongDouble.c b/test/Feature/LongDouble.c
index f69582b8..19f9360a 100644
--- a/test/Feature/LongDouble.c
+++ b/test/Feature/LongDouble.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc  -g -emit-llvm -O0 -c -o %t.bc %s
+// RUN: %llvmgcc  -g -emit-llvm %O0opt -c -o %t.bc %s
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t.bc > %t.log
 // RUN: FileCheck %s --input-file=%t.log
diff --git a/test/Feature/LongDoubleSupport.c b/test/Feature/LongDoubleSupport.c
index 4ea9daee..acde2d8e 100644
--- a/test/Feature/LongDoubleSupport.c
+++ b/test/Feature/LongDoubleSupport.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --optimize=0 --exit-on-error %t1.bc > %t2.out
 
diff --git a/test/Feature/MultipleFreeResolution.c b/test/Feature/MultipleFreeResolution.c
index 5c7dfdd8..540324a5 100644
--- a/test/Feature/MultipleFreeResolution.c
+++ b/test/Feature/MultipleFreeResolution.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --emit-all-errors %t1.bc 2>&1 | FileCheck %s
 // RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4
diff --git a/test/Feature/MultipleReadResolution.c b/test/Feature/MultipleReadResolution.c
index a586a3c8..6226d64a 100644
--- a/test/Feature/MultipleReadResolution.c
+++ b/test/Feature/MultipleReadResolution.c
@@ -2,7 +2,7 @@
 // RUN: echo "x" >> %t1.res
 // RUN: echo "x" >> %t1.res
 // RUN: echo "x" >> %t1.res
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: diff %t1.res %t1.log
diff --git a/test/Feature/MultipleReallocResolution.c b/test/Feature/MultipleReallocResolution.c
index a95d9d75..4db6be9f 100644
--- a/test/Feature/MultipleReallocResolution.c
+++ b/test/Feature/MultipleReallocResolution.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 // RUN: ls %t.klee-out/ | grep .err | wc -l | grep 2
diff --git a/test/Feature/MultipleWriteResolution.c b/test/Feature/MultipleWriteResolution.c
index 5f906836..22dd9730 100644
--- a/test/Feature/MultipleWriteResolution.c
+++ b/test/Feature/MultipleWriteResolution.c
@@ -2,7 +2,7 @@
 // RUN: echo "x" >> %t1.res
 // RUN: echo "x" >> %t1.res
 // RUN: echo "x" >> %t1.res
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: diff %t1.res %t1.log
diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c
index 64a0425d..e68f333f 100644
--- a/test/Feature/OneFreeError.c
+++ b/test/Feature/OneFreeError.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ptr.err
diff --git a/test/Feature/OneOutOfBounds.c b/test/Feature/OneOutOfBounds.c
index 88a2ae43..01fa0f92 100644
--- a/test/Feature/OneOutOfBounds.c
+++ b/test/Feature/OneOutOfBounds.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ptr.err
diff --git a/test/Feature/Optimize.c b/test/Feature/Optimize.c
index 9aa963ef..c0eb2d33 100644
--- a/test/Feature/Optimize.c
+++ b/test/Feature/Optimize.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -f %t2.log
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --stop-after-n-instructions=100 --optimize %t2.bc > %t3.log
diff --git a/test/Feature/OverlappedError.c b/test/Feature/OverlappedError.c
index a1b31f57..d02d2229 100644
--- a/test/Feature/OverlappedError.c
+++ b/test/Feature/OverlappedError.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 // RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4
diff --git a/test/Feature/OvershiftCheck.c b/test/Feature/OvershiftCheck.c
index ace54cee..0a5cfc3b 100644
--- a/test/Feature/OvershiftCheck.c
+++ b/test/Feature/OvershiftCheck.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log
 // RUN: FileCheck --input-file %t.log %s
diff --git a/test/Feature/PreferCex.c b/test/Feature/PreferCex.c
index a765eea8..8d88a3ce 100644
--- a/test/Feature/PreferCex.c
+++ b/test/Feature/PreferCex.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 // RUN: ktest-tool %t.klee-out/test000001.ktest | FileCheck %s
diff --git a/test/Feature/RaiseAsm.c b/test/Feature/RaiseAsm.c
index f8ba173a..fb30ea5d 100644
--- a/test/Feature/RaiseAsm.c
+++ b/test/Feature/RaiseAsm.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
diff --git a/test/Feature/Realloc.c b/test/Feature/Realloc.c
index d0c85b21..4f075e5e 100644
--- a/test/Feature/Realloc.c
+++ b/test/Feature/Realloc.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --warnings-only-to-file=false %t1.bc 2>&1 | FileCheck %s
 
diff --git a/test/Feature/ReplayPath.c b/test/Feature/ReplayPath.c
index 4a973dfd..558b0d3c 100644
--- a/test/Feature/ReplayPath.c
+++ b/test/Feature/ReplayPath.c
@@ -1,8 +1,8 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -DCOND_EXIT -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -DCOND_EXIT -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --write-paths %t1.bc > %t3.good
 
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out-2
 // RUN: %klee --output-dir=%t.klee-out-2 --replay-path %t.klee-out/test000001.path %t2.bc > %t3.log
 // RUN: diff %t3.log %t3.good
diff --git a/test/Feature/RewriteEqualities.c b/test/Feature/RewriteEqualities.c
index b3cc0ef7..5384c5c8 100644
--- a/test/Feature/RewriteEqualities.c
+++ b/test/Feature/RewriteEqualities.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs --write-kqueries --rewrite-equalities=false %t.bc
 // RUN: grep "N0:(Read w8 2 x)" %t.klee-out/test000003.kquery
diff --git a/test/Feature/Searchers.c b/test/Feature/Searchers.c
index a24cb7a3..efc2f376 100644
--- a/test/Feature/Searchers.c
+++ b/test/Feature/Searchers.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t2.bc
 // RUN: rm -rf %t.klee-out
diff --git a/test/Feature/SolverTimeout.c b/test/Feature/SolverTimeout.c
index aa86a856..a2faf08a 100644
--- a/test/Feature/SolverTimeout.c
+++ b/test/Feature/SolverTimeout.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --max-solver-time=1 %t1.bc
 // FIXME: This test occasionally fails when using Z3 4.4.1 but
diff --git a/test/Feature/SourceMapping.c b/test/Feature/SourceMapping.c
index bc13652d..aa849c5f 100644
--- a/test/Feature/SourceMapping.c
+++ b/test/Feature/SourceMapping.c
@@ -1,7 +1,7 @@
 // Check that we properly associate instruction level statistics with source
 // file and line.
 //
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 // RUN: FileCheck < %t.klee-out/run.istats %s
diff --git a/test/Feature/VarArgLongDouble.c b/test/Feature/VarArgLongDouble.c
index ae553131..63ba85c8 100644
--- a/test/Feature/VarArgLongDouble.c
+++ b/test/Feature/VarArgLongDouble.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc | FileCheck %s
 
diff --git a/test/Feature/Vararg.c b/test/Feature/Vararg.c
index 9f4e9dab..239ec9a3 100644
--- a/test/Feature/Vararg.c
+++ b/test/Feature/Vararg.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -g -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -g -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // This test needs deterministic allocation with enough spacing between the allocations.
 // Otherwise, if by coincidence the allocated vararg memory object is directly before another valid memory object,
diff --git a/test/Feature/WithLibc.c b/test/Feature/WithLibc.c
index 0eca8213..8c07041d 100644
--- a/test/Feature/WithLibc.c
+++ b/test/Feature/WithLibc.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee %t2.bc > %t3.log
 // RUN: echo "good" > %t3.good
diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c
index 6a9bbc21..4a0bc36f 100644
--- a/test/Feature/arithmetic-right-overshift-sym-conc.c
+++ b/test/Feature/arithmetic-right-overshift-sym-conc.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc
 // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt
diff --git a/test/Feature/consecutive_divide_by_zero.c b/test/Feature/consecutive_divide_by_zero.c
index ebe0dcb5..b44572aa 100644
--- a/test/Feature/consecutive_divide_by_zero.c
+++ b/test/Feature/consecutive_divide_by_zero.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -emit-llvm -c -g -O0 %s -o %t.bc
+// RUN: %llvmgcc -emit-llvm -c -g %O0opt %s -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -check-div-zero -emit-all-errors=0 %t.bc 2> %t.log
 // RUN: FileCheck --input-file=%t.log %s
diff --git a/test/Feature/const_array_opt1.c b/test/Feature/const_array_opt1.c
index ac43bdf7..b466e56c 100644
--- a/test/Feature/const_array_opt1.c
+++ b/test/Feature/const_array_opt1.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --const-array-opt --max-time=10 --only-output-states-covering-new %t.bc >%t.log
 // grep -q "Finished successfully!\n"
diff --git a/test/Feature/left-overshift-sym-conc.c b/test/Feature/left-overshift-sym-conc.c
index 8859c46c..05b89c68 100644
--- a/test/Feature/left-overshift-sym-conc.c
+++ b/test/Feature/left-overshift-sym-conc.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc
 // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt
diff --git a/test/Feature/logical-right-overshift-sym-conc.c b/test/Feature/logical-right-overshift-sym-conc.c
index 950b5992..b499cce6 100644
--- a/test/Feature/logical-right-overshift-sym-conc.c
+++ b/test/Feature/logical-right-overshift-sym-conc.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc
 // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt
diff --git a/test/Feature/srem.c b/test/Feature/srem.c
index f4fa8aa5..4c331dd0 100644
--- a/test/Feature/srem.c
+++ b/test/Feature/srem.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 %t.bc
 // RUN: grep "KLEE: done: explored paths = 5" %t.klee-out/info
diff --git a/test/Feature/ubsan_signed_overflow.c b/test/Feature/ubsan_signed_overflow.c
index 8d01f7d3..f4636c33 100644
--- a/test/Feature/ubsan_signed_overflow.c
+++ b/test/Feature/ubsan_signed_overflow.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -fsanitize=signed-integer-overflow -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -fsanitize=signed-integer-overflow -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc 2>&1 | FileCheck %s
 
diff --git a/test/Feature/ubsan_unsigned_overflow.c b/test/Feature/ubsan_unsigned_overflow.c
index e2d9592c..4c783b4c 100644
--- a/test/Feature/ubsan_unsigned_overflow.c
+++ b/test/Feature/ubsan_unsigned_overflow.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -fsanitize=unsigned-integer-overflow -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -fsanitize=unsigned-integer-overflow -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc 2>&1 | FileCheck %s
 
diff --git a/test/Programs/pcregrep.c b/test/Programs/pcregrep.c
index 634e1cc6..e2cb5362 100644
--- a/test/Programs/pcregrep.c
+++ b/test/Programs/pcregrep.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -m32 %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc -m32 %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc 2 2
 // XFAIL: x86_64
diff --git a/test/Replay/libkleeruntest/replay_invalid_klee_assume.c b/test/Replay/libkleeruntest/replay_invalid_klee_assume.c
index 10da5615..2257d31d 100644
--- a/test/Replay/libkleeruntest/replay_invalid_klee_assume.c
+++ b/test/Replay/libkleeruntest/replay_invalid_klee_assume.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -DASSUME_VALUE=1 %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc -DASSUME_VALUE=1 %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_invalid_klee_choose.c b/test/Replay/libkleeruntest/replay_invalid_klee_choose.c
index c64f913d..4cc36765 100644
--- a/test/Replay/libkleeruntest/replay_invalid_klee_choose.c
+++ b/test/Replay/libkleeruntest/replay_invalid_klee_choose.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_invalid_klee_range.c b/test/Replay/libkleeruntest/replay_invalid_klee_range.c
index 6542199e..7ae34899 100644
--- a/test/Replay/libkleeruntest/replay_invalid_klee_range.c
+++ b/test/Replay/libkleeruntest/replay_invalid_klee_range.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc -DBOUND_VALUE=32 -DFORCE_VALUE=20 %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_invalid_num_objects.c b/test/Replay/libkleeruntest/replay_invalid_num_objects.c
index 39b389df..43883067 100644
--- a/test/Replay/libkleeruntest/replay_invalid_num_objects.c
+++ b/test/Replay/libkleeruntest/replay_invalid_num_objects.c
@@ -1,5 +1,5 @@
 // Compile program that only makes one klee_make_symbolic() call
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_invalid_object_names.c b/test/Replay/libkleeruntest/replay_invalid_object_names.c
index 0285024c..67383a36 100644
--- a/test/Replay/libkleeruntest/replay_invalid_object_names.c
+++ b/test/Replay/libkleeruntest/replay_invalid_object_names.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -DOBJ_NAME=simple_name %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc -DOBJ_NAME=simple_name %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_invalid_object_size.c b/test/Replay/libkleeruntest/replay_invalid_object_size.c
index 504a3bd0..7619cd62 100644
--- a/test/Replay/libkleeruntest/replay_invalid_object_size.c
+++ b/test/Replay/libkleeruntest/replay_invalid_object_size.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -DINT_TYPE=uint8_t %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc -DINT_TYPE=uint8_t %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_klee_prefer_cex.c b/test/Replay/libkleeruntest/replay_klee_prefer_cex.c
index df441ea8..852554b0 100644
--- a/test/Replay/libkleeruntest/replay_klee_prefer_cex.c
+++ b/test/Replay/libkleeruntest/replay_klee_prefer_cex.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc
 
diff --git a/test/Replay/libkleeruntest/replay_posix_runtime.c b/test/Replay/libkleeruntest/replay_posix_runtime.c
index ac56179b..5956c918 100644
--- a/test/Replay/libkleeruntest/replay_posix_runtime.c
+++ b/test/Replay/libkleeruntest/replay_posix_runtime.c
@@ -1,6 +1,6 @@
 // REQUIRES: posix-runtime
 // FIXME: We need to fix a bug in libkleeRuntest
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_simple.c b/test/Replay/libkleeruntest/replay_simple.c
index 77e2f5d2..8155060d 100644
--- a/test/Replay/libkleeruntest/replay_simple.c
+++ b/test/Replay/libkleeruntest/replay_simple.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Replay/libkleeruntest/replay_two_objects.c b/test/Replay/libkleeruntest/replay_two_objects.c
index 7cbfe306..a8f1b87b 100644
--- a/test/Replay/libkleeruntest/replay_two_objects.c
+++ b/test/Replay/libkleeruntest/replay_two_objects.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Runtime/POSIX/DirConsistency.c b/test/Runtime/POSIX/DirConsistency.c
index 8faa9778..43216d54 100644
--- a/test/Runtime/POSIX/DirConsistency.c
+++ b/test/Runtime/POSIX/DirConsistency.c
@@ -1,8 +1,8 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out %t.klee-out-tmp
 // RUN: %gentmp %t.klee-out-tmp
 // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log
-// RUN: %llvmgcc -D_FILE_OFFSET_BITS=64 %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc -D_FILE_OFFSET_BITS=64 %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out %t.klee-out-tmp
 // RUN: %gentmp %t.klee-out-tmp
 // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log
diff --git a/test/Runtime/POSIX/DirSeek.c b/test/Runtime/POSIX/DirSeek.c
index 821ff8f5..449714b9 100644
--- a/test/Runtime/POSIX/DirSeek.c
+++ b/test/Runtime/POSIX/DirSeek.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -g -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -g -o %t2.bc
 // RUN: rm -rf %t.klee-out %t.klee-out-tmp
 // RUN: %gentmp %t.klee-out-tmp
 // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 2 2
diff --git a/test/Runtime/POSIX/FDNumbers.c b/test/Runtime/POSIX/FDNumbers.c
index c012174c..dc5e1734 100644
--- a/test/Runtime/POSIX/FDNumbers.c
+++ b/test/Runtime/POSIX/FDNumbers.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 
diff --git a/test/Runtime/POSIX/FD_Fail.c b/test/Runtime/POSIX/FD_Fail.c
index 018f43f8..74f94bf6 100644
--- a/test/Runtime/POSIX/FD_Fail.c
+++ b/test/Runtime/POSIX/FD_Fail.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --max-fail 1 | FileCheck %s
 
diff --git a/test/Runtime/POSIX/FD_Fail2.c b/test/Runtime/POSIX/FD_Fail2.c
index c1c2cc5f..8fef1eda 100644
--- a/test/Runtime/POSIX/FD_Fail2.c
+++ b/test/Runtime/POSIX/FD_Fail2.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --search=dfs %t1.bc --sym-files 1 10 --max-fail 2
 //
diff --git a/test/Runtime/POSIX/Fcntl.c b/test/Runtime/POSIX/Fcntl.c
index 13f6de78..e7a4cc4f 100644
--- a/test/Runtime/POSIX/Fcntl.c
+++ b/test/Runtime/POSIX/Fcntl.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 
diff --git a/test/Runtime/POSIX/FilePerm.c b/test/Runtime/POSIX/FilePerm.c
index c66e35de..2a18037f 100644
--- a/test/Runtime/POSIX/FilePerm.c
+++ b/test/Runtime/POSIX/FilePerm.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log 
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Runtime/POSIX/FileTime.c b/test/Runtime/POSIX/FileTime.c
index 489c09ed..34fd3468 100644
--- a/test/Runtime/POSIX/FileTime.c
+++ b/test/Runtime/POSIX/FileTime.c
@@ -1,5 +1,5 @@
 // Tests the functionality of setting and getting file access and modification times
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --sym-files 1 1
 
diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c
index 7a5445a3..fff1b2c4 100644
--- a/test/Runtime/POSIX/FreeArgv.c
+++ b/test/Runtime/POSIX/FreeArgv.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-args 1 1 1 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.free.err
diff --git a/test/Runtime/POSIX/Futimesat.c b/test/Runtime/POSIX/Futimesat.c
index a6d9dc04..eecaa880 100644
--- a/test/Runtime/POSIX/Futimesat.c
+++ b/test/Runtime/POSIX/Futimesat.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -DTDIR=%T -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -DTDIR=%T -o %t2.bc
 // RUN: touch %T/futimesat-dummy
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
diff --git a/test/Runtime/POSIX/Getenv.c b/test/Runtime/POSIX/Getenv.c
index eb3a611a..7b890b67 100644
--- a/test/Runtime/POSIX/Getenv.c
+++ b/test/Runtime/POSIX/Getenv.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 
diff --git a/test/Runtime/POSIX/Ioctl.c b/test/Runtime/POSIX/Ioctl.c
index c8937a37..61af8662 100644
--- a/test/Runtime/POSIX/Ioctl.c
+++ b/test/Runtime/POSIX/Ioctl.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t.bc --sym-stdin 4
 
diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c
index b9232e01..6501a4a3 100644
--- a/test/Runtime/POSIX/Isatty.c
+++ b/test/Runtime/POSIX/Isatty.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-stdin 10 --sym-stdout > %t.log 2>&1
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Runtime/POSIX/MixedConcreteSymbolic.c b/test/Runtime/POSIX/MixedConcreteSymbolic.c
index 48e06934..c32a8f54 100644
--- a/test/Runtime/POSIX/MixedConcreteSymbolic.c
+++ b/test/Runtime/POSIX/MixedConcreteSymbolic.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -allow-external-sym-calls --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-stdin 10  2>%t.log | FileCheck %s
 
diff --git a/test/Runtime/POSIX/Openat.c b/test/Runtime/POSIX/Openat.c
index c46c1269..648380dc 100644
--- a/test/Runtime/POSIX/Openat.c
+++ b/test/Runtime/POSIX/Openat.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Runtime/POSIX/PrgName.c b/test/Runtime/POSIX/PrgName.c
index d62fe0fa..2273c0d0 100644
--- a/test/Runtime/POSIX/PrgName.c
+++ b/test/Runtime/POSIX/PrgName.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-arg 10 >%t.log
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/Runtime/POSIX/Read1.c b/test/Runtime/POSIX/Read1.c
index 2b8cfa9d..00deab5f 100644
--- a/test/Runtime/POSIX/Read1.c
+++ b/test/Runtime/POSIX/Read1.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log
 
diff --git a/test/Runtime/POSIX/Replay.c b/test/Runtime/POSIX/Replay.c
index 2b166e1f..f9802837 100644
--- a/test/Runtime/POSIX/Replay.c
+++ b/test/Runtime/POSIX/Replay.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -DKLEE_EXECUTION %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc -DKLEE_EXECUTION %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-files 1 3
 // RUN: %klee-replay --create-files-only %t.klee-out/test000001.ktest
diff --git a/test/Runtime/POSIX/SELinux/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c
index 21bebc4d..d3a73e72 100644
--- a/test/Runtime/POSIX/SELinux/SELinux.c
+++ b/test/Runtime/POSIX/SELinux/SELinux.c
@@ -1,5 +1,5 @@
 /* Very basic test, as right now SELinux support is extremely basic */
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log
 // XFAIL: no-selinux
diff --git a/test/Runtime/POSIX/SeedAndFail.c b/test/Runtime/POSIX/SeedAndFail.c
index 964ec500..891921f0 100644
--- a/test/Runtime/POSIX/SeedAndFail.c
+++ b/test/Runtime/POSIX/SeedAndFail.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-files 1 10  2>%t.log
 // RUN: rm -rf %t.klee-out-2
diff --git a/test/Runtime/POSIX/Stdin.c b/test/Runtime/POSIX/Stdin.c
index 09eed6d2..036fecaa 100644
--- a/test/Runtime/POSIX/Stdin.c
+++ b/test/Runtime/POSIX/Stdin.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-stdin 4 > %t.log
 // RUN: grep "mode:file" %t.log
diff --git a/test/Runtime/POSIX/Write1.c b/test/Runtime/POSIX/Write1.c
index d260f2c3..19b3e81f 100644
--- a/test/Runtime/POSIX/Write1.c
+++ b/test/Runtime/POSIX/Write1.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
 
diff --git a/test/Runtime/POSIX/Write2.c b/test/Runtime/POSIX/Write2.c
index edb3e5b2..03501c3a 100644
--- a/test/Runtime/POSIX/Write2.c
+++ b/test/Runtime/POSIX/Write2.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
 
diff --git a/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c b/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c
index d82f0eb9..f3de99c1 100644
--- a/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c
+++ b/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --optimize --libc=uclibc %t1.bc
 
diff --git a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
index 47ee3a4d..299cbb12 100644
--- a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
+++ b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc %t1.bc
 
diff --git a/test/Solver/Z3ConstantArray.c b/test/Solver/Z3ConstantArray.c
index 482679e9..041e675d 100644
--- a/test/Solver/Z3ConstantArray.c
+++ b/test/Solver/Z3ConstantArray.c
@@ -1,5 +1,5 @@
 // REQUIRES: z3
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -solver-backend=z3 -write-cvcs -write-smt2s -debug-z3-dump-queries=%t.smt2   %t1.bc
 // RUN: cat %t.klee-out/test000001.smt2 | FileCheck --check-prefix=TEST-CASE %s
diff --git a/test/VectorInstructions/extract_element.c b/test/VectorInstructions/extract_element.c
index 5507d1d9..76034f18 100644
--- a/test/VectorInstructions/extract_element.c
+++ b/test/VectorInstructions/extract_element.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // constant folded away.
diff --git a/test/VectorInstructions/extract_element_symbolic.c b/test/VectorInstructions/extract_element_symbolic.c
index 268a63f6..1833eb34 100644
--- a/test/VectorInstructions/extract_element_symbolic.c
+++ b/test/VectorInstructions/extract_element_symbolic.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1
 // RUN: FileCheck -input-file=%t.log %s
diff --git a/test/VectorInstructions/floating_point_ops_constant.c b/test/VectorInstructions/floating_point_ops_constant.c
index c9777fa9..3d9fd098 100644
--- a/test/VectorInstructions/floating_point_ops_constant.c
+++ b/test/VectorInstructions/floating_point_ops_constant.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // constant folded away.
diff --git a/test/VectorInstructions/insert_element.c b/test/VectorInstructions/insert_element.c
index 7e79250d..772da987 100644
--- a/test/VectorInstructions/insert_element.c
+++ b/test/VectorInstructions/insert_element.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // constant folded away.
diff --git a/test/VectorInstructions/insert_element_symbolic.c b/test/VectorInstructions/insert_element_symbolic.c
index 66666a71..f75d3a09 100644
--- a/test/VectorInstructions/insert_element_symbolic.c
+++ b/test/VectorInstructions/insert_element_symbolic.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1
 // RUN: FileCheck -input-file=%t.log %s
diff --git a/test/VectorInstructions/integer_ops_constant.c b/test/VectorInstructions/integer_ops_constant.c
index 8993ff2e..920465ff 100644
--- a/test/VectorInstructions/integer_ops_constant.c
+++ b/test/VectorInstructions/integer_ops_constant.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // constant folded away.
diff --git a/test/VectorInstructions/integer_ops_signed_symbolic.c b/test/VectorInstructions/integer_ops_signed_symbolic.c
index c2f6b5f9..10ede925 100644
--- a/test/VectorInstructions/integer_ops_signed_symbolic.c
+++ b/test/VectorInstructions/integer_ops_signed_symbolic.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // optimized away.
diff --git a/test/VectorInstructions/integer_ops_unsigned_symbolic.c b/test/VectorInstructions/integer_ops_unsigned_symbolic.c
index 8a7330c0..aadeb585 100644
--- a/test/VectorInstructions/integer_ops_unsigned_symbolic.c
+++ b/test/VectorInstructions/integer_ops_unsigned_symbolic.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // optimized away.
diff --git a/test/VectorInstructions/shuffle_element.c b/test/VectorInstructions/shuffle_element.c
index 32653490..bf1f83f6 100644
--- a/test/VectorInstructions/shuffle_element.c
+++ b/test/VectorInstructions/shuffle_element.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // NOTE: Have to pass `--optimize=false` to avoid vector operations being
 // constant folded away.
diff --git a/test/lit.cfg b/test/lit.cfg
index 0bbadafb..a9982150 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -84,7 +84,7 @@ if config.test_exec_root is None:
 
 
 # Add substitutions from lit.site.cfg
-subs = [ 'llvmgcc', 'llvmgxx', 'cc', 'cxx']
+subs = [ 'llvmgcc', 'llvmgxx', 'cc', 'cxx', 'O0opt' ]
 for name in subs:
   value = getattr(config, name, None)
   if value == None:
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 9ef21489..6bb0e297 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -21,6 +21,10 @@ config.llvmgxx = "@LLVMCXX@"
 config.cc = "@NATIVE_CC@"
 config.cxx = "@NATIVE_CXX@"
 
+config.O0opt = "-O0"
+if @LLVM_VERSION_MAJOR@ >= 5:
+  config.O0opt += " -Xclang -disable-O0-optnone"
+
 # Features
 config.enable_uclibc = True if @ENABLE_UCLIBC@ == 1 else False
 config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False
diff --git a/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c b/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c
index 9b06a797..e933d926 100644
--- a/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c
+++ b/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2007-07-30-unflushed-byte.c b/test/regression/2007-07-30-unflushed-byte.c
index b9f6b237..ddbfecd7 100644
--- a/test/regression/2007-07-30-unflushed-byte.c
+++ b/test/regression/2007-07-30-unflushed-byte.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c b/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c
index 47cd87d8..050b6393 100644
--- a/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c
+++ b/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2007-08-06-64bit-shift.c b/test/regression/2007-08-06-64bit-shift.c
index c6c1f34d..95a719a7 100644
--- a/test/regression/2007-08-06-64bit-shift.c
+++ b/test/regression/2007-08-06-64bit-shift.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2007-08-06-access-after-free.c b/test/regression/2007-08-06-access-after-free.c
index 783b3885..bba7b97c 100644
--- a/test/regression/2007-08-06-access-after-free.c
+++ b/test/regression/2007-08-06-access-after-free.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2007-08-08-free-zero.c b/test/regression/2007-08-08-free-zero.c
index 3718f3cf..192b2841 100644
--- a/test/regression/2007-08-08-free-zero.c
+++ b/test/regression/2007-08-08-free-zero.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 // RUN: ls %t.klee-out | not grep *.err
diff --git a/test/regression/2007-08-16-valid-write-to-freed-object.c b/test/regression/2007-08-16-valid-write-to-freed-object.c
index b3257100..18dec41f 100644
--- a/test/regression/2007-08-16-valid-write-to-freed-object.c
+++ b/test/regression/2007-08-16-valid-write-to-freed-object.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2007-10-11-free-of-alloca.c b/test/regression/2007-10-11-free-of-alloca.c
index cfd633dc..b6b38328 100644
--- a/test/regression/2007-10-11-free-of-alloca.c
+++ b/test/regression/2007-10-11-free-of-alloca.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.free.err
diff --git a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c
index 800b57e7..85cc7c5b 100644
--- a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c
+++ b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 // RUN: test -f %t.klee-out/test000001.ktest
diff --git a/test/regression/2008-03-04-free-of-global.c b/test/regression/2008-03-04-free-of-global.c
index 3416fd61..ac9cb7de 100644
--- a/test/regression/2008-03-04-free-of-global.c
+++ b/test/regression/2008-03-04-free-of-global.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -g -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
 // RUN: test -f %t.klee-out/test000001.free.err
diff --git a/test/regression/2008-03-11-free-of-malloc-zero.c b/test/regression/2008-03-11-free-of-malloc-zero.c
index 07ec2918..6089df94 100644
--- a/test/regression/2008-03-11-free-of-malloc-zero.c
+++ b/test/regression/2008-03-11-free-of-malloc-zero.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
diff --git a/test/regression/2008-04-10-bad-alloca-free.c b/test/regression/2008-04-10-bad-alloca-free.c
index 3404a42e..afff4210 100644
--- a/test/regression/2008-04-10-bad-alloca-free.c
+++ b/test/regression/2008-04-10-bad-alloca-free.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
diff --git a/test/regression/2008-05-23-gep-with-global-const.c b/test/regression/2008-05-23-gep-with-global-const.c
index 6bd78dd2..e93692f9 100644
--- a/test/regression/2008-05-23-gep-with-global-const.c
+++ b/test/regression/2008-05-23-gep-with-global-const.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -emit-llvm -O0 -c -o %t.bc %s
+// RUN: %llvmgcc -emit-llvm %O0opt -c -o %t.bc %s
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t.bc
 
diff --git a/test/regression/2012-05-13-asm-causes-aborts.c b/test/regression/2012-05-13-asm-causes-aborts.c
index 322e5bb8..cc73f0b3 100644
--- a/test/regression/2012-05-13-asm-causes-aborts.c
+++ b/test/regression/2012-05-13-asm-causes-aborts.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t1.bc
 
diff --git a/test/regression/2014-07-04-unflushed-error-report.c b/test/regression/2014-07-04-unflushed-error-report.c
index 0b98944a..a0404db6 100644
--- a/test/regression/2014-07-04-unflushed-error-report.c
+++ b/test/regression/2014-07-04-unflushed-error-report.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log
 // RUN: FileCheck -input-file=%t.klee-out/test000001.overshift.err %s
diff --git a/test/regression/2014-09-13-debug-info.c b/test/regression/2014-09-13-debug-info.c
index e372e89e..ddf8461d 100644
--- a/test/regression/2014-09-13-debug-info.c
+++ b/test/regression/2014-09-13-debug-info.c
@@ -1,6 +1,6 @@
 // Check that we properly detect states covering new instructions.
 //
-// RUN: %llvmgcc -I../../../include %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %llvmgcc -I../../../include %s -emit-llvm %O0opt -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --only-output-states-covering-new %t1.bc
 
diff --git a/test/regression/2014-12-08-ashr.c b/test/regression/2014-12-08-ashr.c
index 3fe7f62b..be350729 100644
--- a/test/regression/2014-12-08-ashr.c
+++ b/test/regression/2014-12-08-ashr.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -exit-on-error %t.bc
 
diff --git a/test/regression/2015-06-22-struct-write.c b/test/regression/2015-06-22-struct-write.c
index 6efc4ee6..54bb5d1f 100644
--- a/test/regression/2015-06-22-struct-write.c
+++ b/test/regression/2015-06-22-struct-write.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -exit-on-error %t.bc
 
diff --git a/test/regression/2015-08-05-invalid-fork.c b/test/regression/2015-08-05-invalid-fork.c
index 7c35872c..d089ed11 100644
--- a/test/regression/2015-08-05-invalid-fork.c
+++ b/test/regression/2015-08-05-invalid-fork.c
@@ -3,7 +3,7 @@
    is printed a single time. 
 */
 
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc | FileCheck %s
 
diff --git a/test/regression/2015-08-30-empty-constraints.c b/test/regression/2015-08-30-empty-constraints.c
index b07beccd..a75dd8a4 100644
--- a/test/regression/2015-08-30-empty-constraints.c
+++ b/test/regression/2015-08-30-empty-constraints.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc 2> %t.log
 // RUN: FileCheck -input-file=%t.log %s
diff --git a/test/regression/2015-08-30-sdiv-1.c b/test/regression/2015-08-30-sdiv-1.c
index a90df308..6994dbdb 100644
--- a/test/regression/2015-08-30-sdiv-1.c
+++ b/test/regression/2015-08-30-sdiv-1.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -exit-on-error -solver-optimize-divides=true %t.bc
 // RUN: rm -rf %t.klee-out
diff --git a/test/regression/2016-04-14-sdiv-2.c b/test/regression/2016-04-14-sdiv-2.c
index 974036ee..aab14c46 100644
--- a/test/regression/2016-04-14-sdiv-2.c
+++ b/test/regression/2016-04-14-sdiv-2.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -exit-on-error -solver-optimize-divides=true %t.bc >%t1.log
 // RUN: grep "m is 2" %t1.log
diff --git a/test/regression/2016-06-28-div-zero-bug.c b/test/regression/2016-06-28-div-zero-bug.c
index 76e70ad1..f2214039 100644
--- a/test/regression/2016-06-28-div-zero-bug.c
+++ b/test/regression/2016-06-28-div-zero-bug.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --use-cex-cache=false %t.bc >%t1.log
 
diff --git a/test/regression/2016-08-06-klee-get-obj-size.c b/test/regression/2016-08-06-klee-get-obj-size.c
index df4114ff..3d3dc357 100644
--- a/test/regression/2016-08-06-klee-get-obj-size.c
+++ b/test/regression/2016-08-06-klee-get-obj-size.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out %t.bc
 // RUN: test -f %t.klee-out/test000001.assert.err
diff --git a/test/regression/2016-08-11-entry-point-internalize-pass.c b/test/regression/2016-08-11-entry-point-internalize-pass.c
index 4cd8ff8d..19580601 100644
--- a/test/regression/2016-08-11-entry-point-internalize-pass.c
+++ b/test/regression/2016-08-11-entry-point-internalize-pass.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --entry-point=entry %t.bc
 
diff --git a/test/regression/2016-08-12-empty-file.c b/test/regression/2016-08-12-empty-file.c
index 56695fe1..8165f924 100644
--- a/test/regression/2016-08-12-empty-file.c
+++ b/test/regression/2016-08-12-empty-file.c
@@ -1,5 +1,5 @@
 // REQUIRES: posix-runtime
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: not %klee --output-dir=%t.klee-out %t.bc >%t1.log 2>&1
 // RUN: FileCheck -input-file=%t1.log -check-prefix=CHECK-MAIN-NOT-FOUND %s
diff --git a/test/regression/2016-11-24-bitcast-weak-alias.c b/test/regression/2016-11-24-bitcast-weak-alias.c
index b20e205e..d420ac52 100644
--- a/test/regression/2016-11-24-bitcast-weak-alias.c
+++ b/test/regression/2016-11-24-bitcast-weak-alias.c
@@ -1,5 +1,5 @@
 // REQUIRES: not-darwin
-// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -Wall -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -exit-on-error -search=nurs:covnew %t.bc DUMMY_ARG >%t1.log 2>&1
 // RUN: FileCheck -input-file=%t1.log %s
diff --git a/test/regression/2016-12-14-alloc-alignment.c b/test/regression/2016-12-14-alloc-alignment.c
index db66d191..8c58d6f9 100644
--- a/test/regression/2016-12-14-alloc-alignment.c
+++ b/test/regression/2016-12-14-alloc-alignment.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -Wall -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -Wall -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t.bc
 #include <assert.h>
diff --git a/test/regression/2017-02-21-pathOS-id.c b/test/regression/2017-02-21-pathOS-id.c
index d3bffbe0..9be321de 100644
--- a/test/regression/2017-02-21-pathOS-id.c
+++ b/test/regression/2017-02-21-pathOS-id.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out -write-paths %t.bc 2> %t.log
 // RUN: cat %t.klee-out/test000001.path | wc -l | grep -q 1
diff --git a/test/regression/2017-03-23-early-exit-log-stats.c b/test/regression/2017-03-23-early-exit-log-stats.c
index 96d3c30f..d68bfa8f 100644
--- a/test/regression/2017-03-23-early-exit-log-stats.c
+++ b/test/regression/2017-03-23-early-exit-log-stats.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
+// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // Delay writing instructions so that we ensure on exit that flush happens
 // RUN: not %klee --output-dir=%t.klee-out -exit-on-error -stats-write-interval=0 -stats-write-after-instructions=999999 %t.bc 2> %t.log
diff --git a/test/regression/2018-05-05-number-instructions-dumped-states.c b/test/regression/2018-05-05-number-instructions-dumped-states.c
index 5f2af61e..8d183b77 100644
--- a/test/regression/2018-05-05-number-instructions-dumped-states.c
+++ b/test/regression/2018-05-05-number-instructions-dumped-states.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc
+// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee -stop-after-n-instructions=1 --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s