[llvm] r269951 - AMDGPU: Error if branch distance exceeds limit
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 09:10:24 PDT 2016
Author: arsenm
Date: Wed May 18 11:10:24 2016
New Revision: 269951
URL: http://llvm.org/viewvc/llvm-project?rev=269951&view=rev
Log:
AMDGPU: Error if branch distance exceeds limit
Modified:
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp?rev=269951&r1=269950&r2=269951&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp Wed May 18 11:10:24 2016
@@ -96,8 +96,12 @@ void AMDGPUAsmBackend::applyFixup(const
switch ((unsigned)Fixup.getKind()) {
case AMDGPU::fixup_si_sopp_br: {
+ int64_t BrImm = (Value - 4) / 4;
+ if (!isInt<16>(BrImm))
+ report_fatal_error("branch size exceeds simm16");
+
uint16_t *Dst = (uint16_t*)(Data + Fixup.getOffset());
- *Dst = (Value - 4) / 4;
+ *Dst = BrImm;
break;
}
More information about the llvm-commits
mailing list