[PATCH] D59842: RegScavenger: Fix !AllowSpill if no regs are available
Francis Visoiu Mistrih via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 14:13:55 PDT 2019
thegameg added a comment.
I would have a slight preference for just:
diff --git a/llvm/lib/CodeGen/RegisterScavenging.cpp b/llvm/lib/CodeGen/RegisterScavenging.cpp
index bb19110e6d70..b9e30c579e65 100644
--- a/llvm/lib/CodeGen/RegisterScavenging.cpp
+++ b/llvm/lib/CodeGen/RegisterScavenging.cpp
@@ -554,6 +554,11 @@ unsigned RegScavenger::scavengeRegister(const TargetRegisterClass *RC,
if (Available.any())
Candidates = Available;
+ if (Candidates.none()) {
+ assert(!AllowSpill && "No candidates for scavenging");
+ return 0;
+ }
+
// Find the register whose use is furthest away.
MachineBasicBlock::iterator UseMI;
unsigned SReg = findSurvivorReg(I, Candidates, 25, UseMI);
with maybe a comment on when this can happen.
Also maybe a MIR test with `$reg = IMPLICIT_DEF` instead of the inline asm would be nicer?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59842/new/
https://reviews.llvm.org/D59842
More information about the llvm-commits
mailing list