aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-02 20:26:58 +0000
committerChris Lattner <sabre@nondot.org>2005-09-02 20:26:58 +0000
commit99c25b86aa85b0093f24b2394a5aa37f66294b2b (patch)
tree548e8a67f7a296392377a3f058915c6956e0e413
parentc78970136005b09eccf5b8bba6ebbb34581de6c0 (diff)
Fix a bug in legalize where it would emit two calls to libcalls that return
i64 values on targets that need that expanded to 32-bit registers. This fixes PowerPC/2005-09-02-LegalizeDuplicatesCalls.ll and speeds up 189.lucas from taking 122.72s to 81.96s on my desktop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23228 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 461104c1f5..34048f8a4b 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1996,7 +1996,7 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
SDOperand Result;
SDNode *Node = Op.Val;
- if (!Node->hasOneUse()) {
+ if (1 || !Node->hasOneUse()) {
std::map<SDOperand, SDOperand>::iterator I = PromotedNodes.find(Op);
if (I != PromotedNodes.end()) return I->second;
} else {
@@ -2709,21 +2709,24 @@ SDOperand SelectionDAGLegalize::ExpandLibCall(const char *Name, SDNode *Node,
std::pair<SDOperand,SDOperand> CallInfo =
TLI.LowerCallTo(InChain, RetTy, false, CallingConv::C, false,
Callee, Args, DAG);
- SpliceCallInto(CallInfo.second, OutChain);
-
- NeedsAnotherIteration = true;
+ SDOperand Result;
switch (getTypeAction(CallInfo.first.getValueType())) {
default: assert(0 && "Unknown thing");
case Legal:
- return CallInfo.first;
+ Result = CallInfo.first;
+ break;
case Promote:
assert(0 && "Cannot promote this yet!");
case Expand:
- SDOperand Lo;
- ExpandOp(CallInfo.first, Lo, Hi);
- return Lo;
+ ExpandOp(CallInfo.first, Result, Hi);
+ CallInfo.second = LegalizeOp(CallInfo.second);
+ break;
}
+
+ SpliceCallInto(CallInfo.second, OutChain);
+ NeedsAnotherIteration = true;
+ return Result;
}
@@ -2845,7 +2848,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
// If there is more than one use of this, see if we already expanded it.
// There is no use remembering values that only have a single use, as the map
// entries will never be reused.
- if (!Node->hasOneUse()) {
+ if (1 || !Node->hasOneUse()) {
std::map<SDOperand, std::pair<SDOperand, SDOperand> >::iterator I
= ExpandedNodes.find(Op);
if (I != ExpandedNodes.end()) {
@@ -3259,7 +3262,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
}
// Remember in a map if the values will be reused later.
- if (!Node->hasOneUse()) {
+ if (1 || !Node->hasOneUse()) {
bool isNew = ExpandedNodes.insert(std::make_pair(Op,
std::make_pair(Lo, Hi))).second;
assert(isNew && "Value already expanded?!?");