[XRay] Fix assertion failure on empty machine basic blocks (PR 31424)
authorDean Michael Berris <dberris@google.com>
Mon, 19 Dec 2016 09:20:38 +0000 (09:20 +0000)
committerDean Michael Berris <dberris@google.com>
Mon, 19 Dec 2016 09:20:38 +0000 (09:20 +0000)
commit03b8be575e36f847387e314cfab75c2ae54e831f
treea80da5a149a05859b80e011ce10021f5c29acaa0
parentff8d61369b181ede3c313c85feb39e0a402d0e38
[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
llvm/lib/CodeGen/XRayInstrumentation.cpp
llvm/test/CodeGen/X86/xray-empty-firstmbb.mir [new file with mode: 0644]
llvm/test/CodeGen/X86/xray-empty-function.mir [new file with mode: 0644]