IPRA: Enabling IPRA fails on certain workload, it is either crash or wrong result.
When IPRA is enabled, caller-saved registers are used across function calls without save/restore. The IPRA pass looks for the unused caller-saved registers in the callee before using them in the caller.
However, for PLT calls, the register usage in the PLT stubs and the resolver function is not accounted for. This can lead to registers being overwritten during the resolver call, causing the original values of unsaved caller-saved registers to be lost.
Commands to reproduce the issue: clang++ -O1 -Wl,-mllvm -Wl,-enable-ipra=true -flto -fPIC -shared -o libd.so derivedlib.cc -fuse-ld=lld clang++ -O1 -Wl,-mllvm -Wl,-enable-ipra=true -flto -ld -L. main.c -fuse-ld=lld
RET VALUE = -2058063447(or something else) with IPRA whereas without IPRA "RET VALUE = 15107"
I have started working on it.