From 424545e9509318e56be88021babec26cbfab8cc8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 17 Jun 2011 06:57:15 +0000 Subject: [PATCH] remove asmparser support for the old getresult instruction, which has been subsumed by extractvalue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133247 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLLexer.cpp | 1 - lib/AsmParser/LLParser.cpp | 20 ------------------- lib/AsmParser/LLParser.h | 1 - lib/AsmParser/LLToken.h | 2 +- .../CBackend/2008-05-21-MRV-InlineAsm.ll | 19 ------------------ test/CodeGen/Generic/getresult-undef.ll | 6 ------ ...e-return-values-cross-block-with-invoke.ll | 4 ++-- test/CodeGen/X86/fp-stack-2results.ll | 12 +++++------ test/CodeGen/X86/inline-asm-mrv.ll | 10 +++++----- .../X86/multiple-return-values-cross-block.ll | 4 ++-- test/Transforms/JumpThreading/crash.ll | 2 +- test/Transforms/LoopRotate/crash.ll | 2 +- .../SCCP/2008-04-22-multiple-ret-sccp.ll | 2 +- 13 files changed, 19 insertions(+), 66 deletions(-) delete mode 100644 test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll delete mode 100644 test/CodeGen/Generic/getresult-undef.ll diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 3350a45678e..3c63106e8c3 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -635,7 +635,6 @@ lltok::Kind LLLexer::LexIdentifier() { INSTKEYWORD(extractelement, ExtractElement); INSTKEYWORD(insertelement, InsertElement); INSTKEYWORD(shufflevector, ShuffleVector); - INSTKEYWORD(getresult, ExtractValue); INSTKEYWORD(extractvalue, ExtractValue); INSTKEYWORD(insertvalue, InsertValue); #undef INSTKEYWORD diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 024d013b814..ab3b86e018d 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -3024,7 +3024,6 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB, return ParseStore(Inst, PFS, true); else return TokError("expected 'load' or 'store'"); - case lltok::kw_getresult: return ParseGetResult(Inst, PFS); case lltok::kw_getelementptr: return ParseGetElementPtr(Inst, PFS); case lltok::kw_extractvalue: return ParseExtractValue(Inst, PFS); case lltok::kw_insertvalue: return ParseInsertValue(Inst, PFS); @@ -3717,25 +3716,6 @@ int LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS, return AteExtraComma ? InstExtraComma : InstNormal; } -/// ParseGetResult -/// ::= 'getresult' TypeAndValue ',' i32 -/// FIXME: Remove support for getresult in LLVM 3.0 -bool LLParser::ParseGetResult(Instruction *&Inst, PerFunctionState &PFS) { - Value *Val; LocTy ValLoc, EltLoc; - unsigned Element; - if (ParseTypeAndValue(Val, ValLoc, PFS) || - ParseToken(lltok::comma, "expected ',' after getresult operand") || - ParseUInt32(Element, EltLoc)) - return true; - - if (!Val->getType()->isStructTy() && !Val->getType()->isArrayTy()) - return Error(ValLoc, "getresult inst requires an aggregate operand"); - if (!ExtractValueInst::getIndexedType(Val->getType(), Element)) - return Error(EltLoc, "invalid getresult index for value"); - Inst = ExtractValueInst::Create(Val, Element); - return false; -} - /// ParseGetElementPtr /// ::= 'getelementptr' 'inbounds'? TypeAndValue (',' TypeAndValue)* int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) { diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index ddc03f7ebc1..c486799f292 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -361,7 +361,6 @@ namespace llvm { int ParseAlloc(Instruction *&I, PerFunctionState &PFS); int ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile); int ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile); - bool ParseGetResult(Instruction *&I, PerFunctionState &PFS); int ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS); int ParseExtractValue(Instruction *&I, PerFunctionState &PFS); int ParseInsertValue(Instruction *&I, PerFunctionState &PFS); diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index cfa867b79f3..a5f89fcce0c 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -123,7 +123,7 @@ namespace lltok { kw_alloca, kw_load, kw_store, kw_getelementptr, - kw_extractelement, kw_insertelement, kw_shufflevector, kw_getresult, + kw_extractelement, kw_insertelement, kw_shufflevector, kw_extractvalue, kw_insertvalue, kw_blockaddress, // Unsigned Valued tokens (UIntVal). diff --git a/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll b/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll deleted file mode 100644 index 8db3167e54d..00000000000 --- a/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll +++ /dev/null @@ -1,19 +0,0 @@ -; RUN: llc < %s -march=c - -declare {i32, i32} @foo() - -define i32 @test() { - %A = call {i32, i32} @foo() - %B = getresult {i32, i32} %A, 0 - %C = getresult {i32, i32} %A, 1 - %D = add i32 %B, %C - ret i32 %D -} - -define i32 @test2() { - %A = call {i32, i32} asm sideeffect "...", "={cx},={di},~{dirflag},~{fpsr},~{flags},~{memory}"() - %B = getresult {i32, i32} %A, 0 - %C = getresult {i32, i32} %A, 1 - %D = add i32 %B, %C - ret i32 %D -} diff --git a/test/CodeGen/Generic/getresult-undef.ll b/test/CodeGen/Generic/getresult-undef.ll deleted file mode 100644 index c675535335a..00000000000 --- a/test/CodeGen/Generic/getresult-undef.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: llc < %s - -define double @foo() { - %t = getresult {double, double} undef, 1 - ret double %t -} diff --git a/test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll b/test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll index 282e973ff9a..a3cab5d2e45 100644 --- a/test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll +++ b/test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll @@ -6,9 +6,9 @@ define void @foo(i64* %p, double* %q) nounwind { %t = invoke { i64, double } @wild() to label %normal unwind label %handler normal: - %mrv_gr = getresult { i64, double } %t, 0 + %mrv_gr = extractvalue { i64, double } %t, 0 store i64 %mrv_gr, i64* %p - %mrv_gr12681 = getresult { i64, double } %t, 1 + %mrv_gr12681 = extractvalue { i64, double } %t, 1 store double %mrv_gr12681, double* %q ret void diff --git a/test/CodeGen/X86/fp-stack-2results.ll b/test/CodeGen/X86/fp-stack-2results.ll index bb86cd38339..e986e36e16d 100644 --- a/test/CodeGen/X86/fp-stack-2results.ll +++ b/test/CodeGen/X86/fp-stack-2results.ll @@ -28,10 +28,10 @@ define {x86_fp80, x86_fp80} @test2() { ; Uses both values. define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) { %a = call {x86_fp80,x86_fp80} @test() - %b = getresult {x86_fp80,x86_fp80} %a, 0 + %b = extractvalue {x86_fp80,x86_fp80} %a, 0 store x86_fp80 %b, x86_fp80* %P1 - %c = getresult {x86_fp80,x86_fp80} %a, 1 + %c = extractvalue {x86_fp80,x86_fp80} %a, 1 store x86_fp80 %c, x86_fp80* %P2 ret void } @@ -39,10 +39,10 @@ define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) { ; Uses both values, requires fxch define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) { %a = call {x86_fp80,x86_fp80} @test() - %b = getresult {x86_fp80,x86_fp80} %a, 1 + %b = extractvalue {x86_fp80,x86_fp80} %a, 1 store x86_fp80 %b, x86_fp80* %P1 - %c = getresult {x86_fp80,x86_fp80} %a, 0 + %c = extractvalue {x86_fp80,x86_fp80} %a, 0 store x86_fp80 %c, x86_fp80* %P2 ret void } @@ -50,7 +50,7 @@ define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) { ; Uses ST(0), ST(1) is dead but must be popped. define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) { %a = call {x86_fp80,x86_fp80} @test() - %b = getresult {x86_fp80,x86_fp80} %a, 0 + %b = extractvalue {x86_fp80,x86_fp80} %a, 0 store x86_fp80 %b, x86_fp80* %P1 ret void } @@ -59,7 +59,7 @@ define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) { define void @call4(x86_fp80 *%P1, x86_fp80 *%P2) { %a = call {x86_fp80,x86_fp80} @test() - %c = getresult {x86_fp80,x86_fp80} %a, 1 + %c = extractvalue {x86_fp80,x86_fp80} %a, 1 store x86_fp80 %c, x86_fp80* %P2 ret void } diff --git a/test/CodeGen/X86/inline-asm-mrv.ll b/test/CodeGen/X86/inline-asm-mrv.ll index 78d7e776cf2..733205d6a91 100644 --- a/test/CodeGen/X86/inline-asm-mrv.ll +++ b/test/CodeGen/X86/inline-asm-mrv.ll @@ -11,7 +11,7 @@ define i32 @test1(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind { %tmp12 = sext i32 %stride to i64 ; [#uses=1] %mrv = call {i32, i8*, i8*} asm sideeffect "$0 $1 $2 $3 $4 $5 $6", "=r,=r,=r,r,r,r,r"( i64 %tmp12, i32 %h, i8* %blk1, i8* %blk2 ) nounwind - %tmp6 = getresult {i32, i8*, i8*} %mrv, 0 + %tmp6 = extractvalue {i32, i8*, i8*} %mrv, 0 %tmp7 = call i32 asm sideeffect "set $0", "=r,~{dirflag},~{fpsr},~{flags}"( ) nounwind ret i32 %tmp7 @@ -19,16 +19,16 @@ define i32 @test1(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind { define <4 x float> @test2() nounwind { %mrv = call {<4 x float>, <4 x float>} asm "set $0, $1", "=x,=x"() - %a = getresult {<4 x float>, <4 x float>} %mrv, 0 - %b = getresult {<4 x float>, <4 x float>} %mrv, 1 + %a = extractvalue {<4 x float>, <4 x float>} %mrv, 0 + %b = extractvalue {<4 x float>, <4 x float>} %mrv, 1 %c = fadd <4 x float> %a, %b ret <4 x float> %c } define <4 x i32> @test3() nounwind { %mrv = call {<4 x i32>, <4 x i32>} asm "set $0, $1", "=x,=x"() - %a = getresult {<4 x i32>, <4 x i32>} %mrv, 0 - %b = getresult {<4 x i32>, <4 x i32>} %mrv, 1 + %a = extractvalue {<4 x i32>, <4 x i32>} %mrv, 0 + %b = extractvalue {<4 x i32>, <4 x i32>} %mrv, 1 %c = add <4 x i32> %a, %b ret <4 x i32> %c } diff --git a/test/CodeGen/X86/multiple-return-values-cross-block.ll b/test/CodeGen/X86/multiple-return-values-cross-block.ll index e9837d0ebbf..b0cb0611134 100644 --- a/test/CodeGen/X86/multiple-return-values-cross-block.ll +++ b/test/CodeGen/X86/multiple-return-values-cross-block.ll @@ -4,12 +4,12 @@ declare {x86_fp80, x86_fp80} @test() define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) { %a = call {x86_fp80,x86_fp80} @test() - %b = getresult {x86_fp80,x86_fp80} %a, 1 + %b = extractvalue {x86_fp80,x86_fp80} %a, 1 store x86_fp80 %b, x86_fp80* %P1 br label %L L: - %c = getresult {x86_fp80,x86_fp80} %a, 0 + %c = extractvalue {x86_fp80,x86_fp80} %a, 0 store x86_fp80 %c, x86_fp80* %P2 ret void } diff --git a/test/Transforms/JumpThreading/crash.ll b/test/Transforms/JumpThreading/crash.ll index aed51a1c9ee..2115dd38400 100644 --- a/test/Transforms/JumpThreading/crash.ll +++ b/test/Transforms/JumpThreading/crash.ll @@ -18,7 +18,7 @@ bb13: ; preds = %bb br label %bb bb110: ; preds = %bb - %mrv_gr124 = getresult %struct.system__secondary_stack__mark_id %tmp120, 1 ; [#uses=0] + %mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; [#uses=0] unreachable } diff --git a/test/Transforms/LoopRotate/crash.ll b/test/Transforms/LoopRotate/crash.ll index 16a6868f8ff..954b8347655 100644 --- a/test/Transforms/LoopRotate/crash.ll +++ b/test/Transforms/LoopRotate/crash.ll @@ -113,7 +113,7 @@ bb116: ; preds = %bb131, %entry br i1 false, label %bb141, label %bb131 bb131: ; preds = %bb116 - %mrv_gr125 = getresult %struct.NSRange %tmp123, 1 ; [#uses=0] + %mrv_gr125 = extractvalue %struct.NSRange %tmp123, 1 ; [#uses=0] br label %bb116 bb141: ; preds = %bb116 diff --git a/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll b/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll index 1b26ca9e194..a40455cf5d0 100644 --- a/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll +++ b/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll @@ -5,7 +5,7 @@ declare {i32, i32} @bar(i32 %A) define i32 @foo() { %X = call {i32, i32} @bar(i32 17) - %Y = getresult {i32, i32} %X, 0 + %Y = extractvalue {i32, i32} %X, 0 %Z = add i32 %Y, %Y ret i32 %Z }