[llvm] r289315 - [AVR] Fix a bunch of incorrect assertion messages

Dylan McKay via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 21:48:49 PST 2016


Author: dylanmckay
Date: Fri Dec  9 23:48:48 2016
New Revision: 289315

URL: http://llvm.org/viewvc/llvm-project?rev=289315&view=rev
Log:
[AVR] Fix a bunch of incorrect assertion messages

These should've been checking whether the immediate is a 6-bit unsigned
integer.

If the immediate was '63', this would cause an assertion error which
shouldn't have occurred.

Modified:
    llvm/trunk/lib/Target/AVR/AVRExpandPseudoInsts.cpp
    llvm/trunk/lib/Target/AVR/AVRRegisterInfo.cpp

Modified: llvm/trunk/lib/Target/AVR/AVRExpandPseudoInsts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRExpandPseudoInsts.cpp?rev=289315&r1=289314&r2=289315&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/AVRExpandPseudoInsts.cpp (original)
+++ llvm/trunk/lib/Target/AVR/AVRExpandPseudoInsts.cpp Fri Dec  9 23:48:48 2016
@@ -654,7 +654,7 @@ bool AVRExpandPseudo::expand<AVR::LDDWRd
   OpHi = AVR::LDDRdPtrQ;
   TRI->splitReg(DstReg, DstLoReg, DstHiReg);
 
-  assert(Imm < 63 && "Offset is out of range");
+  assert(Imm <= 63 && "Offset is out of range");
 
   unsigned TmpLoReg = DstLoReg;
   unsigned TmpHiReg = DstHiReg;
@@ -1016,7 +1016,7 @@ bool AVRExpandPseudo::expand<AVR::STDWPt
   OpHi = AVR::STDPtrQRr;
   TRI->splitReg(SrcReg, SrcLoReg, SrcHiReg);
 
-  assert(Imm < 63 && "Offset is out of range");
+  assert(Imm <= 63 && "Offset is out of range");
 
   auto MIBLO = buildMI(MBB, MBBI, OpLo)
     .addReg(DstReg)
@@ -1046,7 +1046,7 @@ bool AVRExpandPseudo::expand<AVR::INWRdA
   OpHi = AVR::INRdA;
   TRI->splitReg(DstReg, DstLoReg, DstHiReg);
 
-  assert(Imm < 63 && "Address is out of range");
+  assert(Imm <= 63 && "Address is out of range");
 
   auto MIBLO = buildMI(MBB, MBBI, OpLo)
     .addReg(DstLoReg, RegState::Define | getDeadRegState(DstIsDead))
@@ -1074,7 +1074,7 @@ bool AVRExpandPseudo::expand<AVR::OUTWAR
   OpHi = AVR::OUTARr;
   TRI->splitReg(SrcReg, SrcLoReg, SrcHiReg);
 
-  assert(Imm < 63 && "Address is out of range");
+  assert(Imm <= 63 && "Address is out of range");
 
   // 16 bit I/O writes need the high byte first
   auto MIBHI = buildMI(MBB, MBBI, OpHi)

Modified: llvm/trunk/lib/Target/AVR/AVRRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRRegisterInfo.cpp?rev=289315&r1=289314&r2=289315&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/AVRRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/AVR/AVRRegisterInfo.cpp Fri Dec  9 23:48:48 2016
@@ -193,7 +193,7 @@ void AVRRegisterInfo::eliminateFrameInde
   // If the offset is too big we have to adjust and restore the frame pointer
   // to materialize a valid load/store with displacement.
   //:TODO: consider using only one adiw/sbiw chain for more than one frame index
-  if (Offset >= 63) {
+  if (Offset > 63) {
     unsigned AddOpc = AVR::ADIWRdK, SubOpc = AVR::SBIWRdK;
     int AddOffset = Offset - 63 + 1;
 




More information about the llvm-commits mailing list