diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-04-27 23:26:40 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-04-27 23:26:40 +0000 |
commit | 12b69919a22a3c2fbaf956f41290a56ebddf9a24 (patch) | |
tree | 61b8ff684563bd77783cdf406143dc417ce41384 /llvm/lib | |
parent | a4c3f67fe8c29a9a712de8db0b4d66743529749c (diff) | |
download | bcm5719-llvm-12b69919a22a3c2fbaf956f41290a56ebddf9a24.tar.gz bcm5719-llvm-12b69919a22a3c2fbaf956f41290a56ebddf9a24.zip |
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/ImplicitNullChecks.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp index 2c03f72601c..c923ddd9471 100644 --- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -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(); |