aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SplitKit.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-12-15 14:36:06 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-12-15 14:36:06 +0000
commit91b5cf8412a9fffdca96619f02f485c8c48bf852 (patch)
tree45cc792752ed1bae1559f8501bc5e485eda07fed /llvm/lib/CodeGen/SplitKit.cpp
parent2f7f0e7a480d760999f1973d8db76aee590cf83e (diff)
downloadllvm-91b5cf8412a9fffdca96619f02f485c8c48bf852.zip
llvm-91b5cf8412a9fffdca96619f02f485c8c48bf852.tar.gz
llvm-91b5cf8412a9fffdca96619f02f485c8c48bf852.tar.bz2
Extract LaneBitmask into a separate type
Specifically avoid implicit conversions from/to integral types to avoid potential errors when changing the underlying type. For example, a typical initialization of a "full" mask was "LaneMask = ~0u", which would result in a value of 0x00000000FFFFFFFF if the type was extended to uint64_t. Differential Revision: https://reviews.llvm.org/D27454 llvm-svn: 289820
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r--llvm/lib/CodeGen/SplitKit.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp
index b881c6d6..2bbd67a 100644
--- a/llvm/lib/CodeGen/SplitKit.cpp
+++ b/llvm/lib/CodeGen/SplitKit.cpp
@@ -412,7 +412,7 @@ void SplitEditor::addDeadDef(LiveInterval &LI, VNInfo *VNI, bool Original) {
// register, we need to check which subranges need to be updated.
const MachineInstr *DefMI = LIS.getInstructionFromIndex(Def);
assert(DefMI != nullptr);
- LaneBitmask LM = 0;
+ LaneBitmask LM;
for (const MachineOperand &DefOp : DefMI->defs()) {
unsigned R = DefOp.getReg();
if (R != LI.reg)
@@ -425,7 +425,7 @@ void SplitEditor::addDeadDef(LiveInterval &LI, VNInfo *VNI, bool Original) {
}
}
for (LiveInterval::SubRange &S : LI.subranges())
- if (S.LaneMask & LM)
+ if (!(S.LaneMask & LM).none())
S.createDeadDef(Def, LIS.getVNInfoAllocator());
}
}
@@ -1102,8 +1102,8 @@ void SplitEditor::extendPHIRange(MachineBasicBlock &B, LiveRangeCalc &LRC,
LiveInterval &PLI = Edit->getParent();
// Need the cast because the inputs to ?: would otherwise be deemed
// "incompatible": SubRange vs LiveInterval.
- LiveRange &PSR = (LM != ~0u) ? getSubRangeForMask(LM, PLI)
- : static_cast<LiveRange&>(PLI);
+ LiveRange &PSR = !LM.all() ? getSubRangeForMask(LM, PLI)
+ : static_cast<LiveRange&>(PLI);
if (PSR.liveAt(LastUse))
LRC.extend(LR, End, /*PhysReg=*/0, Undefs);
}
@@ -1126,7 +1126,7 @@ void SplitEditor::extendPHIKillRanges() {
LiveRangeCalc &LRC = getLRCalc(RegIdx);
MachineBasicBlock &B = *LIS.getMBBFromIndex(V->def);
if (!removeDeadSegment(V->def, LI))
- extendPHIRange(B, LRC, LI, ~0u, /*Undefs=*/{});
+ extendPHIRange(B, LRC, LI, LaneBitmask::getAll(), /*Undefs=*/{});
}
SmallVector<SlotIndex, 4> Undefs;
@@ -1229,7 +1229,7 @@ void SplitEditor::rewriteAssigned(bool ExtendRanges) {
LaneBitmask LM = Sub != 0 ? TRI.getSubRegIndexLaneMask(Sub)
: MRI.getMaxLaneMaskForVReg(Reg);
for (LiveInterval::SubRange &S : LI.subranges()) {
- if (!(S.LaneMask & LM))
+ if ((S.LaneMask & LM).none())
continue;
// The problem here can be that the new register may have been created
// for a partially defined original register. For example: