diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2009-03-25 20:20:11 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2009-03-25 20:20:11 +0000 |
| commit | 2e9f42bed5578cde090bf7ff701572a2504b1297 (patch) | |
| tree | 361bbe3ab59e2bbec56cab010b073ea5cbb7312b /llvm/lib | |
| parent | 612f8a48429e6d5cfbf7f90c467e00faa5e90109 (diff) | |
| download | bcm5719-llvm-2e9f42bed5578cde090bf7ff701572a2504b1297.tar.gz bcm5719-llvm-2e9f42bed5578cde090bf7ff701572a2504b1297.zip | |
Revert 67132. This is breaking some objective-c apps.
Also fixes SDISel so it *does not* force promote return value if the function is not marked signext / zeroext.
llvm-svn: 67701
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index a5d4caf824e..4bf90508e9f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -980,9 +980,6 @@ void SelectionDAGLowering::visitRet(ReturnInst &I) { for (unsigned j = 0, f = NumValues; j != f; ++j) { MVT VT = ValueVTs[j]; - unsigned NumParts = TLI.getNumRegisters(VT); - MVT PartVT = TLI.getRegisterType(VT); - SmallVector<SDValue, 4> Parts(NumParts); ISD::NodeType ExtendKind = ISD::ANY_EXTEND; const Function *F = I.getParent()->getParent(); @@ -991,6 +988,19 @@ void SelectionDAGLowering::visitRet(ReturnInst &I) { else if (F->paramHasAttr(0, Attribute::ZExt)) ExtendKind = ISD::ZERO_EXTEND; + // FIXME: C calling convention requires the return type to be promoted to + // at least 32-bit. But this is not necessary for non-C calling + // conventions. The frontend should mark functions whose return values + // require promoting with signext or zeroext attributes. + if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger()) { + MVT MinVT = TLI.getRegisterType(MVT::i32); + if (VT.bitsLT(MinVT)) + VT = MinVT; + } + + unsigned NumParts = TLI.getNumRegisters(VT); + MVT PartVT = TLI.getRegisterType(VT); + SmallVector<SDValue, 4> Parts(NumParts); getCopyToParts(DAG, getCurDebugLoc(), SDValue(RetOp.getNode(), RetOp.getResNo() + j), &Parts[0], NumParts, PartVT, ExtendKind); |

