[PATCH] D66459: Make ShrinkWrap more consistent.
zuojian lin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 18:48:43 PDT 2019
linzj created this revision.
linzj added a reviewer: chill.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
When see a terminator like tail call, useOrDefCSROrFI should return false Immediately.
When checking if a register is a CSR, useOrDefCSROrFI should use getCurrentCSRs.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66459
Files:
llvm/lib/CodeGen/ShrinkWrap.cpp
Index: llvm/lib/CodeGen/ShrinkWrap.cpp
===================================================================
--- llvm/lib/CodeGen/ShrinkWrap.cpp
+++ llvm/lib/CodeGen/ShrinkWrap.cpp
@@ -272,6 +272,8 @@
LLVM_DEBUG(dbgs() << "Frame instruction: " << MI << '\n');
return true;
}
+ if (MI.isTerminator())
+ return false;
for (const MachineOperand &MO : MI.operands()) {
bool UseOrDefCSR = false;
if (MO.isReg()) {
@@ -287,8 +289,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)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66459.216037.patch
Type: text/x-patch
Size: 1041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/25ed103d/attachment.bin>
More information about the llvm-commits
mailing list