Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bolt/include/bolt/Core/MCPlusBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ class MCPlusBuilder {
return false;
}

/// Use \p Input1 or Input2 as the current value for the input
/// Use \p Input1 or \p Input2 as the current value for the input
/// register and put in \p Output the changes incurred by executing
/// \p Inst. Return false if it was not possible to perform the
/// evaluation. evaluateStackOffsetExpr is restricted to operations
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Utils/CommandLineOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ cl::opt<bool> Lite("lite", cl::desc("skip processing of cold functions"),
cl::cat(BoltCategory));

cl::opt<std::string>
OutputFilename("o",
OutputFilename("ooo",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is renamed by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a temporary fix for linking the llvm-mc tool with BOLT, when the linker tried to link them, having the same CL option with the same value caused errors.

cl::desc("<output file>"),
cl::Optional,
cl::cat(BoltOutputCategory));
Expand Down
33 changes: 33 additions & 0 deletions llvm/test/tools/llvm-mc/cfi-validation/single-func-cfa-mistake.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# RUN: not llvm-mc %s --validate-cfi --filetype=null 2>&1 \
# RUN: | FileCheck %s
.text
.globl f
.type f,@function
f:
.cfi_startproc

.cfi_undefined %rax

pushq %rbp
# CHECK: error: Expected CFA [reg: 61, offset: 16] but got [reg: 61, offset: 17]
.cfi_def_cfa_offset 17
.cfi_offset %rbp, -16

movq %rsp, %rbp
.cfi_def_cfa_register %rbp

movl %edi, -4(%rbp)

movl -4(%rbp), %eax

addl $10, %eax

popq %rbp
.cfi_def_cfa %rsp, 8

retq

.Lfunc_end0:
.size f, .Lfunc_end0-f

.cfi_endproc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# RUN: not llvm-mc %s --validate-cfi --filetype=null 2>&1 \
# RUN: | FileCheck %s
.text
.globl f
.type f,@function
f:
.cfi_startproc

.cfi_undefined %rax

pushq %rbp
.cfi_def_cfa_offset 16

movq %rsp, %rbp
# CHECK: error: Reg#52 caller's value is in reg#52 which is changed by this instruction, but not changed in CFI directives
.cfi_def_cfa_register %rbp

movl %edi, -4(%rbp)

movl -4(%rbp), %eax

addl $10, %eax

popq %rbp
.cfi_def_cfa %rsp, 8

retq

.Lfunc_end0:
.size f, .Lfunc_end0-f

.cfi_endproc
31 changes: 31 additions & 0 deletions llvm/test/tools/llvm-mc/cfi-validation/single-func.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# RUN: llvm-mc %s --validate-cfi --filetype=null
.text
.globl f
.type f,@function
f:
.cfi_startproc

.cfi_undefined %rax

pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16

movq %rsp, %rbp
.cfi_def_cfa_register %rbp

movl %edi, -4(%rbp)

movl -4(%rbp), %eax

addl $10, %eax

popq %rbp
.cfi_def_cfa %rsp, 8

retq

.Lfunc_end0:
.size f, .Lfunc_end0-f

.cfi_endproc
47 changes: 47 additions & 0 deletions llvm/test/tools/llvm-mc/cfi-validation/spill-two-reg-reversed.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# RUN: not llvm-mc %s --validate-cfi --filetype=null 2>&1 \
# RUN: | FileCheck %s
.text
.type _start,@function
.globl _start
.hidden _start
_start:
.cfi_startproc

.cfi_same_value %rdi
.cfi_same_value %rsi

pushq %rbp
.cfi_adjust_cfa_offset 8
.cfi_offset %rbp, -16

movq %rsp, %rbp

pushq %rdi
.cfi_adjust_cfa_offset 8
.cfi_rel_offset %rdi, 0

pushq %rsi
.cfi_adjust_cfa_offset 8
.cfi_rel_offset %rsi, 0

popq %rsi
# CHECK: warning: The reg#55 CFI state is changed
.cfi_adjust_cfa_offset -8
.cfi_same_value %rdi

popq %rdi
# CHECK: warning: The reg#60 CFI state is changed
# CHECK: Reg#55 caller's value is in reg#55 which is changed by this instruction, but not changed in CFI directives
.cfi_adjust_cfa_offset -8
.cfi_same_value %rsi

popq %rbp
.cfi_adjust_cfa_offset -8
.cfi_same_value %rbp

retq

.cfi_endproc
.Ltmp0:
.size _start, .Ltmp0-_start
.text
43 changes: 43 additions & 0 deletions llvm/test/tools/llvm-mc/cfi-validation/spill-two-reg.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# RUN: llvm-mc %s --validate-cfi --filetype=null
.text
.type _start,@function
.globl _start
.hidden _start
_start:
.cfi_startproc

.cfi_same_value %rdi
.cfi_same_value %rsi

pushq %rbp
.cfi_adjust_cfa_offset 8
.cfi_offset %rbp, -16

movq %rsp, %rbp

pushq %rdi
.cfi_adjust_cfa_offset 8
.cfi_rel_offset %rdi, 0

pushq %rsi
.cfi_adjust_cfa_offset 8
.cfi_rel_offset %rsi, 0

popq %rsi
.cfi_adjust_cfa_offset -8
.cfi_same_value %rsi

popq %rdi
.cfi_adjust_cfa_offset -8
.cfi_same_value %rdi

popq %rbp
.cfi_adjust_cfa_offset -8
.cfi_same_value %rbp

retq

.cfi_endproc
.Ltmp0:
.size _start, .Ltmp0-_start
.text
31 changes: 31 additions & 0 deletions llvm/test/tools/llvm-mc/cfi-validation/update-with-no-cfi.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# RUN: not llvm-mc %s --validate-cfi --filetype=null 2>&1 \
# RUN: | FileCheck %s
.text
.globl f
.type f,@function
f:
.cfi_startproc

.cfi_same_value %rax
.cfi_same_value %rbx
.cfi_same_value %rcx
.cfi_same_value %rdx

movq $10, %rax
# CHECK: error: Reg#51 caller's value is in reg#51 which is changed by this instruction, but not changed in CFI directives

movq $10, %rbx
# CHECK: error: Reg#53 caller's value is in reg#53 which is changed by this instruction, but not changed in CFI directives

movq $10, %rcx
# CHECK: error: Reg#54 caller's value is in reg#54 which is changed by this instruction, but not changed in CFI directives

movq $10, %rdx
# CHECK: error: Reg#56 caller's value is in reg#56 which is changed by this instruction, but not changed in CFI directives

retq

.Lfunc_end0:
.size f, .Lfunc_end0-f

.cfi_endproc
Loading