Skip to content

Commit 66349e2

Browse files
committed
[RISCV] Correct Branch Range
This aligns the code with the other cases, which take into account the min/max range of `isShiftedInt<N, 1>`. Given IALIGN is always 16 or 32 (bits), this should not make a difference to anything valid.
1 parent 12f8bf3 commit 66349e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ bool RISCVAsmBackend::fixupNeedsRelaxationAdvanced(const MCFixup &Fixup,
133133
case RISCV::fixup_riscv_branch:
134134
case RISCV::fixup_riscv_qc_e_branch:
135135
// For conditional branch instructions the immediate must be
136-
// in the range [-4096, 4095].
137-
return !isInt<13>(Offset);
136+
// in the range [-4096, 4094].
137+
return Offset > 4094 || Offset < -4096;
138138
}
139139
}
140140

0 commit comments

Comments
 (0)