remove parser support for the obsolete "multiple return values" syntax, which

was replaced with return of a "first class aggregate".

llvm-svn: 133245
This commit is contained in:
Chris Lattner 2011-06-17 06:49:41 +00:00
parent 4649a73cc3
commit 33de427cd6
13 changed files with 42 additions and 340 deletions

View File

@ -3079,9 +3079,7 @@ bool LLParser::ParseCmpPredicate(unsigned &P, unsigned Opc) {
/// ParseRet - Parse a return instruction.
/// ::= 'ret' void (',' !dbg, !1)*
/// ::= 'ret' TypeAndValue (',' !dbg, !1)*
/// ::= 'ret' TypeAndValue (',' TypeAndValue)+ (',' !dbg, !1)*
/// [[obsolete: LLVM 3.0]]
int LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
PerFunctionState &PFS) {
PATypeHolder Ty(Type::getVoidTy(Context));
if (ParseType(Ty, true /*void allowed*/)) return true;
@ -3094,38 +3092,8 @@ int LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
Value *RV;
if (ParseValue(Ty, RV, PFS)) return true;
bool ExtraComma = false;
if (EatIfPresent(lltok::comma)) {
// Parse optional custom metadata, e.g. !dbg
if (Lex.getKind() == lltok::MetadataVar) {
ExtraComma = true;
} else {
// The normal case is one return value.
// FIXME: LLVM 3.0 remove MRV support for 'ret i32 1, i32 2', requiring
// use of 'ret {i32,i32} {i32 1, i32 2}'
SmallVector<Value*, 8> RVs;
RVs.push_back(RV);
do {
// If optional custom metadata, e.g. !dbg is seen then this is the
// end of MRV.
if (Lex.getKind() == lltok::MetadataVar)
break;
if (ParseTypeAndValue(RV, PFS)) return true;
RVs.push_back(RV);
} while (EatIfPresent(lltok::comma));
RV = UndefValue::get(PFS.getFunction().getReturnType());
for (unsigned i = 0, e = RVs.size(); i != e; ++i) {
Instruction *I = InsertValueInst::Create(RV, RVs[i], i, "mrv");
BB->getInstList().push_back(I);
RV = I;
}
}
}
Inst = ReturnInst::Create(Context, RV);
return ExtraComma ? InstExtraComma : InstNormal;
return false;
}

View File

@ -340,7 +340,7 @@ namespace llvm {
PerFunctionState &PFS);
bool ParseCmpPredicate(unsigned &Pred, unsigned Opc);
int ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
bool ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
bool ParseBr(Instruction *&Inst, PerFunctionState &PFS);
bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);

View File

@ -1,22 +0,0 @@
; RUN: opt < %s -verify -S | llvm-as -disable-output
define {i32, i8} @foo(i32 %p) {
ret i32 1, i8 2
}
define i8 @f2(i32 %p) {
%c = call {i32, i8} @foo(i32 %p)
%d = getresult {i32, i8} %c, 1
%e = add i8 %d, 1
ret i8 %e
}
define i32 @f3(i32 %p) {
%c = invoke {i32, i8} @foo(i32 %p)
to label %L unwind label %L2
L:
%d = getresult {i32, i8} %c, 0
ret i32 %d
L2:
ret i32 0
}

View File

@ -1,17 +0,0 @@
; RUN: llc < %s -march=ppc32
; RUN: llc < %s -march=ppc64
define {i64, float} @bar(i64 %a, float %b) {
%y = add i64 %a, 7
%z = fadd float %b, 7.0
ret i64 %y, float %z
}
define i64 @foo() {
%M = call {i64, float} @bar(i64 21, float 21.0)
%N = getresult {i64, float} %M, 0
%O = getresult {i64, float} %M, 1
%P = fptosi float %O to i64
%Q = add i64 %P, %N
ret i64 %Q
}

View File

@ -1,12 +1,16 @@
; RUN: llc < %s -march=x86 | grep fldz
; RUN: llc < %s -march=x86-64 | grep fld1
%0 = type { x86_fp80, x86_fp80 }
; This is basically this code on x86-64:
; _Complex long double test() { return 1.0; }
define {x86_fp80, x86_fp80} @test() {
%A = fpext double 1.0 to x86_fp80
%B = fpext double 0.0 to x86_fp80
ret x86_fp80 %A, x86_fp80 %B
%mrv = insertvalue %0 undef, x86_fp80 %A, 0
%mrv1 = insertvalue %0 %mrv, x86_fp80 %B, 1
ret %0 %mrv1
}
@ -16,7 +20,9 @@ define {x86_fp80, x86_fp80} @test() {
; ret
define {x86_fp80, x86_fp80} @test2() {
%A = fpext double 1.0 to x86_fp80
ret x86_fp80 %A, x86_fp80 %A
%mrv = insertvalue %0 undef, x86_fp80 %A, 0
%mrv1 = insertvalue %0 %mrv, x86_fp80 %A, 1
ret %0 %mrv1
}
; Uses both values.

View File

@ -1,16 +0,0 @@
; RUN: llc < %s -march=x86
define {i64, float} @bar(i64 %a, float %b) {
%y = add i64 %a, 7
%z = fadd float %b, 7.0
ret i64 %y, float %z
}
define i64 @foo() {
%M = call {i64, float} @bar(i64 21, float 21.0)
%N = getresult {i64, float} %M, 0
%O = getresult {i64, float} %M, 1
%P = fptosi float %O to i64
%Q = add i64 %P, %N
ret i64 %Q
}

View File

@ -4,38 +4,43 @@
;; Check that the second return values didn't get propagated
; RUN: cat %t | grep {%N = add i32 %B, %D}
define internal {i32, i32} @foo(i1 %Q) {
br i1 %Q, label %T, label %F
%0 = type { i32, i32 }
T: ; preds = %0
ret i32 21, i32 22
define internal %0 @foo(i1 %Q) {
br i1 %Q, label %T, label %F
F: ; preds = %0
ret i32 21, i32 23
T: ; preds = %0
%mrv = insertvalue %0 undef, i32 21, 0
%mrv1 = insertvalue %0 %mrv, i32 22, 1
ret %0 %mrv1
F: ; preds = %0
%mrv2 = insertvalue %0 undef, i32 21, 0
%mrv3 = insertvalue %0 %mrv2, i32 23, 1
ret %0 %mrv3
}
define internal {i32, i32} @bar(i1 %Q) {
%A = insertvalue { i32, i32 } undef, i32 21, 0
br i1 %Q, label %T, label %F
define internal %0 @bar(i1 %Q) {
%A = insertvalue %0 undef, i32 21, 0
br i1 %Q, label %T, label %F
T: ; preds = %0
%B = insertvalue { i32, i32 } %A, i32 22, 1
ret { i32, i32 } %B
T: ; preds = %0
%B = insertvalue %0 %A, i32 22, 1
ret %0 %B
F: ; preds = %0
%C = insertvalue { i32, i32 } %A, i32 23, 1
ret { i32, i32 } %C
F: ; preds = %0
%C = insertvalue %0 %A, i32 23, 1
ret %0 %C
}
define { i32, i32 } @caller(i1 %Q) {
%X = call {i32, i32} @foo( i1 %Q )
%A = getresult {i32, i32} %X, 0
%B = getresult {i32, i32} %X, 1
%Y = call {i32, i32} @bar( i1 %Q )
%C = extractvalue {i32, i32} %Y, 0
%D = extractvalue {i32, i32} %Y, 1
%M = add i32 %A, %C
%N = add i32 %B, %D
ret { i32, i32 } %X
define %0 @caller(i1 %Q) {
%X = call %0 @foo(i1 %Q)
%A = extractvalue %0 %X, 0
%B = extractvalue %0 %X, 1
%Y = call %0 @bar(i1 %Q)
%C = extractvalue %0 %Y, 0
%D = extractvalue %0 %Y, 1
%M = add i32 %A, %C
%N = add i32 %B, %D
ret %0 %X
}

View File

@ -1,28 +0,0 @@
; RUN: opt < %s -inline -disable-output
%struct.Benchmark = type { i32 (...)** }
%struct.Complex = type { double, double }
%struct.ComplexBenchmark = type { %struct.Benchmark }
define %struct.Complex @_Zml7ComplexS_1(double %a.0, double %a.1, double %b.0, double %b.1) nounwind {
entry:
%mrv = alloca %struct.Complex ; <%struct.Complex*> [#uses=2]
%mrv.gep = getelementptr %struct.Complex* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
%mrv.gep1 = getelementptr %struct.Complex* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
ret double %mrv.ld, double %mrv.ld2
}
define void @_ZNK16ComplexBenchmark9oop_styleEv(%struct.ComplexBenchmark* %this) nounwind {
entry:
%tmp = alloca %struct.Complex ; <%struct.Complex*> [#uses=0]
br label %bb31
bb: ; preds = %bb31
call %struct.Complex @_Zml7ComplexS_1( double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Complex>:0 [#uses=1]
%gr = getresult %struct.Complex %0, 1 ; <double> [#uses=0]
br label %bb31
bb31: ; preds = %bb, %entry
br i1 false, label %bb, label %return
return: ; preds = %bb31
ret void
}

View File

@ -1,53 +0,0 @@
; RUN: opt < %s -inline -disable-output
%struct.Demand = type { double, double }
%struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] }
%struct.leaf = type { %struct.Demand, double, double }
@P = external global double ; <double*> [#uses=1]
define %struct.leaf* @build_leaf() nounwind {
entry:
unreachable
}
define %struct.Demand @Compute_Branch2(%struct.branch* %br, double %theta_R, double %theta_I, double %pi_R, double %pi_I) nounwind {
entry:
%mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4]
%a2 = alloca %struct.Demand ; <%struct.Demand*> [#uses=0]
br i1 false, label %bb46, label %bb
bb: ; preds = %entry
%mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
%mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
ret double %mrv.ld, double %mrv.ld2
bb46: ; preds = %entry
br label %bb72
bb49: ; preds = %bb72
call %struct.Demand @Compute_Leaf1( %struct.leaf* null, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Demand>:0 [#uses=1]
%gr = getresult %struct.Demand %0, 1 ; <double> [#uses=0]
br label %bb72
bb72: ; preds = %bb49, %bb46
br i1 false, label %bb49, label %bb77
bb77: ; preds = %bb72
%mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1]
%mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1]
ret double %mrv.ld4, double %mrv.ld6
}
define %struct.Demand @Compute_Leaf1(%struct.leaf* %l, double %pi_R, double %pi_I) nounwind {
entry:
%mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=2]
%tmp10 = load double* @P, align 8 ; <double> [#uses=1]
%tmp11 = fcmp olt double %tmp10, 0.000000e+00 ; <i1> [#uses=1]
br i1 %tmp11, label %bb, label %bb13
bb: ; preds = %entry
br label %bb13
bb13: ; preds = %bb, %entry
%mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
%mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
ret double %mrv.ld, double %mrv.ld2
}

View File

@ -1,57 +0,0 @@
; RUN: opt < %s -inline -disable-output
%struct.Demand = type { double, double }
%struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] }
%struct.leaf = type { %struct.Demand, double, double }
@P = external global double ; <double*> [#uses=1]
define %struct.leaf* @build_leaf() nounwind {
entry:
unreachable
}
define %struct.Demand @Compute_Branch2(%struct.branch* %br, double %theta_R, double %theta_I, double %pi_R, double %pi_I) nounwind {
entry:
%mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4]
%a2 = alloca %struct.Demand ; <%struct.Demand*> [#uses=0]
br i1 false, label %bb46, label %bb
bb: ; preds = %entry
%mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
%mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
ret double %mrv.ld, double %mrv.ld2
bb46: ; preds = %entry
br label %bb72
bb49: ; preds = %bb72
call %struct.Demand @Compute_Leaf1( %struct.leaf* null, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Demand>:0 [#uses=1]
%gr = getresult %struct.Demand %0, 1 ; <double> [#uses=0]
br label %bb72
bb72: ; preds = %bb49, %bb46
br i1 false, label %bb49, label %bb77
bb77: ; preds = %bb72
%mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1]
%mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1]
ret double %mrv.ld4, double %mrv.ld6
}
define %struct.Demand @Compute_Leaf1(%struct.leaf* %l, double %pi_R, double %pi_I) nounwind {
entry:
%mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4]
%tmp10 = load double* @P, align 8 ; <double> [#uses=1]
%tmp11 = fcmp olt double %tmp10, 0.000000e+00 ; <i1> [#uses=1]
br i1 %tmp11, label %bb, label %bb13
bb: ; preds = %entry
%mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
%mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
ret double %mrv.ld, double %mrv.ld2
bb13: ; preds = %entry
%mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
%mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1]
%mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
%mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1]
ret double %mrv.ld4, double %mrv.ld6
}

View File

@ -1,11 +0,0 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
; PR9218
%vec2x2 = type { <2 x double>, <2 x double> }
define %vec2x2 @split(double) nounwind alwaysinline {
; CHECK: @split
; CHECK: ret %vec2x2 undef
%vba = insertelement <2 x double> undef, double %0, i32 2
ret <2 x double> %vba, <2 x double> %vba
}

View File

@ -1,43 +0,0 @@
; RUN: opt < %s -simplifycfg -disable-output
; rdar://5882392
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin9"
%struct.Py_complex = type { double, double }
define %struct.Py_complex @_Py_c_pow(double %a.0, double %a.1, double %b.0, double %b.1) nounwind {
entry:
%tmp7 = fcmp une double %b.0, 0.000000e+00 ; <i1> [#uses=1]
%tmp11 = fcmp une double %b.1, 0.000000e+00 ; <i1> [#uses=1]
%bothcond = or i1 %tmp7, %tmp11 ; <i1> [#uses=1]
br i1 %bothcond, label %bb15, label %bb53
bb15: ; preds = %entry
%tmp18 = fcmp une double %a.0, 0.000000e+00 ; <i1> [#uses=1]
%tmp24 = fcmp une double %a.1, 0.000000e+00 ; <i1> [#uses=1]
%bothcond1 = or i1 %tmp18, %tmp24 ; <i1> [#uses=1]
br i1 %bothcond1, label %bb29, label %bb27
bb27: ; preds = %bb15
%tmp28 = call i32* @__error( ) nounwind ; <i32*> [#uses=1]
store i32 33, i32* %tmp28, align 4
ret double undef, double undef
bb29: ; preds = %bb15
%tmp36 = fcmp une double %b.1, 0.000000e+00 ; <i1> [#uses=1]
br i1 %tmp36, label %bb39, label %bb47
bb39: ; preds = %bb29
br label %bb47
bb47: ; preds = %bb39, %bb29
ret double undef, double undef
bb53: ; preds = %entry
ret double undef, double undef
}
declare i32* @__error()
declare double @pow(double, double) nounwind readonly
declare double @cos(double) nounwind readonly

View File

@ -1,30 +0,0 @@
; RUN: opt < %s -simplifycfg -disable-output
; PR2256
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-pc-mingw32"
define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval %Z, i1 %cond) nounwind {
bb: ; preds = %entry
br i1 %cond, label %bb48, label %bb40
bb40: ; preds = %bb
store i32 34, i32* null, align 4
br label %bb196
bb48: ; preds = %bb.bb48_crit_edge, %entry.bb48_crit_edge
%tmp53 = icmp eq i32 0, 1280 ; <i1> [#uses=1]
br i1 %tmp53, label %bb56, label %bb174
bb56: ; preds = %bb48
%iftmp.0.0 = select i1 false, x86_fp80 0xK3FFFC90FDAA22168C235, x86_fp80 0xKBFFFC90FDAA22168C235 ; <x86_fp80> [#uses=0]
br label %bb196
bb174: ; preds = %bb144, %bb114
%tmp191 = fmul x86_fp80 0xK00000000000000000000, 0xK3FFE8000000000000000 ; <x86_fp80> [#uses=1]
br label %bb196
bb196: ; preds = %bb174, %bb56, %bb40
%Res.1.0 = phi x86_fp80 [ 0xK7FFF8000000000000000, %bb40 ], [ %tmp191, %bb174 ], [ 0xK00000000000000000000, %bb56 ] ; <x86_fp80> [#uses=1]
ret x86_fp80 0xK00000000000000000000, x86_fp80 %Res.1.0
}