Instead of making callers of ExpandLibCall legalize the result, make
authorChris Lattner <sabre@nondot.org>
Sat, 28 Jan 2006 04:28:26 +0000 (04:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Jan 2006 04:28:26 +0000 (04:28 +0000)
ExpandLibCall do it itself.

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

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 2ee5dd5400e6a2042bc1d6f5d6ae74f6e8b8d2bb..ab01632c8db9ef764e4c7ad54e59f3db573dd9a5 100644 (file)
@@ -2208,7 +2208,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
         // Floating point mod -> fmod libcall.
         const char *FnName = Node->getValueType(0) == MVT::f32 ? "fmodf":"fmod";
         SDOperand Dummy;
-        Result = LegalizeOp(ExpandLibCall(FnName, Node, Dummy));
+        Result = ExpandLibCall(FnName, Node, Dummy);
       }
       break;
     }
@@ -2624,7 +2624,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
         default: assert(0 && "Unreachable!");
         }
         SDOperand Dummy;
-        Result = LegalizeOp(ExpandLibCall(FnName, Node, Dummy));
+        Result = ExpandLibCall(FnName, Node, Dummy);
         break;
       }
       default:
@@ -3700,16 +3700,17 @@ SDOperand SelectionDAGLegalize::ExpandLibCall(const char *Name, SDNode *Node,
   switch (getTypeAction(CallInfo.first.getValueType())) {
   default: assert(0 && "Unknown thing");
   case Legal:
-    Result = CallInfo.first;
+    // If the result is legal, make sure that we relegalize the inserted result.
+    Result = LegalizeOp(CallInfo.first);
     break;
   case Promote:
     assert(0 && "Cannot promote this yet!");
   case Expand:
     ExpandOp(CallInfo.first, Result, Hi);
-    CallInfo.second = LegalizeOp(CallInfo.second);
     break;
   }
-  
+
+  CallInfo.second = LegalizeOp(CallInfo.second);
   SpliceCallInto(CallInfo.second, OutChain);
   return Result;
 }
@@ -4415,7 +4416,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
       }
       Lo = DAG.getNode(ISD::MUL, NVT, LL, RL);
     } else {
-      Lo = ExpandLibCall("__muldi3" , Node, Hi); break;
+      Lo = ExpandLibCall("__muldi3" , Node, Hi);
     }
     break;
   }