[llvm] [MC][RISCV][LoongArch] Add AlignFragment size if layout is available and not need insert nops (PR #76552)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 29 17:46:56 PST 2023


================
@@ -47,3 +51,28 @@ G2:
 # RELAX: 0x1C R_RISCV_SUB8 .L1 0x0
 # RELAX: 0x1D R_RISCV_ADD8 G2 0x0
 # RELAX: 0x1D R_RISCV_SUB8 G1 0x0
+
+.dword .L3-.L2
----------------
SixWeining wrote:

But the diff is not fixed because there are relaxable instructions (`call extern`) before these 2 labels.

On LoongArch, for example:
```
.text
la.pcrel $t0, foo
L1:
.align 4
L2:
nop
```
When relax is enable, L1 is 4 or 8, L2 is 16. L2-L1=12 or 8.

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


More information about the llvm-commits mailing list