[llvm] r336906 - [XRay] Fix machine verifier issues in X86
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 12 07:36:43 PDT 2018
Author: thegameg
Date: Thu Jul 12 07:36:43 2018
New Revision: 336906
URL: http://llvm.org/viewvc/llvm-project?rev=336906&view=rev
Log:
[XRay] Fix machine verifier issues in X86
I'm not sure if this fix is the right thing to do, but it seemed to me
that PATCHABLE_RET and PATCHABLE_TAIL_CALL don't have any defs.
Running the following:
```
LLVM_ENABLE_MACHINE_VERIFIER=1 ./build/bin/llvm-lit -v -a test/CodeGen/X86/xray-*
```
results in the following tests to fail (along others):
```
LLVM :: CodeGen/X86/xray-attribute-instrumentation.ll
LLVM :: CodeGen/X86/xray-custom-log.ll
LLVM :: CodeGen/X86/xray-log-args.ll
LLVM :: CodeGen/X86/xray-loop-detection.ll
LLVM :: CodeGen/X86/xray-multiplerets-in-blocks.mir
LLVM :: CodeGen/X86/xray-section-group.ll
LLVM :: CodeGen/X86/xray-selective-instrumentation.ll
LLVM :: CodeGen/X86/xray-tail-call-sled.ll
LLVM :: CodeGen/X86/xray-typed-event-log.ll
```
The errors are:
```
*** Bad machine code: Explicit definition must be a register ***
- function: fn
- basic block: %bb.0 (0x7fa31a84d908)
- instruction: PATCHABLE_RET 2560, $eax
- operand 0: 2560
```
and
```
*** Bad machine code: Explicit definition must be a register ***
- function: caller
- basic block: %bb.0 (0x7fbff3044108)
- instruction: PATCHABLE_TAIL_CALL 3009, @callee, <regmask $bh $bl $bp $bph $bpl $bx $ebp $ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh $r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and 3 more...>, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit $edi
- operand 0: 3009
```
Differential Revision: https://reviews.llvm.org/D49187
Modified:
llvm/trunk/include/llvm/Target/Target.td
llvm/trunk/test/CodeGen/X86/xray-attribute-instrumentation.ll
llvm/trunk/test/CodeGen/X86/xray-custom-log.ll
llvm/trunk/test/CodeGen/X86/xray-log-args.ll
llvm/trunk/test/CodeGen/X86/xray-loop-detection.ll
llvm/trunk/test/CodeGen/X86/xray-multiplerets-in-blocks.mir
llvm/trunk/test/CodeGen/X86/xray-section-group.ll
llvm/trunk/test/CodeGen/X86/xray-selective-instrumentation.ll
llvm/trunk/test/CodeGen/X86/xray-tail-call-sled.ll
llvm/trunk/test/CodeGen/X86/xray-typed-event-log.ll
Modified: llvm/trunk/include/llvm/Target/Target.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/Target.td (original)
+++ llvm/trunk/include/llvm/Target/Target.td Thu Jul 12 07:36:43 2018
@@ -1117,7 +1117,7 @@ def PATCHABLE_FUNCTION_ENTER : StandardP
let hasSideEffects = 0;
}
def PATCHABLE_RET : StandardPseudoInstruction {
- let OutOperandList = (outs unknown:$dst);
+ let OutOperandList = (outs);
let InOperandList = (ins variable_ops);
let AsmString = "# XRay Function Patchable RET.";
let usesCustomInserter = 1;
@@ -1134,7 +1134,7 @@ def PATCHABLE_FUNCTION_EXIT : StandardPs
let isReturn = 0; // Original return instruction will follow
}
def PATCHABLE_TAIL_CALL : StandardPseudoInstruction {
- let OutOperandList = (outs unknown:$dst);
+ let OutOperandList = (outs);
let InOperandList = (ins variable_ops);
let AsmString = "# XRay Tail Call Exit.";
let usesCustomInserter = 1;
Modified: llvm/trunk/test/CodeGen/X86/xray-attribute-instrumentation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-attribute-instrumentation.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-attribute-instrumentation.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-attribute-instrumentation.ll Thu Jul 12 07:36:43 2018
@@ -1,7 +1,7 @@
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
-; RUN: -relocation-model=pic < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
; CHECK: .p2align 1, 0x90
Modified: llvm/trunk/test/CodeGen/X86/xray-custom-log.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-custom-log.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-custom-log.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-custom-log.ll Thu Jul 12 07:36:43 2018
@@ -1,6 +1,6 @@
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
-; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
%eventptr = alloca i8
Modified: llvm/trunk/test/CodeGen/X86/xray-log-args.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-log-args.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-log-args.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-log-args.ll Thu Jul 12 07:36:43 2018
@@ -1,7 +1,7 @@
; When logging arguments is specified, emit the entry sled accordingly.
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
define i32 @callee(i32 %arg) nounwind noinline uwtable "function-instrument"="xray-always" "xray-log-args"="1" {
ret i32 %arg
Modified: llvm/trunk/test/CodeGen/X86/xray-loop-detection.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-loop-detection.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-loop-detection.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-loop-detection.ll Thu Jul 12 07:36:43 2018
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
define i32 @foo(i32 %i) nounwind noinline uwtable "xray-instruction-threshold"="1" {
entry:
Modified: llvm/trunk/test/CodeGen/X86/xray-multiplerets-in-blocks.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-multiplerets-in-blocks.mir?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-multiplerets-in-blocks.mir (original)
+++ llvm/trunk/test/CodeGen/X86/xray-multiplerets-in-blocks.mir Thu Jul 12 07:36:43 2018
@@ -1,4 +1,4 @@
-# RUN: llc -run-pass xray-instrumentation -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s
+# RUN: llc -verify-machineinstrs -run-pass xray-instrumentation -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s
#
# Make sure we can handle multiple ret instructions in a single basic block for
# XRay.
Modified: llvm/trunk/test/CodeGen/X86/xray-section-group.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-section-group.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-section-group.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-section-group.ll Thu Jul 12 07:36:43 2018
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu -function-sections < %s | FileCheck %s
-; RUN: llc -filetype=obj -o %t -mtriple=x86_64-unknown-linux-gnu -function-sections < %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu -function-sections < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=obj -o %t -mtriple=x86_64-unknown-linux-gnu -function-sections < %s
; RUN: llvm-objdump -triple x86_64-unknown-linux-gnu -disassemble-all %t | FileCheck %s --check-prefix=CHECK-OBJ
define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
Modified: llvm/trunk/test/CodeGen/X86/xray-selective-instrumentation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-selective-instrumentation.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-selective-instrumentation.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-selective-instrumentation.ll Thu Jul 12 07:36:43 2018
@@ -1,4 +1,4 @@
-; RUN: llc -mcpu=nehalem < %s | grep xray_sled_
+; RUN: llc -verify-machineinstrs -mcpu=nehalem < %s | grep xray_sled_
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin8"
Modified: llvm/trunk/test/CodeGen/X86/xray-tail-call-sled.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-tail-call-sled.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-tail-call-sled.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-tail-call-sled.ll Thu Jul 12 07:36:43 2018
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
define i32 @callee() nounwind noinline uwtable "function-instrument"="xray-always" {
; CHECK: .p2align 1, 0x90
Modified: llvm/trunk/test/CodeGen/X86/xray-typed-event-log.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-typed-event-log.ll?rev=336906&r1=336905&r2=336906&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xray-typed-event-log.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xray-typed-event-log.ll Thu Jul 12 07:36:43 2018
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
-; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
More information about the llvm-commits
mailing list