-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
Description
When compiling position independent code for RISC-V and trying to access global variable inside any loop, the compiler tries to get the address of the global variable from GOT in every iteration of the loop, while in ARM, it does it only once before entering the loop.
I think it only need to do it once in RISC-V as well.
Example code that illisturate the problem compiled for RISC-V and ARM:
https://godbolt.org/z/YMoxGrY97
Edit: GCC does it before entering the loop for RISC-V