OSDN Git Service

[X86] Model FAULTING_LOAD_OP as a terminator and branch.
authorQuentin Colombet <qcolombet@apple.com>
Mon, 2 May 2016 22:58:54 +0000 (22:58 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Mon, 2 May 2016 22:58:54 +0000 (22:58 +0000)
commita15f9f52c3ee0cebe9142aa971db46825d52e040
tree4949e889c4b97d73c37fc09442c8862cbfb617dd
parentbe15f60fee97685728b20f82df0bb061761cbc30
[X86] Model FAULTING_LOAD_OP as a terminator and branch.

This operation may branch to the handler block and we do not want it
to happen anywhere within the basic block.
Moreover, by marking it "terminator and branch" the machine verifier
does not wrongly assume (because of AnalyzeBranch not knowing better)
the branch is analyzable. Indeed, the target was seeing only the
unconditional branch and not the faulting load op and thought it was
a simple unconditional block.
The machine verifier was complaining because of that and moreover,
other optimizations could have done wrong transformation!

In the process, simplify the representation of the handler block in
the faulting load op. Now, we directly reference the handler block
instead of using a label. This has the benefits of:
1. MC knows how to issue a label for a BB, so leave that to it.
2. Accessing the target BB from its label is painful, whereas it is
   direct from a MBB operand.

Note: The 2 bytes offset in implicit-null-check.ll comes from the
fact the unconditional jumps are not removed anymore, as the whole
terminator sequence is not analyzable anymore.

Will fix it in a subsequence commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268327 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/Target.td
lib/CodeGen/ImplicitNullChecks.cpp
lib/Target/X86/X86MCInstLower.cpp
test/CodeGen/X86/implicit-null-check.ll