[llvm-commits] [llvm] r52002 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/Assembler/AggregrateReturn.ll
Dan Gohman
gohman at apple.com
Thu Jun 5 16:44:12 PDT 2008
Hi Matthijs,
This conflicts with the existing multiple-return-value syntax, and
along with it the llvm-gcc-4.2 build. I'm getting this error:
Function return type does not match operand type of return inst!
ret double %mrv
{ double }Broken module found, compilation aborted!
while building _mulsc3.o. Here's a reduced testcase:
define { i32 } @foo() {
ret i32 0
}
It's surprising that llvm-gcc is using { double } here instead
of just plain double, and possibly a minor bug. I'm going to
revert 52002 at least until the llvm-gcc issue is figured out.
We'll probably also need to figure out an upgrade path for
LLVM 2.3 multiple-return-value code. I haven't thought much
about whether it's best to do a full transition all at once, or
to support both aggregate returns and multiple-return-values
at the same time for some time.
Dan
On Thu, 2008-06-05 at 14:00 +0000, Matthijs Kooijman wrote:
> Author: matthijs
> Date: Thu Jun 5 09:00:36 2008
> New Revision: 52002
>
> URL: http://llvm.org/viewvc/llvm-project?rev=52002&view=rev
> Log:
> Change the Verifier to support returning first class aggregrates.
>
> Add a testcase for functions returning first class aggregrates.
>
> Added:
> llvm/trunk/test/Assembler/AggregrateReturn.ll
> Modified:
> llvm/trunk/lib/VMCore/Verifier.cpp
>
> Modified: llvm/trunk/lib/VMCore/Verifier.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=52002&r1=52001&r2=52002&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Verifier.cpp (original)
> +++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Jun 5 09:00:36 2008
> @@ -594,7 +594,10 @@
> Assert2(N == 0,
> "Found return instr that returns void in Function of non-void "
> "return type!", &RI, F->getReturnType());
> - else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
> + else if (N > 1) {
> + const StructType *STy = dyn_cast<StructType>(F->getReturnType());
> + Assert2(STy, "Return instr with multiple values, but return type is not "
> + "a struct", &RI, F->getReturnType());
> Assert2(STy->getNumElements() == N,
> "Incorrect number of return values in ret instruction!",
> &RI, F->getReturnType());
>
> Added: llvm/trunk/test/Assembler/AggregrateReturn.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/AggregrateReturn.ll?rev=52002&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Assembler/AggregrateReturn.ll (added)
> +++ llvm/trunk/test/Assembler/AggregrateReturn.ll Thu Jun 5 09:00:36 2008
> @@ -0,0 +1,22 @@
> +; RUN: llvm-as < %s | llvm-dis
> +
> +define { i32, i32 } @foo() {
> + %res = insertvalue { i32, i32 } undef, i32 0, 0
> + %res2 = insertvalue { i32, i32 } %res, i32 1, 1
> + ret { i32, i32 } %res2
> +}
> +
> +define [ 2 x i32 ] @bar() {
> + %res = insertvalue [ 2 x i32 ] undef, i32 0, 0
> + %res2 = insertvalue [ 2 x i32 ] %res, i32 1, 1
> + ret [ 2 x i32 ] %res2
> +}
> +
> +define i32 @main() {
> + %a = call { i32, i32 }()* @foo ()
> + %b = call [ 2 x i32 ]()* @bar ()
> + %a.0 = extractvalue { i32, i32 } %a, 0
> + %b.1 = extractvalue [ 2 x i32 ] %b, 1
> + %r = add i32 %a.0, %b.1
> + ret i32 %r
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list