| Issue |
167381
|
| Summary |
[RiSC-v] Cannot relax `auipc` + `jr` after Machine Outliner
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
kvpanch
|
Consider following LLVM IR
```
target datalayout = "e-m:e-p:32:64-p1:32:64-i64:64-i128:128-n32:64-S64"
target triple = "riscv64-unknown--elf"
; Function Attrs: minsize
define i256 @func0() #0 {
entry:
ret i256 0
}
; Function Attrs: minsize
define i256 @func1() #0 {
entry:
ret i256 0
}
attributes #0 = { minsize }
```
Compiling it with `llc -O3 test.ll -o test.s` makes Machine Outliner to construct a function `OUTLINED_FUNCTION_0` and add tail call to it to `func0` and `func1`. This generates ELF file without
```
0000000000000000 <func0>:
0: 00000317 auipc t1, 0x0
4: 01030067 jr 0x10(t1) <OUTLINED_FUNCTION_0>
0000000000000008 <func1>:
8: 00000317 auipc t1, 0x0
c: 00830067 jr 0x8(t1) <OUTLINED_FUNCTION_0>
```
which cannot be relaxed as `lld` expects `R_RISCV_CALL_PLT` to be set.
For me it looks like something is not correct here.
One option to fix this is to user `linkodronce` linkage type for outlined function as [comments states](https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/MachineOutliner.cpp#L922-L924)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs