Issue 100922
Summary BOLT could not find corresponding %pcrel_hi on RISC-V
Labels BOLT
Assignees
Reporter renndong
    I'm trying to optimize a rust program using BOLT on RISC-V, but I get an error `<unknown>:0: error: could not find corresponding %pcrel_hi`.

This is the command that I execute:

```
llvm-bolt <executable> -o <output> -data="" -reorder-blocks=ext-tsp -reorder-functions=hfsort -split-functions -split-all-cold -split-eh -dyno-stats
```

and the BOLT version and rust compiler version I use are:

```
$ llvm-bolt --version
LLVM (http://llvm.org/):
  LLVM version 19.0.0git
 Optimized build with assertions.
BOLT revision 3d72c44fedc13ef51d2584b4fe930edb8d2e87ae

  Registered Targets:
 riscv32 - 32-bit RISC-V
    riscv64 - 64-bit RISC-V
$ rustc -v -V
rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: riscv64gc-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6
```

The output of BOLT is as follows:

<details>

<summary>Output</summary>

```
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: riscv64
BOLT-INFO: BOLT version: 3d72c44fedc13ef51d2584b4fe930edb8d2e87ae
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x200000, offset 0x200000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: disabling -align-macro-fusion on non-x86 platform
BOLT-WARNING: Failed to analyze 41 relocations
BOLT-INFO: pre-processing profile using branch profile reader
BOLT-INFO: operating with basic samples profiling data (no LBR).
BOLT-INFO: normalizing samples by instruction count.
BOLT-INFO: 83 out of 640 functions in the binary (13.0%) have non-empty execution profile
BOLT-INFO: basic block reordering modified layout of 38 functions (45.78% of profiled, 5.41% of total)
BOLT-INFO: UCE removed 4 blocks and 8 bytes of code
BOLT-INFO: 0 Functions were reordered by LoopInversionPass
BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP:

 276799252 : executed forward branches
            83592209 : taken forward branches
            19175433 : executed backward branches
 1975284 : taken backward branches
           230588915 : executed unconditional branches
           217290399 : all function calls
 217290399 : indirect calls
                   0 : PLT calls
 5363549217 : executed instructions
          1360261461 : executed load instructions
          1652341608 : executed store instructions
 0 : taken jump table branches
                   0 : taken unknown indirect branches
           526563600 : total branches
 316156408 : taken branches
           210407192 : non-taken conditional branches
            85567493 : taken conditional branches
 295974685 : all conditional branches

           286282669 : executed forward branches (+3.4%)
             6522058 : taken forward branches (-92.2%)
             9692016 : executed backward branches (-49.5%)
 6625161 : taken backward branches (+235.4%)
            11381856 : executed unconditional branches (-95.1%)
           217290399 : all function calls (=)
             1324278 : indirect calls (-99.4%)
 0 : PLT calls (=)
          4735678411 : executed instructions (-11.7%)
          1360261461 : executed load instructions (=)
          1652341608 : executed store instructions (=)
 0 : taken jump table branches (=)
                   0 : taken unknown indirect branches (=)
           307356541 : total branches (-41.6%)
            24529075 : taken branches (-92.2%)
 282827466 : non-taken conditional branches (+34.4%)
            13147219 : taken conditional branches (-84.6%)
           295974685 : all conditional branches (=)

<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
<unknown>:0: error: could not find corresponding %pcrel_hi
BOLT-ERROR: Emission failed.
```

</details>
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to