summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-04-04 07:44:02 +0000
committerJay Foad <jay.foad@gmail.com>2011-04-04 07:44:02 +0000
commit11522097be6dc7833d2a1c2d8ba64096e29c12af (patch)
treedb278c9fa844c01c3c66118dae22d453fb37d72e /llvm/lib
parent72adff255ed557358f5df5182c05fc1c11b90fd9 (diff)
downloadbcm5719-llvm-11522097be6dc7833d2a1c2d8ba64096e29c12af.tar.gz
bcm5719-llvm-11522097be6dc7833d2a1c2d8ba64096e29c12af.zip
Remove some support for ReturnInsts with multiple operands, and for
returning a scalar value in a function whose return type is a single- element structure or array. llvm-svn: 128810
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp18
-rw-r--r--llvm/lib/Transforms/IPO/IPConstantPropagation.cpp2
-rw-r--r--llvm/lib/VMCore/Verifier.cpp28
3 files changed, 5 insertions, 43 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index 6c555a3e9d1..358d1b35b66 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/lib/Target/CBackend/CBackend.cpp
@@ -2440,24 +2440,6 @@ void CWriter::visitReturnInst(ReturnInst &I) {
return;
}
- if (I.getNumOperands() > 1) {
- Out << " {\n";
- Out << " ";
- printType(Out, I.getParent()->getParent()->getReturnType());
- Out << " llvm_cbe_mrv_temp = {\n";
- for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
- Out << " ";
- writeOperand(I.getOperand(i));
- if (i != e - 1)
- Out << ",";
- Out << "\n";
- }
- Out << " };\n";
- Out << " return llvm_cbe_mrv_temp;\n";
- Out << " }\n";
- return;
- }
-
Out << " return";
if (I.getNumOperands()) {
Out << ' ';
diff --git a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
index c7c293987a5..25c01346642 100644
--- a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -186,7 +186,7 @@ bool IPCP::PropagateConstantReturn(Function &F) {
// Find the returned value
Value *V;
if (!STy)
- V = RI->getOperand(i);
+ V = RI->getOperand(0);
else
V = FindInsertedValue(RI->getOperand(0), i);
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 58ec6fe88d3..1143151b01d 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -826,30 +826,10 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
Assert2(N == 0,
"Found return instr that returns non-void in Function of void "
"return type!", &RI, F->getReturnType());
- else if (N == 1 && F->getReturnType() == RI.getOperand(0)->getType()) {
- // Exactly one return value and it matches the return type. Good.
- } else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
- // The return type is a struct; check for multiple return values.
- Assert2(STy->getNumElements() == N,
- "Incorrect number of return values in ret instruction!",
- &RI, F->getReturnType());
- for (unsigned i = 0; i != N; ++i)
- Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
- "Function return type does not match operand "
- "type of return inst!", &RI, F->getReturnType());
- } else if (const ArrayType *ATy = dyn_cast<ArrayType>(F->getReturnType())) {
- // The return type is an array; check for multiple return values.
- Assert2(ATy->getNumElements() == N,
- "Incorrect number of return values in ret instruction!",
- &RI, F->getReturnType());
- for (unsigned i = 0; i != N; ++i)
- Assert2(ATy->getElementType() == RI.getOperand(i)->getType(),
- "Function return type does not match operand "
- "type of return inst!", &RI, F->getReturnType());
- } else {
- CheckFailed("Function return type does not match operand "
- "type of return inst!", &RI, F->getReturnType());
- }
+ else
+ Assert2(N == 1 && F->getReturnType() == RI.getOperand(0)->getType(),
+ "Function return type does not match operand "
+ "type of return inst!", &RI, F->getReturnType());
// Check to make sure that the return value has necessary properties for
// terminators...
OpenPOWER on IntegriCloud