OSDN Git Service

Convert condition to an early exit (NFC).
authorAdrian Prantl <aprantl@apple.com>
Tue, 10 Oct 2017 20:33:43 +0000 (20:33 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 10 Oct 2017 20:33:43 +0000 (20:33 +0000)
<rdar://problem/34689604>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315359 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfExpression.cpp

index 429269d..131497b 100644 (file)
@@ -130,6 +130,8 @@ bool DwarfExpression::addMachineReg(const TargetRegisterInfo &TRI,
     unsigned Size = TRI.getSubRegIdxSize(Idx);
     unsigned Offset = TRI.getSubRegIdxOffset(Idx);
     Reg = TRI.getDwarfRegNum(*SR, false);
+    if (Reg < 0)
+      continue;
 
     // Intersection between the bits we already emitted and the bits
     // covered by this subregister.
@@ -138,7 +140,7 @@ bool DwarfExpression::addMachineReg(const TargetRegisterInfo &TRI,
 
     // If this sub-register has a DWARF number and we haven't covered
     // its range, emit a DWARF piece for it.
-    if (Reg >= 0 && CurSubReg.test(Coverage)) {
+    if (CurSubReg.test(Coverage)) {
       // Emit a piece for any gap in the coverage.
       if (Offset > CurPos)
         DwarfRegs.push_back({-1, Offset - CurPos, nullptr});