[llvm] r222720 - Add an interesting test that we already get right. NFC.

Sean Silva chisophugis at gmail.com
Mon Nov 24 21:43:24 PST 2014


Got it.

Thanks!

-- Sean Silva

On Mon, Nov 24, 2014 at 9:33 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 24 November 2014 at 23:57, Sean Silva <chisophugis at gmail.com> wrote:
> > What is the meaning of "unrelated" in this context?
>
> The linker has not seen two values it wants to link where each has one
> of those types. That only happens when it gets to
>
> define %t @g() {
>  %x = call %t @f()
>  ret %t %x
> }
>
> Where it becomes clear that it is advantageous for @g and @f to return
> the same type.
>
> > -- Sean Silva
> >
> > On Mon, Nov 24, 2014 at 7:47 PM, Rafael Espindola
> > <rafael.espindola at gmail.com> wrote:
> >>
> >> Author: rafael
> >> Date: Mon Nov 24 21:47:57 2014
> >> New Revision: 222720
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=222720&view=rev
> >> Log:
> >> Add an interesting test that we already get right. NFC.
> >>
> >> Added:
> >>     llvm/trunk/test/Linker/Inputs/type-unique-unrelated2.ll
> >>     llvm/trunk/test/Linker/Inputs/type-unique-unrelated3.ll
> >>     llvm/trunk/test/Linker/type-unique-unrelated.ll
> >>
> >> Added: llvm/trunk/test/Linker/Inputs/type-unique-unrelated2.ll
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/type-unique-unrelated2.ll?rev=222720&view=auto
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/test/Linker/Inputs/type-unique-unrelated2.ll (added)
> >> +++ llvm/trunk/test/Linker/Inputs/type-unique-unrelated2.ll Mon Nov 24
> >> 21:47:57 2014
> >> @@ -0,0 +1,7 @@
> >> +%t = type { i8* }
> >> +declare %t @g()
> >> +
> >> +define %t @g2() {
> >> + %x = call %t @g()
> >> + ret %t %x
> >> +}
> >>
> >> Added: llvm/trunk/test/Linker/Inputs/type-unique-unrelated3.ll
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/type-unique-unrelated3.ll?rev=222720&view=auto
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/test/Linker/Inputs/type-unique-unrelated3.ll (added)
> >> +++ llvm/trunk/test/Linker/Inputs/type-unique-unrelated3.ll Mon Nov 24
> >> 21:47:57 2014
> >> @@ -0,0 +1,7 @@
> >> +%t = type { i8* }
> >> +declare %t @f()
> >> +
> >> +define %t @g() {
> >> + %x = call %t @f()
> >> + ret %t %x
> >> +}
> >>
> >> Added: llvm/trunk/test/Linker/type-unique-unrelated.ll
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/type-unique-unrelated.ll?rev=222720&view=auto
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/test/Linker/type-unique-unrelated.ll (added)
> >> +++ llvm/trunk/test/Linker/type-unique-unrelated.ll Mon Nov 24 21:47:57
> >> 2014
> >> @@ -0,0 +1,31 @@
> >> +; RUN: llvm-link -S %s %p/Inputs/type-unique-unrelated2.ll
> >> %p/Inputs/type-unique-unrelated3.ll | FileCheck %s
> >> +
> >> +; CHECK: %t = type { i8* }
> >> +
> >> +; CHECK: define %t @f2() {
> >> +; CHECK-NEXT:   %x = call %t @f2()
> >> +; CHECK-NEXT:   ret %t %x
> >> +; CHECK-NEXT: }
> >> +
> >> +; CHECK: define %t @g2() {
> >> +; CHECK-NEXT:   %x = call %t @g()
> >> +; CHECK-NEXT:   ret %t %x
> >> +; CHECK-NEXT: }
> >> +
> >> +; CHECK: define %t @g() {
> >> +; CHECK-NEXT:  %x = call %t @f()
> >> +; CHECK-NEXT:  ret %t %x
> >> +; CHECK-NEXT: }
> >> +
> >> +; The idea of this test is that the %t in this file and the one in
> >> +; type-unique-unrelated2.ll look unrelated until
> >> type-unique-unrelated3.ll
> >> +; is merged in.
> >> +
> >> +%t = type { i8* }
> >> +declare %t @f()
> >> +
> >> +define %t @f2() {
> >> + %x = call %t @f2()
> >> + ret %t %x
> >> +}
> >> +
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141124/ce403a80/attachment.html>


More information about the llvm-commits mailing list