Fix a bug where we didn't insert FP_REG_KILL instructions into MBB's that
authorChris Lattner <sabre@nondot.org>
Wed, 12 Jan 2005 02:57:10 +0000 (02:57 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Jan 2005 02:57:10 +0000 (02:57 +0000)
contain FP PHI nodes but no other FP defining instructions.  This fixes
183.equake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19495 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelPattern.cpp

index 34d13564707ff4aed743e09c0a79767f5a0bf70d..22c926a855bf7cba13d76b0d075067d057fb4fe9 100644 (file)
@@ -331,6 +331,21 @@ namespace {
       // FP_REG_KILL insertion.
       ContainsFPCode = false;
 
+      // Scan the PHI nodes that already are inserted into this basic block.  If
+      // any of them is a PHI of a floating point value, we need to insert an
+      // FP_REG_KILL.
+      SSARegMap *RegMap = BB->getParent()->getSSARegMap();
+      for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end();
+           I != E; ++I) {
+        assert(I->getOpcode() == X86::PHI &&
+               "Isn't just PHI nodes?");
+        if (RegMap->getRegClass(I->getOperand(0).getReg()) ==
+            X86::RFPRegisterClass) {
+          ContainsFPCode = true;
+          break;
+        }
+      }
+
       // Compute the RegPressureMap, which is an approximation for the number of
       // registers required to compute each node.
       ComputeRegPressure(DAG.getRoot());