mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-30 07:14:53 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc5d992bc1
commit
3e2f74e6d6
@ -2440,24 +2440,6 @@ void CWriter::visitReturnInst(ReturnInst &I) {
|
|||||||
return;
|
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";
|
Out << " return";
|
||||||
if (I.getNumOperands()) {
|
if (I.getNumOperands()) {
|
||||||
Out << ' ';
|
Out << ' ';
|
||||||
|
@ -186,7 +186,7 @@ bool IPCP::PropagateConstantReturn(Function &F) {
|
|||||||
// Find the returned value
|
// Find the returned value
|
||||||
Value *V;
|
Value *V;
|
||||||
if (!STy)
|
if (!STy)
|
||||||
V = RI->getOperand(i);
|
V = RI->getOperand(0);
|
||||||
else
|
else
|
||||||
V = FindInsertedValue(RI->getOperand(0), i);
|
V = FindInsertedValue(RI->getOperand(0), i);
|
||||||
|
|
||||||
|
@ -826,30 +826,10 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
|
|||||||
Assert2(N == 0,
|
Assert2(N == 0,
|
||||||
"Found return instr that returns non-void in Function of void "
|
"Found return instr that returns non-void in Function of void "
|
||||||
"return type!", &RI, F->getReturnType());
|
"return type!", &RI, F->getReturnType());
|
||||||
else if (N == 1 && F->getReturnType() == RI.getOperand(0)->getType()) {
|
else
|
||||||
// Exactly one return value and it matches the return type. Good.
|
Assert2(N == 1 && F->getReturnType() == RI.getOperand(0)->getType(),
|
||||||
} else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
|
"Function return type does not match operand "
|
||||||
// The return type is a struct; check for multiple return values.
|
"type of return inst!", &RI, F->getReturnType());
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check to make sure that the return value has necessary properties for
|
// Check to make sure that the return value has necessary properties for
|
||||||
// terminators...
|
// terminators...
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
; RUN: llvm-as < %s | llvm-dis
|
; RUN: llvm-as < %s | llvm-dis
|
||||||
|
|
||||||
define { i32 } @fooa() nounwind {
|
|
||||||
ret i32 0
|
|
||||||
}
|
|
||||||
define { i32 } @foob() nounwind {
|
define { i32 } @foob() nounwind {
|
||||||
ret {i32}{ i32 0 }
|
ret {i32}{ i32 0 }
|
||||||
}
|
}
|
||||||
define [1 x i32] @fooc() nounwind {
|
|
||||||
ret i32 0
|
|
||||||
}
|
|
||||||
define [1 x i32] @food() nounwind {
|
define [1 x i32] @food() nounwind {
|
||||||
ret [1 x i32][ i32 0 ]
|
ret [1 x i32][ i32 0 ]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user