diff options
author | Dean Michael Berris <dberris@google.com> | 2016-12-19 09:20:38 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2016-12-19 09:20:38 +0000 |
commit | 03b8be575e36f847387e314cfab75c2ae54e831f (patch) | |
tree | a80da5a149a05859b80e011ce10021f5c29acaa0 /llvm/test | |
parent | ff8d61369b181ede3c313c85feb39e0a402d0e38 (diff) | |
download | bcm5719-llvm-03b8be575e36f847387e314cfab75c2ae54e831f.tar.gz bcm5719-llvm-03b8be575e36f847387e314cfab75c2ae54e831f.zip |
[XRay] Fix assertion failure on empty machine basic blocks (PR 31424)
The original version of the code in XRayInstrumentation.cpp assumed that
functions may not have empty machine basic blocks (or that the first one
couldn't be). This change addresses that by special-casing that specific
situation.
We provide two .mir test-cases to make sure we're handling this
appropriately.
Fixes llvm.org/PR31424.
Reviewers: chandlerc
Subscribers: varno, llvm-commits
Differential Revision: https://reviews.llvm.org/D27913
llvm-svn: 290091
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/X86/xray-empty-firstmbb.mir | 23 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/xray-empty-function.mir | 13 |
2 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/xray-empty-firstmbb.mir b/llvm/test/CodeGen/X86/xray-empty-firstmbb.mir new file mode 100644 index 00000000000..746ee157387 --- /dev/null +++ b/llvm/test/CodeGen/X86/xray-empty-firstmbb.mir @@ -0,0 +1,23 @@ +# RUN: llc -run-pass xray-instrumentation -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s +# +# Make sure we can handle empty first basic blocks. + +--- | + + define i32 @foo() noinline uwtable "xray-instruction-threshold"="1" { + entry: + unreachable + } + +... + +--- +name: foo +tracksRegLiveness: true +liveins: + - { reg: '%edi'} +body: | + bb.0.entry: + liveins: %edi + ; CHECK-NOT: PATCHABLE_FUNCTION_ENTER +... diff --git a/llvm/test/CodeGen/X86/xray-empty-function.mir b/llvm/test/CodeGen/X86/xray-empty-function.mir new file mode 100644 index 00000000000..3229c93bed9 --- /dev/null +++ b/llvm/test/CodeGen/X86/xray-empty-function.mir @@ -0,0 +1,13 @@ +# RUN: llc -run-pass xray-instrumentation -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s +# +# Make sure we can handle empty functions. +--- +name: empty +tracksRegLiveness: true +liveins: + - { reg: '%edi'} +body: | + bb.0: + ; CHECK-NOT: PATCHABLE_FUNCTION_ENTER +... + |