[ImplicitNullCheck] Fix an edge case where we were hoisting incorrectly
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 17 Nov 2016 07:29:40 +0000 (07:29 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 17 Nov 2016 07:29:40 +0000 (07:29 +0000)
commit4a8fe09040de2dbb7aa865c590a1bb18bf2e4a30
tree7e9ecd816b48b15bf68b92d10bcb4fe0a09cf712
parentf2e0d384e148ff9f5d97708a6d78f70915debd5d
[ImplicitNullCheck] Fix an edge case where we were hoisting incorrectly

ImplicitNullCheck keeps track of one instruction that the memory
operation depends on that it also hoists with the memory operation.
When hoisting this dependency, it would sometimes clobber a live-in
value to the basic block we were hoisting the two things out of.  Fix
this by explicitly looking for such dependencies.

I also noticed two redundant checks on `MO.isDef()` in IsMIOperandSafe.
They're redundant since register MachineOperands are either Defs or Uses
-- there is no third kind.  I'll change the checks to asserts in a later
commit.

llvm-svn: 287213
llvm/lib/CodeGen/ImplicitNullChecks.cpp
llvm/test/CodeGen/X86/implicit-null-checks.mir