1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[ImplicitNullChecks] Properly update the live-in of the block of the memory operation.

We basically replace:
HoistBB:
cond_br NullBB, NotNullBB

NullBB:
  ...

NotNullBB:
  <reg> = load

into
HoistBB
<reg> = load_faulting_op NullBB
uncond_br NotNullBB

NullBB:
  ...

NotNullBB: ## <reg> is now live-in of NotNullBB
  ...

This partially fixes the machine verifier error for
test/CodeGen/X86/implicit-null-check.ll, but it still fails because
of the implicit CFG structure.

llvm-svn: 267817
This commit is contained in:
Quentin Colombet 2016-04-27 23:26:40 +00:00
parent 3a8084117b
commit f4848d8e0c

View File

@ -397,7 +397,16 @@ void ImplicitNullChecks::rewriteNullChecks(
// check earlier ensures that this bit of code motion is legal. We do not
// touch the successors list for any basic block since we haven't changed
// control flow, we've just made it implicit.
insertFaultingLoad(NC.MemOperation, NC.CheckBlock, HandlerLabel);
MachineInstr *FaultingLoad =
insertFaultingLoad(NC.MemOperation, NC.CheckBlock, HandlerLabel);
// Now the value of the MemOperation, if any, is live-in of block
// of MemOperation.
unsigned Reg = FaultingLoad->getOperand(0).getReg();
if (Reg) {
MachineBasicBlock *MBB = NC.MemOperation->getParent();
if (!MBB->isLiveIn(Reg))
MBB->addLiveIn(Reg);
}
NC.MemOperation->eraseFromParent();
NC.CheckOperation->eraseFromParent();