[llvm] [AMDGPU] Relax long branches in the assembler on gfx1251 (PR #228363)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 03:39:53 PDT 2026


================
@@ -3089,6 +3089,11 @@ bool SIInstrInfo::isBranchOffsetInRange(unsigned BranchOp,
   // because its dest block is unanalyzable.
   assert(isSOPP(BranchOp) || isSOPK(BranchOp));
 
+  // With s_add_pc_i64, out of range branches are relaxed by the assembler
+  // without needing any registers.
+  if (ST.useAddPC64Inst())
+    return true;
----------------
arsenm wrote:

If you start with the long branch then relaxation isn't necessary, and performing the relaxation is an optimization you could choose to not do at -O0 or something. In general it's nicer to have code that works correctly and is refined into a more optimal form than relying on a later fixup 

https://github.com/llvm/llvm-project/pull/228363


More information about the llvm-commits mailing list