forked from OSchip/llvm-project
[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:
parent
a4c3f67fe8
commit
12b69919a2
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue