https://bugs.llvm.org/show_bug.cgi?id=42999
Bug ID: 42999
Summary: ShrinkWrap pass uses wrong csr
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: manjian2...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
Index: lib/CodeGen/ShrinkWrap.cpp
===================================================================
--- lib/CodeGen/ShrinkWrap.cpp (revision 359070)
+++ lib/CodeGen/ShrinkWrap.cpp (working copy)
@@ -280,8 +280,8 @@
// separately. An SP mentioned by a call instruction, we can ignore,
// though, as it's harmless and we do not want to effectively disable
tail
// calls by forcing the restore point to post-dominate them.
- UseOrDefCSR = (!MI.isCall() && PhysReg == SP) ||
- RCI.getLastCalleeSavedAlias(PhysReg);
+ UseOrDefCSR =
+ (!MI.isCall() && PhysReg == SP) ||
getCurrentCSRs(RS).count(PhysReg);
} else if (MO.isRegMask()) {
// Check if this regmask clobbers any of the CSRs.
for (unsigned Reg : getCurrentCSRs(RS)) {
RCI.getLastCalleeSavedAlias(PhysReg) may work on many cases, but one target may
specify other CSRs in its frame lowering implementation. For example,
ARMFrameLowering.cpp has the following code:
if (STI.isTargetWindows() &&
WindowsRequiresStackProbe(MF, MFI.estimateStackSize(MF))) {
SavedRegs.set(ARM::R4);
SavedRegs.set(ARM::LR);
}
It add R4 to CSR set. So I suggest ShrinkWrap should use the patch above, which
uses getCurrentCSRs to determine CSRs.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs