[PATCH] D39881: [RISCV] Silence an unused variable warning in release builds [NFC]

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 11:09:37 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL317908: [RISCV] Silence an unused variable warning in release builds [NFC] (authored by mgrang).

Changed prior to commit:
  https://reviews.llvm.org/D39881?vs=122364&id=122486#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39881

Files:
  llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
  llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp


Index: llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp
+++ llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp
@@ -82,7 +82,6 @@
 
   MI.getOperand(FIOperandNum).ChangeToRegister(FrameReg, false);
   MI.getOperand(FIOperandNum + 1).ChangeToImmediate(Offset);
-  return;
 }
 
 unsigned RISCVRegisterInfo::getFrameRegister(const MachineFunction &MF) const {
Index: llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
===================================================================
--- llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ llvm/trunk/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -161,26 +161,27 @@
                                  MutableArrayRef<char> Data, uint64_t Value,
                                  bool IsResolved) const {
   MCContext &Ctx = Asm.getContext();
-  MCFixupKind Kind = Fixup.getKind();
-  unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8;
+  MCFixupKindInfo Info = getFixupKindInfo(Fixup.getKind());
   if (!Value)
     return; // Doesn't change encoding.
-  MCFixupKindInfo Info = getFixupKindInfo(Fixup.getKind());
   // Apply any target-specific value adjustments.
   Value = adjustFixupValue(Fixup, Value, Ctx);
 
   // Shift the value into position.
   Value <<= Info.TargetOffset;
 
   unsigned Offset = Fixup.getOffset();
+
+#ifndef NDEBUG
+  unsigned NumBytes = (Info.TargetSize + 7) / 8;
   assert(Offset + NumBytes <= Data.size() && "Invalid fixup offset!");
+#endif
 
   // For each byte of the fragment that the fixup touches, mask in the
   // bits from the fixup value.
   for (unsigned i = 0; i != 4; ++i) {
     Data[Offset + i] |= uint8_t((Value >> (i * 8)) & 0xff);
   }
-  return;
 }
 
 std::unique_ptr<MCObjectWriter>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39881.122486.patch
Type: text/x-patch
Size: 1847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171110/f5acc356/attachment.bin>


More information about the llvm-commits mailing list