The invention discloses a correlation model-based
compiler optimization fault detection method and
system. The method comprises the following steps of: firstly, generating a
test program, and constructing a diversified optimization sequence by randomly selecting an optimization level and
processing a difference set; then constructing a training sample, associating a
test program with the optimization sequence, inputting the
test program and the optimization sequence into a
compiler for differential testing, marking an output test result, and constructing a training sample with a
label; converting a test program and an optimization sequence in the training sample into a vector representation form, and constructing a correlation model based on a
support vector machine algorithm; and finally, predicting the probability that a new test program triggers an optimization fault under a certain optimization sequence by using the trained SVM model, carrying out descending sorting on the optimization sequence according to the predicted probability, and carrying out differential test on the
compiler by using the new test program and the optimization sequence sorted in Top-K. According to the method, the detection efficiency and accuracy of the compiler optimization fault can be improved, and a guarantee is provided for the reliability of compiler optimization.