[PATCH] D36415: Insert IMPLICIT_DEFS for undef uses in tail merging
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 7 10:40:54 PDT 2017
MatzeB added inline comments.
================
Comment at: lib/CodeGen/BranchFolding.cpp:385-398
+ CalcLiveIns.init(*TRI);
+ CalcLiveIns.addLiveOutsNoPristines(*Pred);
+ for (const MachineInstr &MI : llvm::reverse(*Pred))
+ CalcLiveIns.stepBackward(MI);
+
+ LivePhysRegs LiveIns(*TRI);
+ LiveIns.addLiveIns(*Pred);
----------------
I'm confused: Don't you need to compare the live-outs of `Pred` with the live-ins of `NewDest`? Adding the liveouts of Pred and stepping backwards over the instructions gives you the live-ins of Pred, but I don't see what they are good for.
I would have expected this to look like this:
```
PredLiveOuts.init(*TRI);
PrevLiveOuts.addLiveOutsNoPristines(*Pred);
// Add implicit defs for NewDest live-in values not available at end of Pred.
for (const MachineBasicBlock::RegisterMaskPair &LI : NewDest->liveins()) {
// computeLiveIn() currently doesn't add partial live-ins so we are fine with an assert.
assert(LI.LaneMask == LaneBitmask::getAll() && "found partial live-in");
if (PredLiveOuts.available(*MRI, LI.PhysReg)) {
BuildMI ...
}
}
```
Repository:
rL LLVM
https://reviews.llvm.org/D36415
More information about the llvm-commits
mailing list