Skip to content

Commit 0248725

Browse files
authored
[RISCV] Correct Branch Range (#142705)
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 79f298e commit 0248725

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
@@ -134,8 +134,8 @@ bool RISCVAsmBackend::fixupNeedsRelaxationAdvanced(const MCFixup &Fixup,
134134
case RISCV::fixup_riscv_branch:
135135
case RISCV::fixup_riscv_qc_e_branch:
136136
// For conditional branch instructions the immediate must be
137-
// in the range [-4096, 4095].
138-
return !isInt<13>(Offset);
137+
// in the range [-4096, 4094].
138+
return Offset > 4094 || Offset < -4096;
139139
}
140140
}
141141

0 commit comments

Comments
 (0)