summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/IntrinsicEmitter.cpp21
-rwxr-xr-xutils/lit/lit/main.py6
-rw-r--r--utils/lit/lit/run.py30
3 files changed, 39 insertions, 18 deletions
diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp
index 1fc18a5dd1d8..caa52d28f771 100644
--- a/utils/TableGen/IntrinsicEmitter.cpp
+++ b/utils/TableGen/IntrinsicEmitter.cpp
@@ -211,13 +211,12 @@ enum IIT_Info {
IIT_SAME_VEC_WIDTH_ARG = 31,
IIT_PTR_TO_ARG = 32,
IIT_PTR_TO_ELT = 33,
- IIT_VEC_OF_PTRS_TO_ELT = 34,
+ IIT_VEC_OF_ANYPTRS_TO_ELT = 34,
IIT_I128 = 35,
IIT_V512 = 36,
IIT_V1024 = 37
};
-
static void EncodeFixedValueType(MVT::SimpleValueType VT,
std::vector<unsigned char> &Sig) {
if (MVT(VT).isInteger()) {
@@ -273,9 +272,16 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
}
else if (R->isSubClassOf("LLVMPointerTo"))
Sig.push_back(IIT_PTR_TO_ARG);
- else if (R->isSubClassOf("LLVMVectorOfPointersToElt"))
- Sig.push_back(IIT_VEC_OF_PTRS_TO_ELT);
- else if (R->isSubClassOf("LLVMPointerToElt"))
+ else if (R->isSubClassOf("LLVMVectorOfAnyPointersToElt")) {
+ Sig.push_back(IIT_VEC_OF_ANYPTRS_TO_ELT);
+ unsigned ArgNo = ArgCodes.size();
+ ArgCodes.push_back(3 /*vAny*/);
+ // Encode overloaded ArgNo
+ Sig.push_back(ArgNo);
+ // Encode LLVMMatchType<Number> ArgNo
+ Sig.push_back(Number);
+ return;
+ } else if (R->isSubClassOf("LLVMPointerToElt"))
Sig.push_back(IIT_PTR_TO_ELT);
else
Sig.push_back(IIT_ARG);
@@ -557,8 +563,9 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
if (ae) {
while (ai != ae) {
unsigned argNo = intrinsic.ArgumentAttributes[ai].first;
+ unsigned attrIdx = argNo + 1; // Must match AttributeList::FirstArgIndex
- OS << " const Attribute::AttrKind AttrParam" << argNo + 1 <<"[]= {";
+ OS << " const Attribute::AttrKind AttrParam" << attrIdx << "[]= {";
bool addComma = false;
do {
@@ -599,7 +606,7 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
} while (ai != ae && intrinsic.ArgumentAttributes[ai].first == argNo);
OS << "};\n";
OS << " AS[" << numAttrs++ << "] = AttributeList::get(C, "
- << argNo + 1 << ", AttrParam" << argNo + 1 << ");\n";
+ << attrIdx << ", AttrParam" << attrIdx << ");\n";
}
}
diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py
index 689a2d55bcea..10cd7775060f 100755
--- a/utils/lit/lit/main.py
+++ b/utils/lit/lit/main.py
@@ -161,7 +161,11 @@ def main(builtinParameters = {}):
main_with_tmp(builtinParameters)
finally:
if lit_tmp:
- shutil.rmtree(lit_tmp)
+ try:
+ shutil.rmtree(lit_tmp)
+ except:
+ # FIXME: Re-try after timeout on Windows.
+ pass
def main_with_tmp(builtinParameters):
parser = argparse.ArgumentParser()
diff --git a/utils/lit/lit/run.py b/utils/lit/lit/run.py
index 14d8ec98490e..27c7a9e59f8b 100644
--- a/utils/lit/lit/run.py
+++ b/utils/lit/lit/run.py
@@ -20,6 +20,14 @@ except ImportError:
import lit.Test
+def abort_now():
+ """Abort the current process without doing any exception teardown"""
+ sys.stdout.flush()
+ if win32api:
+ win32api.TerminateProcess(win32api.GetCurrentProcess(), 3)
+ else:
+ os.kill(0, 9)
+
###
# Test Execution Implementation
@@ -91,8 +99,7 @@ class Tester(object):
# This is a sad hack. Unfortunately subprocess goes
# bonkers with ctrl-c and we start forking merrily.
print('\nCtrl-C detected, goodbye.')
- sys.stdout.flush()
- os.kill(0,9)
+ abort_now()
self.consumer.update(test_index, test)
class ThreadResultsConsumer(object):
@@ -353,7 +360,7 @@ class Run(object):
print('\nCtrl-C detected, terminating.')
pool.terminate()
pool.join()
- os.kill(0,9)
+ abort_now()
return True
win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
@@ -368,6 +375,10 @@ class Run(object):
deadline = time.time() + max_time
# Start a process pool. Copy over the data shared between all test runs.
+ # FIXME: Find a way to capture the worker process stderr. If the user
+ # interrupts the workers before we make it into our task callback, they
+ # will each raise a KeyboardInterrupt exception and print to stderr at
+ # the same time.
pool = multiprocessing.Pool(jobs, worker_initializer,
(self.lit_config,
self.parallelism_semaphores))
@@ -379,6 +390,7 @@ class Run(object):
args=(test_index, test),
callback=self.consume_test_result)
for test_index, test in enumerate(self.tests)]
+ pool.close()
# Wait for all results to come in. The callback that runs in the
# parent process will update the display.
@@ -395,10 +407,12 @@ class Run(object):
a.get() # Exceptions raised here come from the worker.
if self.hit_max_failures:
break
- finally:
+ except:
# Stop the workers and wait for any straggling results to come in
# if we exited without waiting on every async result.
pool.terminate()
+ raise
+ finally:
pool.join()
# Mark any tests that weren't run as UNRESOLVED.
@@ -463,11 +477,7 @@ def worker_run_one_test(test_index, test):
execute_test(test, child_lit_config, child_parallelism_semaphores)
return (test_index, test)
except KeyboardInterrupt as e:
- # This is a sad hack. Unfortunately subprocess goes
- # bonkers with ctrl-c and we start forking merrily.
- print('\nCtrl-C detected, goodbye.')
- traceback.print_exc()
- sys.stdout.flush()
- os.kill(0,9)
+ # If a worker process gets an interrupt, abort it immediately.
+ abort_now()
except:
traceback.print_exc()