[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue Jul 6 11:04:02 PDT 2004


Changes in directory llvm/lib/CodeGen:

LiveIntervals.cpp updated: 1.84 -> 1.85

---
Log message:

Do not crash when joining two intervals of registers of different
classes: just ignore that move. Thanks to Vladimir Prus who found the
bug!


---
Diffs of the changes:  (+10 -1)

Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.84 llvm/lib/CodeGen/LiveIntervals.cpp:1.85
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.84	Fri Jul  2 00:52:23 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp	Tue Jul  6 11:03:21 2004
@@ -502,7 +502,9 @@
                     const TargetRegisterClass *rcA, *rcB;
                     rcA = mf_->getSSARegMap()->getRegClass(intA->reg);
                     rcB = mf_->getSSARegMap()->getRegClass(intB->reg);
-                    assert(rcA == rcB && "registers must be of the same class");
+                    // if they are not of the same register class we continue
+                    if (rcA != rcB)
+                        continue;
 
                     // if their intervals do not overlap we join them
                     if (!intB->overlaps(*intA)) {
@@ -524,6 +526,13 @@
                            MRegisterInfo::isVirtualRegister(intB->reg) &&
                            "A must be physical and B must be virtual");
 
+                    const TargetRegisterClass *rcA, *rcB;
+                    rcA = mri_->getRegClass(intA->reg);
+                    rcB = mf_->getSSARegMap()->getRegClass(intB->reg);
+                    // if they are not of the same register class we continue
+                    if (rcA != rcB)
+                        continue;
+
                     if (!intA->overlaps(*intB) &&
                         !overlapsAliases(*intA, *intB)) {
                         intA->join(*intB);





More information about the llvm-commits mailing list