aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/VirtRegMap.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/VirtRegMap.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/VirtRegMap.cpp')
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 57aa740..c181bc0 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -266,7 +266,7 @@ void VirtRegRewriter::addLiveInsForSubRanges(const LiveInterval &LI,
SlotIndex MBBBegin = MBBI->first;
// Advance all subrange iterators so that their end position is just
// behind MBBBegin (or the iterator is at the end).
- LaneBitmask LaneMask = 0;
+ LaneBitmask LaneMask;
for (auto &RangeIterPair : SubRanges) {
const LiveInterval::SubRange *SR = RangeIterPair.first;
LiveInterval::const_iterator &SRI = RangeIterPair.second;
@@ -277,7 +277,7 @@ void VirtRegRewriter::addLiveInsForSubRanges(const LiveInterval &LI,
if (SRI->start <= MBBBegin)
LaneMask |= SR->LaneMask;
}
- if (LaneMask == 0)
+ if (LaneMask.none())
continue;
MachineBasicBlock *MBB = MBBI->second;
MBB->addLiveIn(PhysReg, LaneMask);
@@ -342,7 +342,7 @@ bool VirtRegRewriter::readsUndefSubreg(const MachineOperand &MO) const {
LaneBitmask UseMask = TRI->getSubRegIndexLaneMask(SubRegIdx);
// See if any of the relevant subregister liveranges is defined at this point.
for (const LiveInterval::SubRange &SR : LI.subranges()) {
- if ((SR.LaneMask & UseMask) != 0 && SR.liveAt(BaseIndex))
+ if (!(SR.LaneMask & UseMask).none() && SR.liveAt(BaseIndex))
return false;
}
return true;