evaluating the effects of compiler optimizations on...

95
Evaluating the Effects of Compiler Optimizations on Mutation Testing at the Compiler IR Level ISSRE’16 – Ottawa, Canada Oct 25 th , 2016 Farah Hariri , August Shi , Hayes Converse , Sarfraz Khurshid , Darko Marinov University of Illinois at Urbana-Champaign, The University of Texas at Austin CNS-1239498, CCF-1319688, CCF-1409423, CCF-1421503, CCF-1438982, and CCF-1439957

Upload: others

Post on 06-Aug-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Evaluating the Effects of Compiler Optimizations

on Mutation Testing at the Compiler IR Level

ISSRE’16 – Ottawa, Canada

Oct 25th, 2016

Farah Hariri †, August Shi †, Hayes Converse ‡, Sarfraz Khurshid ‡, Darko Marinov †

†University of Illinois at Urbana-Champaign, ‡The University of Texas at Austin

CNS-1239498, CCF-1319688, CCF-1409423, CCF-1421503, CCF-1438982, and CCF-1439957

Page 2: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

BackgroundMUTATION TESTING

Page 3: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Background: Mutation Testing

Definition: Mutation testing is a technique for evaluating the quality of

test suites

Page 4: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Testing As A Black Box

Definition: Mutation testing is a technique for evaluating the quality of

test suites

As a black box, it works as follows:

Mutation Testing

Code Under Test

Test Suite

Mutation Score

(%)

Page 5: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Testing As A Black Box

Definition: Mutation testing is a technique for evaluating the quality of

test suites

As a black box, it works as follows:

Two key concerns:

Interpretation of the mutation score

Speed of computing the mutation score

Mutation Testing

Code Under Test

Test Suite

Mutation Score

(%)

Page 6: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Steps of Mutation Testing

Mutation testing proceeds in two steps:

Step 1: Mutant Generation

Page 7: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Steps of Mutation Testing

Mutation testing proceeds in two steps:

Step 1: Mutant Generation

Mutant: modified version of the original program obtained by applying a

mutation operator

Page 8: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Steps of Mutation Testing

Mutation testing proceeds in two steps:

Step 1: Mutant Generation

Mutant: modified version of the original program obtained by applying a

mutation operator

Mutation Operator: program transformation that introduces a small

syntactic change to the original program

Page 9: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Steps of Mutation Testing

Mutation testing proceeds in two steps:

Step 1: Mutant Generation

Mutant: modified version of the original program obtained by applying a

mutation operator

Mutation Operator: program transformation that introduces a small

syntactic change to the original program

Example!

Page 10: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutant Generation Example

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

Original code

Example from the program ‘cut’

Page 11: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutant Generation Example

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp neq i8 %r12, 0Original code

Generated Mutants Example from the program ‘cut’

ROR: Relational Operator Replacement

Page 12: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutant Generation Example

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp neq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp uge i8 %r12, 0

Original code

Generated Mutants Example from the program ‘cut’

ROR: Relational Operator Replacement

ROR

Page 13: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutant Generation Example

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp neq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp uge i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 1

Original code

Generated Mutants Example from the program ‘cut’

ROR: Relational Operator Replacement

ICR : Integer Constant Replacement

ROR

Page 14: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutant Generation Example

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp neq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp uge i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 1

Original code

Generated Mutants Example from the program ‘cut’

ROR: Relational Operator Replacement

ICR : Integer Constant Replacement

ROR

Page 15: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Steps of Mutation Testing

Mutation testing proceeds in two steps:

Step 1: Mutant Generation

Mutant: modified version of the program obtained by applying a mutation

operator

Mutation Operator: program transformation that introduces a small

syntactic change to the original code

Step 2: Running the test suite for every single mutant

Page 16: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Running The Test Suite Example

Mutant 1Test Runner

Test SuiteP P F P P

Page 17: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Running The Test Suite Example

Mutant 1Test Runner

Test SuiteP P F P P

Mutant 2Test Runner

Test SuiteP F P P F

Mutant 3Test Runner

Test SuiteP P P P P

Page 18: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Running The Test Suite Example

Mutant 1Test Runner

Test SuiteP P F P P

Mutant 2Test Runner

Test SuiteP F P P F

Mutant 3Test Runner

Test SuiteP P P P P

Long Running

Time

Page 19: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Running The Test Suite Example

Mutant 1Test Runner

Test SuiteP P F P P

Mutant is killedMutant 2

Test RunnerTest Suite

P F P P F

Mutant 3Test Runner

Test SuiteP P P P P

Mutant is killed

Mutant is NOT killed

Page 20: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Score

Mutant 1Test Runner

Test SuiteP P F P P

Mutant 2Test Runner

Test SuiteP F P P F

Mutant 3Test Runner

Test SuiteP P P P P

𝑚𝑢𝑡𝑎𝑡𝑖𝑜𝑛 𝑠𝑐𝑜𝑟𝑒 %

=𝑘𝑖𝑙𝑙𝑒𝑑 𝑚𝑢𝑡𝑎𝑛𝑡𝑠

𝑎𝑙𝑙 𝑔𝑒𝑛𝑒𝑟𝑎𝑡𝑒𝑑 𝑚𝑢𝑡𝑎𝑛𝑡𝑠

Page 21: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation

Testing

Page 22: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation Testing

Equivalent and Duplicated Mutants

Long Running Time

Page 23: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation Testing

Equivalent and Duplicated Mutants

Equivalent Mutant: is a mutant that is syntactically different but semantically

equivalent to the original program

Page 24: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation Testing

Equivalent and Duplicated Mutants

Equivalent Mutant: is a mutant that is syntactically different but semantically

equivalent to the original program

Duplicated Mutants: are two or more mutants that are syntactically

different but semantically equivalent to each another (but not to the

original program)

Equivalent and duplicated mutants can skew the mutation score and

increase the running time

Page 25: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation Testing

Equivalent and Duplicated Mutants

Equivalent Mutant: is a mutant that is syntactically different but semantically

equivalent to the original program

Duplicated Mutants: are two or more mutants that are syntactically

different but semantically equivalent to each another (but not to the

original program)

Equivalent and duplicated Example! can skew the mutation score and

increase the running time

Page 26: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Duplicated Mutants Example

Checking that a boolean is not equal to zero is semantically equivalent to

checking that a boolean is equal to one

%r12 = and i8 %r11, 1

%r13 = icmp neq i8 %r12, 0

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 1

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

Page 27: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation Testing

Equivalent and Duplicated Mutants

Equivalent Mutant: is a mutant that is syntactically different but semantically

equivalent to the original program

Duplicated Mutants: are two or more mutants that are syntactically

different but semantically equivalent to each another (but not to the

original program)

Equivalent and duplicated mutants can skew the mutation score and

increase the running time

Page 28: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

Scenario Mutation

Score

Running Time

Page 29: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

equivalentMutation score = 5/8 = 62.5%

Scenario Mutation

Score

Running Time

Page 30: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

equivalentMutation score = 5/8 = 62.5%

Scenario Mutation

Score

Running Time

Equivalent Mutants Deflate Increase

Page 31: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

duplicatedMutation score = 5/9 = 55.5 %

Scenario Mutation

Score

Running Time

Equivalent Mutants Deflate Increase

Page 32: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

duplicatedMutation score = 5/9 = 55.5 %

Scenario Mutation

Score

Running Time

Equivalent Mutants Deflate Increase

Duplicated Mutants (not killed) Deflate Increase

Page 33: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

Mutation score = 4/9 = 44.4 %

Scenario Mutation

Score

Running Time

Equivalent Mutants Deflate Increase

Duplicated Mutants (not killed) Deflate Increase

duplicated

Page 34: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Skewing Mutation Score Example

10 mutants

Original mutation score = 5/10 = 50 %

Killed

Not Killed

Mutation score = 4/9 = 44.4 %

Scenario Mutation

Score

Running Time

Equivalent Mutants Deflate Increase

Duplicated Mutants (not killed) Deflate Increase

Duplicated Mutants (killed) Inflate Increase

duplicated

Page 35: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Challenges of Mutation Testing

Equivalent and Duplicated Mutants

Equivalent Mutant: is a mutant that is syntactically different but semantically

equivalent to the original program

Duplicated Mutants: are two or more mutants that are syntactically

different but semantically equivalent to each another (but not to the

original program)

Equivalent and duplicated mutants can skew the mutation score and

increase the running time

Long Running Time

Page 36: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Testing And

Compiler Optimizations

Page 37: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Testing at the IR Level

Traditionally mutant generation (step 1) is applied on the source code

Page 38: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Testing at the IR Level

Traditionally mutant generation (step 1) is applied on the source code

Compiler Optimizations: Semantic preserving transformation applied

automatically by the compiler to improve performance

Page 39: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Testing at the IR Level

Traditionally mutant generation (step 1) is applied on the source code

Compiler Optimizations: Semantic preserving transformation applied

automatically by the compiler to improve performance

Mutant generation has been recently applied on the compiler IR level

(Schulte, PhD thesis’14; Sousa et al., CODES+ISSS’12)

Advantage: One tool for many source languages

E.g., LLVM supports C, C++, Objective-C, CUDA, …

Page 40: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Problem Statement

Transformation Semantic

preserving

Effect of other

compiler

optimizations

Compiler

Optimizations

Yes

Mutant

Generation

No

Page 41: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Problem Statement

Transformation Semantic

preserving

Effect of other

compiler

optimizations

Compiler

Optimizations

Yes

Mutant

Generation

No

Page 42: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Problem Statement

What are the effects of compiler optimizations on mutation testing at

the IR level?

Page 43: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Problem Statement

What are the effects of compiler optimizations on mutation testing at

the IR level?

Effects can be on :

Number of mutants generated (and therefore speed of computing the

mutation score)

Mutation Score

Page 44: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Problem Statement

What are the effects of compiler optimizations on mutation testing at

the IR level?

Effects can be on :

Number of mutants generated (and therefore speed of computing the

mutation score)

Mutation Score

Equivalent and duplicated Example! can skew the mutation score and

Page 45: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Loop Peeling Example

Unoptimized Code

<label>:2

… loop header …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

Page 46: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Loop Peeling Example

Unoptimized Code Optimized Code

<label>:2

… loop header …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

<label>:2

… loop header mod …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

Page 47: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Loop Peeling Example

Unoptimized Code Optimized Code

<label>:2

… loop header …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

<label>:2

… loop header mod …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

Page 48: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Loop Peeling Example

Unoptimized Code Optimized Code

<label>:2

… loop header …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

<label>:2

… loop header mod …

<label>:5

%r12 = and i8 %r11, 1

%r13 = icmp eq i8 %r12, 0

br label %2

Page 49: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Research questions

RQ1. How do compiler optimizations affect the number of generated

mutants?

RQ2. How do compiler optimizations affect the number of equivalent

and duplicated mutants?

RQ3. How do compiler optimizations affect the mutation score?

RQ4. How do these effects vary with the class of mutation operators

applied?

Page 50: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Experimental Setup

Page 51: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Evaluated Mutation Operators

AOR replaces every arithmetic operator with another arithmetic

operator {add, sub, mul, udiv, …}

Page 52: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Evaluated Mutation Operators

AOR replaces every arithmetic operator with another arithmetic

operator {add, sub, mul, udiv, …}

LCR replaces every logical connector with another logical connector

{and, or, xor}

Page 53: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Evaluated Mutation Operators

AOR replaces every arithmetic operator with another arithmetic

operator {add, sub, mul, udiv, …}

LCR replaces every logical connector with another logical connector

{and, or, xor}

ROR replaces every relational operator with another relational operator

{eq, neq, uge, ult, sgt, …}

Page 54: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Evaluated Mutation Operators

AOR replaces every arithmetic operator with another arithmetic

operator {add, sub, mul, udiv, …}

LCR replaces every logical connector with another logical connector

{and, or, xor}

ROR replaces every relational operator with another relational operator

{eq, neq, uge, ult, sgt, …}

ICR replaces every integer constant c with a different value from the

set

{−1, 0, 1, c − 1, c + 1}

Page 55: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Subjects and Optimization Levels

Subjects: 18 programs from the Coreutils library

E.g., chmod, chown, cut, head, rm, rmdir, tr, wc, …

Page 56: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Subjects and Optimization Levels

Subjects: 18 programs from the Coreutils library

E.g., chmod, chown, cut, head, rm, rmdir, tr, wc, …

Programs come with their individual test suites

Page 57: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Subjects and Optimization Levels

Subjects: 18 programs from the Coreutils library

E.g., chmod, chown, cut, head, rm, rmdir, tr, wc, …

Programs come with their individual test suites

LLVM 3.8.1

-O0: without optimizations

-O3: with optimizations

Page 58: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation Pipeline

Page 59: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)

-O0/-O3

Page 60: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

-O0/-O3

Page 61: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll

Program2.ll

Program3.ll

-O0/-O3

Page 62: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll-O0/-O3

Program2.ll

Program3.ll

Clang

-O0/-O3

Page 63: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll

Program2.ll

Program3.ll

Clang

Binary 1

Binary 2

Binary 3

-O0/-O3

-O0/-O3

Page 64: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll

Program2.ll

Program3.ll

Clang

Binary 1

Binary 2

Binary 3

Trivial Compiler Equivalence

Papadakis et al.

Binary 1

Binary 2

Binary 10

Non-equivalent non-duplicated

(NEND)

-O0/-O3

-O0/-O3

Page 65: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll

Program2.ll

Program3.ll

Clang

Binary 1

Binary 2

Binary 3

Trivial Compiler Equivalence

Papadakis et al.

Binary 1

Binary 2

Binary 10

-O0/-O3

-O0/-O3

Non-equivalent non-duplicated

(NEND)

Page 66: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Trivial Compiler Equivalence

Binary 1

Binary 2

Binary 3

Binary 4

Binary 5

Hash

Function

Original Binary

md5sum 1

md5sum 2

md5sum 0

md5sum 2

md5sum 1

md5sum 0

Page 67: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Trivial Compiler Equivalence

Binary 1

Binary 2

Binary 3

Binary 4

Binary 5

Hash

Function

Original Binary

md5sum 1

md5sum 2

md5sum 0

md5sum 2

md5sum 1

md5sum 0Original

Binary

Binary3

Binary1,

Binary 5

Equivalence Classes

Binary2,

Binary 4

Page 68: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Trivial Compiler Equivalence

Binary 1

Binary 2

Binary 3

Binary 4

Binary 5

Hash

Function

Original Binary

md5sum 1

md5sum 2

md5sum 0

md5sum 2

md5sum 1

md5sum 0Original

Binary

Binary3

Binary1,

Binary 5

Equivalence Classes

Binary2,

Binary 4

Binary 1

Binary 2

Binary 10

Page 69: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Trivial Compiler Equivalence

Binary 1

Binary 2

Binary 3

Binary 4

Binary 5

Hash

Function

Original Binary

md5sum 1

md5sum 2

md5sum 0

md5sum 2

md5sum 1

md5sum 0Original

Binary

Binary3

Binary1,

Binary 5

Binary2,

Binary 4

Binary 1

Binary 2

Binary 10

Trivial Compiler Equivalence

Non-equivalent non-duplicated

(NEND)

Page 70: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll

Program2.ll

Program3.ll

Clang

Binary 1

Binary 2

Binary 3

Trivial Compiler Equivalence

Papadakis et al.

Binary 1

Binary 2

Binary 10

NEND

-O0/-O3

-O0/-O3

Page 71: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Implementation

Program.c Clang Program.ll

Source code Bitcode (IR)Identify mutation

locations (LLVM pass)

instr,op,new_val

instr,op,new_val

Generate

Mutants (LLVM

pass)

Program1.ll

Program2.ll

Program3.ll

Clang

Binary 1

Binary 2

Binary 3

Trivial Compiler Equivalence

Papadakis et al.

Binary 1

Binary 2

Binary 10

NEND

Test

RunnerMutation Score

Test Suite

-O0/-O3

-O0/-O3

Page 72: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Results

Page 73: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

RQ1:

HOW DO COMPILER

OPTIMIZATIONS

AFFECT THE NUMBER

OF GENERATED

MUTANTS?

Page 74: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Instructions

ProgramO0 O3

Total LLVM Instructions

Total LLVMInstructions

chmod 675 403chown 292 233cut 1274 1110dd 2436 2080du 1199 835head 1744 994join 2088 1958mkdir 251 159mv 604 372readlink 140 95rm 322 200rmdir 349 199tac 871 581tail 3030 2175test 1895 1711touch 606 413tr 3116 2219wc 1172 842

Overall 22064 16579

Page 75: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Instructions

ProgramO0 O3

Total LLVM Instructions

Total LLVMInstructions

chmod 675 403chown 292 233cut 1274 1110dd 2436 2080du 1199 835head 1744 994join 2088 1958mkdir 251 159mv 604 372readlink 140 95rm 322 200rmdir 349 199tac 871 581tail 3030 2175test 1895 1711touch 606 413tr 3116 2219wc 1172 842

Overall 22064 16579

Page 76: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Instructions

ProgramO0 O3

Total LLVM Instructions

Total LLVMInstructions

chmod 675 403chown 292 233cut 1274 1110dd 2436 2080du 1199 835head 1744 994join 2088 1958mkdir 251 159mv 604 372readlink 140 95rm 322 200rmdir 349 199tac 871 581tail 3030 2175test 1895 1711touch 606 413tr 3116 2219wc 1172 842

Overall 22064 16579

The total number of instructions at O3 (16K instructions) is smaller

than at O0 (22K instructions)

Page 77: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Generated Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Page 78: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Generated Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Page 79: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Generated Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

The total number of generated mutants at O3 (37K mutants) is larger

than at O0 (33K mutants)

Page 80: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of Generated Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Answer 1:

Even though O3 has less instructions than O0, it has more generated

mutants in total

Page 81: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

RQ2:

HOW DO COMPILER

OPTIMIZATIONS

AFFECT THE NUMBER

OF EQUIVALENT AND

DUPLICATED

MUTANTS?

Page 82: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Equivalent Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Page 83: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Duplicated Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Page 84: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of NEND Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Page 85: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of NEND Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Answer 2:

Number of NEND mutants at O3 (29K mutants) is smaller than at O0

(32K mutants)

Page 86: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

No. of NEND Mutants

ProgramO0 O3

#M E% D% #NEND #M E% D% #NENDchmod 1069 3.8 0.8 1019 952 9.4 13.7 731

chown 467 3.2 0 452 453 14.7 9 345

cut 1958 3.3 0.5 1881 2547 4.3 14.1 2076

dd 4208 3.1 0.5 4055 4721 6.2 16.8 3627

du 1723 4.2 0.6 1638 1682 8.6 10.5 1358

head 2699 4 1 2562 2513 9.9 12.1 1957

join 2902 3.8 0.8 2766 3980 8.5 12.4 3144

mkdir 368 6.2 0.8 342 253 5.9 5.9 223

mv 907 3.5 0.5 870 792 10.3 12.3 612

readlink 192 3.6 0 185 140 3.5 8.5 123

rm 543 2.2 0 531 458 6.1 9.1 388

rmdir 479 5.2 2.3 443 417 3.8 11.5 353

tac 1151 5 1 1081 1120 5.9 9.9 942

tail 4673 3.3 0.7 4480 5409 9.2 12.5 4231

test 3077 2.4 2.1 2936 4717 5.2 15 3759

touch 1083 4.8 1.5 1014 983 12.7 10.2 757

tr 4280 3.7 1 4075 4624 4.5 13.1 3802

wc 1780 3.8 1 1694 1729 6.2 13.7 1384

Overall 33559 3.6 0.9 32024 37490 7.2 13.2 29812

Answer 2:

Number of NEND mutants at O3 (29K mutants) is smaller than at O0

(32K mutants)

Faster with

optimizations

Page 87: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

RQ3:

HOW DO COMPILER

OPTIMIZATIONS

AFFECT THE

MUTATION SCORE?

Page 88: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Score

ProgramO0 O3

All NEND All NENDchmod 35.7 36.9 33.7 35.7

chown 32.7 33.8 29.8 33.3

cut 55.7 57.6 55 55.3

dd 32.8 33.9 31.4 31.5

du 41.6 43.4 36.2 38

head 17.8 18.7 15.7 17.6

join 54.5 56.6 40 42.1

mkdir 52.9 56.4 55.3 57.8

mv 53.8 55.5 50.6 51.4

readlink 39.5 41 40.7 39.8

rm 42.7 43.6 35.3 37.1

rmdir 29.4 31.3 28.3 29.7

tac 41.3 43.5 37 38.4

tail 31.3 32.4 24.5 26.5

test 37.6 38.7 37.3 38.8

touch 39.4 41.6 38.2 41

tr 59.2 61.5 59.2 59.8

wc 32.4 33.8 26.7 26

Overall 40.4 41.9 37 38.5

Page 89: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Score

ProgramO0 O3

All NEND All NENDchmod 35.7 36.9 33.7 35.7

chown 32.7 33.8 29.8 33.3

cut 55.7 57.6 55 55.3

dd 32.8 33.9 31.4 31.5

du 41.6 43.4 36.2 38

head 17.8 18.7 15.7 17.6

join 54.5 56.6 40 42.1

mkdir 52.9 56.4 55.3 57.8

mv 53.8 55.5 50.6 51.4

readlink 39.5 41 40.7 39.8

rm 42.7 43.6 35.3 37.1

rmdir 29.4 31.3 28.3 29.7

tac 41.3 43.5 37 38.4

tail 31.3 32.4 24.5 26.5

test 37.6 38.7 37.3 38.8

touch 39.4 41.6 38.2 41

tr 59.2 61.5 59.2 59.8

wc 32.4 33.8 26.7 26

Overall 40.4 41.9 37 38.5

Page 90: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Mutation Score

ProgramO0 O3

All NEND All NENDchmod 35.7 36.9 33.7 35.7

chown 32.7 33.8 29.8 33.3

cut 55.7 57.6 55 55.3

dd 32.8 33.9 31.4 31.5

du 41.6 43.4 36.2 38

head 17.8 18.7 15.7 17.6

join 54.5 56.6 40 42.1

mkdir 52.9 56.4 55.3 57.8

mv 53.8 55.5 50.6 51.4

readlink 39.5 41 40.7 39.8

rm 42.7 43.6 35.3 37.1

rmdir 29.4 31.3 28.3 29.7

tac 41.3 43.5 37 38.4

tail 31.3 32.4 24.5 26.5

test 37.6 38.7 37.3 38.8

touch 39.4 41.6 38.2 41

tr 59.2 61.5 59.2 59.8

wc 32.4 33.8 26.7 26

Overall 40.4 41.9 37 38.5

Answer 3:

The mutation score values are lower at the optimized -O3 level than

at the non optimized -O0 level both for all mutants and for only

NEND mutants

Page 91: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

RQ4:

HOW DO THESE

EFFECTS VARY WITH

THE CLASS OF

MUTATION

OPERATORS APPLIED?

Page 92: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Across Operator Analysis

Relationship Operators

All AOR LCR ROR ICR

For all generated mutants, overall #M at –O3 > #M at –O0 Yes Yes Yes Yes No

For only NEND mutants, overall #NEND at –O3 < #NEND at –O0 Yes Yes No No Yes

Overall E% at –O3 ≥ E% at –O0 Yes Yes Yes Yes Yes

Overall D% at –O3 ≥ D% at –O0 Yes Yes Yes Yes Yes

For all generated mutants, overall mutation score at –O3 < mutation

score at –O0

Yes Yes Yes Yes Yes

For only NEND mutants, overall mutation score at –O3 < mutation

score at –O0

Yes Yes Yes Yes Yes

Page 93: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Across Operator Analysis

Relationship Operators

All AOR LCR ROR ICR

For all generated mutants, overall #M at –O3 > #M at –O0 Yes Yes Yes Yes No

For only NEND mutants, overall #NEND at –O3 < #NEND at –O0 Yes Yes No No Yes

Overall E% at –O3 ≥ E% at –O0 Yes Yes Yes Yes Yes

Overall D% at –O3 ≥ D% at –O0 Yes Yes Yes Yes Yes

For all generated mutants, overall mutation score at –O3 < mutation

score at –O0

Yes Yes Yes Yes Yes

For only NEND mutants, overall mutation score at –O3 < mutation

score at –O0

Yes Yes Yes Yes Yes

Answer 4:

The effects of -O0 and -O3 levels on mutation testing are most likely

due to compiler optimizations and not due to specific mutation

operators

Page 94: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Summary

0

10000

20000

30000

40000

No. of Inst No. of Mutants No. of NEND

Mutants

Instructions and Mutants

O0 O3

34

36

38

40

42

Mutation Score of All

Mutants

NEND Mutation Score

Mutation Score

O0 O3

Page 95: Evaluating the Effects of Compiler Optimizations on ...mir.cs.illinois.edu/farah/presentations/issre16_presentation.pdf · Evaluating the Effects of Compiler Optimizations on Mutation

Summary

0

10000

20000

30000

40000

No. of Inst No. of Mutants No. of NEND

Mutants

Instructions and Mutants

O0 O3

34

36

38

40

42

Mutation Score of All

Mutants

NEND Mutation Score

Mutation Score

O0 O3

Takeaway: Apply mutation testing on optimized code