forked from OSchip/llvm-project
[BOLT][TEST] Imported small tests
Summary: Imported small internal tests: - cfi_instrs_reordered.s - no_entry_reordering.test - no_relocs.test - pie.test (cherry picked from FBD31514823)
This commit is contained in:
parent
d41b4e6e2d
commit
872013e077
|
@ -0,0 +1,51 @@
|
|||
.globl _start
|
||||
.type _start, %function
|
||||
_start:
|
||||
# FDATA: 0 [unknown] 0 1 _start 0 0 792
|
||||
.cfi_startproc
|
||||
LBB00:
|
||||
movl $0x0, %eax
|
||||
jmp Ltmp0
|
||||
|
||||
LFT0:
|
||||
cmpl $0x0, %eax
|
||||
jmp Ltmp1
|
||||
|
||||
Ltmp1:
|
||||
jmp LBB00
|
||||
# FDATA: 1 _start #Ltmp1# 1 _start #LBB00# 13 792
|
||||
|
||||
Ltmp0:
|
||||
jmp Ltmp2
|
||||
|
||||
Ltmp2:
|
||||
jmp Ltmp3
|
||||
|
||||
Ltmp3:
|
||||
jmp Ltmp4
|
||||
|
||||
Ltmp4:
|
||||
jmp Ltmp5
|
||||
|
||||
Ltmp5:
|
||||
jmp Ltmp6
|
||||
|
||||
Ltmp6:
|
||||
jmp Ltmp7
|
||||
|
||||
Ltmp7:
|
||||
jmp Ltmp8
|
||||
|
||||
Ltmp8:
|
||||
jmp Ltmp9
|
||||
|
||||
Ltmp9:
|
||||
jmp Ltmp10
|
||||
|
||||
Ltmp10:
|
||||
jmp Ltmp11
|
||||
|
||||
Ltmp11:
|
||||
retq
|
||||
.cfi_endproc
|
||||
.size _start, .-_start
|
|
@ -0,0 +1,38 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int total = 0;
|
||||
|
||||
int inc(int x) {
|
||||
switch (x) {
|
||||
case 0: total += 1 + 0; return 1;
|
||||
case 1: total += 1 + 1; return 2;
|
||||
case 2: total += 1 + 2; return 3;
|
||||
case 3: total += 1 + 3; return 4;
|
||||
case 4: total += 1 + 4; return 5;
|
||||
case 5: total += 1 + 5; return 6;
|
||||
default: return x + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int inc_dup(int x) {
|
||||
switch (x) {
|
||||
case 0: total += 2 + 0; return 1;
|
||||
case 1: total += 2 + 1; return 2;
|
||||
case 2: total += 2 + 2; return 3;
|
||||
case 3: total += 2 + 3; return 4;
|
||||
case 4: total += 2 + 4; return 5;
|
||||
case 5: total += 2 + 5; return 6;
|
||||
default: return x + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int c = 0;
|
||||
for (int i = 0; i < 10000000; ++i) {
|
||||
int a = rand() % 7;
|
||||
int b = rand() % 7;
|
||||
c += inc(a) - 2*inc_dup(b);
|
||||
}
|
||||
return c == 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
|||
# Verifies that llvm-bolt reordering heuristic does not allocate a BB before the
|
||||
# entry point even if there is a hot edge from a block to entry point
|
||||
|
||||
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %S/Inputs/entry.s -o %t.o
|
||||
RUN: link_fdata %S/Inputs/entry.s %t.o %t.fdata
|
||||
RUN: llvm-strip --strip-unneeded %t.o
|
||||
RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
|
||||
RUN: llvm-bolt %t.exe -data %t.fdata -o /dev/null -reorder-blocks=normal \
|
||||
RUN: -funcs=_start -print-reordered -sequential-disassembly | FileCheck %s
|
||||
|
||||
CHECK: BB Layout : .LBB00, {{.*}}
|
|
@ -0,0 +1,6 @@
|
|||
# Verifies that input without relocations is rejected in relocs mode.
|
||||
|
||||
RUN: %clang %S/Inputs/icf-jump-tables.c -o %t
|
||||
RUN: not llvm-bolt %t -o /dev/null -relocs 2>&1 | FileCheck %s
|
||||
|
||||
CHECK: BOLT-ERROR: relocations against code are missing from the input file.
|
|
@ -0,0 +1,6 @@
|
|||
# Check that we do not reject position-independent executables (PIEs).
|
||||
|
||||
RUN: %clang -fPIC -pie %p/Inputs/jump_table_icp.cpp -o %t
|
||||
RUN: llvm-bolt %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
CHECK: BOLT-INFO: shared object or position-independent executable detected
|
Loading…
Reference in New Issue