[PATCH] D20295: When looking for a spill slot in reg scavenger, find one that matches RC
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 11:03:14 PDT 2016
qcolombet accepted this revision.
This revision is now accepted and ready to land.
================
Comment at: lib/CodeGen/RegisterScavenging.cpp:414
@@ +413,3 @@
+ // that is the best fit for this register class (in street metric).
+ // Picking a larger slot than necessary could happen if a slot for a
+ // larger register is reserved before a slot for a smaller one. When
----------------
What worries me is that we have a quadratic complexity here (#scavengedRegister x Scavenged.size()).
That being said, I guess it is pretty small in practice. Therefore, let us move on and we will adapt if it turns out to be a problem.
================
Comment at: lib/CodeGen/RegisterScavenging.cpp:438-443
@@ -413,4 +437,8 @@
// Spill the scavenged register before I.
- assert(Scavenged[SI].FrameIndex >= 0 &&
- "Cannot scavenge register without an emergency spill slot!");
+ if (Scavenged[SI].FrameIndex < 0) {
+ Twine Msg = Twine("Error while trying to spill ") + TRI->getName(SReg) +
+ " from class " + TRI->getRegClassName(RC) +
+ ": Cannot scavenge register without an emergency spill slot!";
+ report_fatal_error(Msg);
+ }
TII->storeRegToStackSlot(*MBB, I, SReg, true, Scavenged[SI].FrameIndex,
----------------
kparzysz wrote:
> At the second thought---wouldn't it be better to keep the "unreachable"? report_fatal_error does not print the call stack.
We could do both maybe.
The problem is that llvm_unreachable expands to nothing in release mode. Thus we may silently generate broken code or a crash somewhere else in the compiler.
Repository:
rL LLVM
http://reviews.llvm.org/D20295
More information about the llvm-commits
mailing list