[llvm] r185191 - Fix an off-by-one error. Also make the code a little more explicit in what it

Chad Rosier mcrosier at apple.com
Fri Jun 28 11:57:02 PDT 2013


Author: mcrosier
Date: Fri Jun 28 13:57:01 2013
New Revision: 185191

URL: http://llvm.org/viewvc/llvm-project?rev=185191&view=rev
Log:
Fix an off-by-one error.  Also make the code a little more explicit in what it
is trying to do.

Modified:
    llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp

Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=185191&r1=185190&r2=185191&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Fri Jun 28 13:57:01 2013
@@ -115,9 +115,10 @@ namespace {
       unsigned Mask = 0;
       for (MachineBasicBlock::livein_iterator I = MBB->livein_begin(),
            E = MBB->livein_end(); I != E; ++I) {
-        unsigned Reg = *I - X86::FP0;
-        if (Reg < 8)
-          Mask |= 1 << Reg;
+        unsigned Reg = *I;
+        if (Reg < X86::FP0 || Reg > X86::FP6)
+          continue;
+        Mask |= 1 << (Reg - X86::FP0);
       }
       return Mask;
     }





More information about the llvm-commits mailing list