diff options
author | Michael Ilseman <milseman@apple.com> | 2014-12-15 18:48:43 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2014-12-15 18:48:43 +0000 |
commit | addddc441f9c7fbd4ed70bc5a3256c385599929d (patch) | |
tree | d418ffd0237296eef0ec82e40c001e7771dc66c3 /llvm/lib/CodeGen/ExecutionDepsFix.cpp | |
parent | b736bf38990c4d474b1267f90c0706a3c983a10f (diff) | |
download | bcm5719-llvm-addddc441f9c7fbd4ed70bc5a3256c385599929d.tar.gz bcm5719-llvm-addddc441f9c7fbd4ed70bc5a3256c385599929d.zip |
Silence more static analyzer warnings.
Add in definedness checks for shift operators, null checks when
pointers are assumed by the code to be non-null, and explicit
unreachables.
llvm-svn: 224255
Diffstat (limited to 'llvm/lib/CodeGen/ExecutionDepsFix.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ExecutionDepsFix.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/ExecutionDepsFix.cpp b/llvm/lib/CodeGen/ExecutionDepsFix.cpp index 3680498927e..18c82c85e55 100644 --- a/llvm/lib/CodeGen/ExecutionDepsFix.cpp +++ b/llvm/lib/CodeGen/ExecutionDepsFix.cpp @@ -74,6 +74,8 @@ struct DomainValue { // Is domain available? bool hasDomain(unsigned domain) const { + assert(domain < std::numeric_limits<unsigned>::digits && + "undefined behavior"); return AvailableDomains & (1u << domain); } @@ -338,9 +340,11 @@ bool ExeDepsFix::merge(DomainValue *A, DomainValue *B) { // All uses of B are referred to A. B->Next = retain(A); - for (unsigned rx = 0; rx != NumRegs; ++rx) + for (unsigned rx = 0; rx != NumRegs; ++rx) { + assert(LiveRegs && "no space allocated for live registers"); if (LiveRegs[rx].Value == B) setLiveReg(rx, A); + } return true; } @@ -645,6 +649,7 @@ void ExeDepsFix::visitSoftInstr(MachineInstr *mi, unsigned mask) { SmallVector<LiveReg, 4> Regs; for (SmallVectorImpl<int>::iterator i=used.begin(), e=used.end(); i!=e; ++i) { int rx = *i; + assert(LiveRegs && "no space allocated for live registers"); const LiveReg &LR = LiveRegs[rx]; // This useless DomainValue could have been missed above. if (!LR.Value->getCommonDomains(available)) { @@ -684,9 +689,11 @@ void ExeDepsFix::visitSoftInstr(MachineInstr *mi, unsigned mask) { continue; // If latest didn't merge, it is useless now. Kill all registers using it. - for (SmallVectorImpl<int>::iterator i=used.begin(), e=used.end(); i!=e; ++i) - if (LiveRegs[*i].Value == Latest) - kill(*i); + for (int i : used) { + assert(LiveRegs && "no space allocated for live registers"); + if (LiveRegs[i].Value == Latest) + kill(i); + } } // dv is the DomainValue we are going to use for this instruction. |