diff options
author | Mandeep Singh Grang <mgrang@codeaurora.org> | 2017-11-10 19:09:28 +0000 |
---|---|---|
committer | Mandeep Singh Grang <mgrang@codeaurora.org> | 2017-11-10 19:09:28 +0000 |
commit | 5f043ae2e16ba9ebe8d58aa7c225fed9bfaf7b90 (patch) | |
tree | 6999cff593ee48d22e437ef422847f1301fa4843 | |
parent | 36e56785b42c02831a13459d98c5b86c4f3656d9 (diff) | |
download | bcm5719-llvm-5f043ae2e16ba9ebe8d58aa7c225fed9bfaf7b90.tar.gz bcm5719-llvm-5f043ae2e16ba9ebe8d58aa7c225fed9bfaf7b90.zip |
[RISCV] Silence an unused variable warning in release builds [NFC]
Summary:
Also minor cleanups:
1. Avoided multiple calls to Fixup.getKind()
2. Avoided multiple calls to getFixupKindInfo()
3. Removed a redundant return.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, llvm-commits
Differential Revision: https://reviews.llvm.org/D39881
llvm-svn: 317908
-rw-r--r-- | llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp index add63b6e77f..e4e17bed5af 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp @@ -161,11 +161,9 @@ void RISCVAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, 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); @@ -173,14 +171,17 @@ void RISCVAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, 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> diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp b/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp index cd658d7e2d9..75b277531ce 100644 --- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp @@ -82,7 +82,6 @@ void RISCVRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, MI.getOperand(FIOperandNum).ChangeToRegister(FrameReg, false); MI.getOperand(FIOperandNum + 1).ChangeToImmediate(Offset); - return; } unsigned RISCVRegisterInfo::getFrameRegister(const MachineFunction &MF) const { |