Issue 184098
Summary IPRA: Enabling IPRA fails on certain workload, it is either crash or wrong result.
Labels new issue
Assignees vigbalu
Reporter vigbalu
    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"

[derivedlib.cpp](https://github.com/user-attachments/files/25682115/derivedlib.cpp)
[main.cpp](https://github.com/user-attachments/files/25682114/main.cpp)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to