From dd567654e719a2f54a559b0292d2f797acb90341 Mon Sep 17 00:00:00 2001 From: Andrey Guskov Date: Fri, 27 Mar 2015 14:52:18 +0300 Subject: [PATCH] Fixed ISPC debug info generator, added debug tests --- alloy.py | 46 +++++++++++++++++++++++++++++++--------------- func.cpp | 22 ---------------------- module.cpp | 6 ++++++ 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/alloy.py b/alloy.py index e07bcfd9..40b83ae7 100755 --- a/alloy.py +++ b/alloy.py @@ -430,7 +430,7 @@ def execute_stability(stability, R, print_version): str_time = " " + time + "\n" else: str_time = "\n" - print_debug(temp[4][1:-3] + str_fails + str_new_fails + str_new_passes + str_time, False, stability_log) + print_debug(temp[4][1:-3] + stability1.ispc_flags + str_fails + str_new_fails + str_new_passes + str_time, False, stability_log) ''' @@ -515,12 +515,18 @@ def validation_run(only, only_targets, reference_branch, number, notify, update, LLVM = [] targets = [] sde_targets = [] + dbg_begin = 0 + dbg_total = 2 # parsing option only, update parameters of run if "-O2" in only: opts.append(False) if "-O0" in only: opts.append(True) + if "debug" in only and not ("nodebug" in only): + dbg_begin = 1 + if "nodebug" in only and not ("debug" in only): + dbg_total = 1 if "x86" in only and not ("x86-64" in only): archs.append("x86") if "x86-64" in only: @@ -589,6 +595,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update, R = [[[],[]],[[],[]],[[],[]],[[],[]]] print_debug("\n" + common.get_host_name() + "\n", False, stability_log) print_debug("\n_________________________STABILITY REPORT_________________________\n", False, stability_log) + ispc_flags_tmp = stability.ispc_flags for i in range(0,len(LLVM)): R_tmp = [[[],[]],[[],[]],[[],[]],[[],[]]] print_version = 2 @@ -613,22 +620,30 @@ def validation_run(only, only_targets, reference_branch, number, notify, update, arch = archs for i1 in range(0,len(arch)): for i2 in range(0,len(opts)): - stability.arch = arch[i1] - stability.no_opt = opts[i2] - try: - execute_stability(stability, R_tmp, print_version) - except: - print_debug("ERROR: Exception in execute_stability - maybe some test subprocess terminated before it should have\n", False, stability_log) - print_version = 0 + for i3 in range(dbg_begin,dbg_total): + stability.arch = arch[i1] + stability.no_opt = opts[i2] + stability.ispc_flags = ispc_flags_tmp + if (i3 != 0): + stability.ispc_flags += " -g" + try: + execute_stability(stability, R_tmp, print_version) + except: + print_debug("ERROR: Exception in execute_stability - maybe some test subprocess terminated before it should have\n", False, stability_log) + print_version = 0 for j in range(0,len(sde_targets)): stability.target = sde_targets[j][1] stability.wrapexe = os.environ["SDE_HOME"] + "/sde " + sde_targets[j][0] + " -- " for i1 in range(0,len(archs)): for i2 in range(0,len(opts)): - stability.arch = archs[i1] - stability.no_opt = opts[i2] - execute_stability(stability, R_tmp, print_version) - print_version = 0 + for i3 in range(dbg_begin,dbg_total): + stability.arch = archs[i1] + stability.no_opt = opts[i2] + stability.ispc_flags = ispc_flags_tmp + if (i3 != 0): + stability.ispc_flags += " -g" + execute_stability(stability, R_tmp, print_version) + print_version = 0 # Output testing results separate for each tested LLVM version R = concatenate_test_results(R, R_tmp) output_test_results(R_tmp) @@ -780,7 +795,7 @@ def Main(): if os.environ.get("SMTP_ISPC") == None: error("you have no SMTP_ISPC in your environment for option notify", 1) if options.only != "": - test_only_r = " 3.2 3.3 3.4 3.5 3.6 trunk current build stability performance x86 x86-64 -O0 -O2 native " + test_only_r = " 3.2 3.3 3.4 3.5 3.6 trunk current build stability performance x86 x86-64 -O0 -O2 native debug nodebug " test_only = options.only.split(" ") for iterator in test_only: if not (" " + iterator + " " in test_only_r): @@ -929,8 +944,9 @@ if __name__ == '__main__': help='display time of testing', default=False, action='store_true') run_group.add_option('--only', dest='only', help='set types of tests. Possible values:\n' + - '-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' + - 'build (only build with different LLVM), 3.2, 3.3, 3.4, 3.5, 3.6, trunk, native (do not use SDE), current (do not rebuild ISPC).', + '-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance),\n' + + 'build (only build with different LLVM), 3.2, 3.3, 3.4, 3.5, 3.6, trunk, native (do not use SDE),\n' + + 'current (do not rebuild ISPC), debug (only with debug info), nodebug (only without debug info).', default="") run_group.add_option('--perf_LLVM', dest='perf_llvm', help='compare LLVM 3.6 with "--compare-with", default trunk', default=False, action='store_true') diff --git a/func.cpp b/func.cpp index d2f96afb..a624b699 100644 --- a/func.cpp +++ b/func.cpp @@ -505,17 +505,6 @@ Function::GenerateIR() { } if (m->errorCount == 0) { - -#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+ - if (llvm::verifyFunction(*function) == true) { -#else - if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) { -#endif - if (g->debugPrint) - function->dump(); - FATAL("Function verificication failed"); - } - // If the function is 'export'-qualified, emit a second version of // it without a mask parameter and without name mangling so that // the application can call it @@ -568,17 +557,6 @@ Function::GenerateIR() { emitCode(&ec, appFunction, firstStmtPos); if (m->errorCount == 0) { sym->exportedFunction = appFunction; - -#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+ - if (llvm::verifyFunction(*appFunction) == true) { -#else - if (llvm::verifyFunction(*appFunction, - llvm::ReturnStatusAction) == true) { -#endif - if (g->debugPrint) - appFunction->dump(); - FATAL("Function verificication failed"); - } } #ifdef ISPC_NVPTX_ENABLED if (g->target->getISA() == Target::NVPTX) diff --git a/module.cpp b/module.cpp index 1fa3c9a0..177605f3 100644 --- a/module.cpp +++ b/module.cpp @@ -1100,6 +1100,12 @@ Module::writeOutput(OutputType outputType, const char *outFileName, } #endif + // SIC! (verifyModule() == TRUE) means "failed", see llvm-link code. + if ((outputType != Header) && (outputType != Deps) + && (outputType != HostStub) && (outputType != DevStub) + && module && llvm::verifyModule(*module)) + FATAL("Resulting module verification failed!"); + // First, issue a warning if the output file suffix and the type of // file being created seem to mismatch. This can help catch missing // command-line arguments specifying the output file type.