1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Transforms/Inline/noalias-cs.ll
Duncan P. N. Exon Smith 9c5542c040 IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly.  These
are the matching assembly changes for the metadata/value split in
r223802.

  - Only use the `metadata` type when referencing metadata from a call
    intrinsic -- i.e., only when it's used as a `Value`.

  - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
    when referencing it from call intrinsics.

So, assembly like this:

    define @foo(i32 %v) {
      call void @llvm.foo(metadata !{i32 %v}, metadata !0)
      call void @llvm.foo(metadata !{i32 7}, metadata !0)
      call void @llvm.foo(metadata !1, metadata !0)
      call void @llvm.foo(metadata !3, metadata !0)
      call void @llvm.foo(metadata !{metadata !3}, metadata !0)
      ret void, !bar !2
    }
    !0 = metadata !{metadata !2}
    !1 = metadata !{i32* @global}
    !2 = metadata !{metadata !3}
    !3 = metadata !{}

turns into this:

    define @foo(i32 %v) {
      call void @llvm.foo(metadata i32 %v, metadata !0)
      call void @llvm.foo(metadata i32 7, metadata !0)
      call void @llvm.foo(metadata i32* @global, metadata !0)
      call void @llvm.foo(metadata !3, metadata !0)
      call void @llvm.foo(metadata !{!3}, metadata !0)
      ret void, !bar !2
    }
    !0 = !{!2}
    !1 = !{i32* @global}
    !2 = !{!3}
    !3 = !{}

I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines).  I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.

This is part of PR21532.

llvm-svn: 224257
2014-12-15 19:07:53 +00:00

85 lines
3.2 KiB
LLVM

; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
entry:
%0 = load float* %c, align 4, !noalias !3
%arrayidx.i = getelementptr inbounds float* %a, i64 5
store float %0, float* %arrayidx.i, align 4, !alias.scope !7, !noalias !8
%arrayidx1.i = getelementptr inbounds float* %b, i64 8
store float %0, float* %arrayidx1.i, align 4, !alias.scope !8, !noalias !7
%1 = load float* %c, align 4
%arrayidx = getelementptr inbounds float* %a, i64 7
store float %1, float* %arrayidx, align 4
ret void
}
define void @foo(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
entry:
call void @foo2(float* %a, float* %b, float* %c), !noalias !0
call void @foo2(float* %b, float* %b, float* %a), !alias.scope !0
ret void
}
; CHECK: define void @foo(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
; CHECK: entry:
; CHECK: %0 = load float* %c, align 4, !noalias !6
; CHECK: %arrayidx.i.i = getelementptr inbounds float* %a, i64 5
; CHECK: store float %0, float* %arrayidx.i.i, align 4, !alias.scope !12, !noalias !13
; CHECK: %arrayidx1.i.i = getelementptr inbounds float* %b, i64 8
; CHECK: store float %0, float* %arrayidx1.i.i, align 4, !alias.scope !14, !noalias !15
; CHECK: %1 = load float* %c, align 4, !noalias !16
; CHECK: %arrayidx.i = getelementptr inbounds float* %a, i64 7
; CHECK: store float %1, float* %arrayidx.i, align 4, !noalias !16
; CHECK: %2 = load float* %a, align 4, !alias.scope !16, !noalias !17
; CHECK: %arrayidx.i.i1 = getelementptr inbounds float* %b, i64 5
; CHECK: store float %2, float* %arrayidx.i.i1, align 4, !alias.scope !21, !noalias !22
; CHECK: %arrayidx1.i.i2 = getelementptr inbounds float* %b, i64 8
; CHECK: store float %2, float* %arrayidx1.i.i2, align 4, !alias.scope !23, !noalias !24
; CHECK: %3 = load float* %a, align 4, !alias.scope !16
; CHECK: %arrayidx.i3 = getelementptr inbounds float* %b, i64 7
; CHECK: store float %3, float* %arrayidx.i3, align 4, !alias.scope !16
; CHECK: ret void
; CHECK: }
attributes #0 = { nounwind uwtable }
!0 = !{!1}
!1 = !{!1, !2, !"hello: %a"}
!2 = !{!2, !"hello"}
!3 = !{!4, !6}
!4 = !{!4, !5, !"hello2: %a"}
!5 = !{!5, !"hello2"}
!6 = !{!6, !5, !"hello2: %b"}
!7 = !{!4}
!8 = !{!6}
; CHECK: !0 = !{!1, !3}
; CHECK: !1 = !{!1, !2, !"hello2: %a"}
; CHECK: !2 = !{!2, !"hello2"}
; CHECK: !3 = !{!3, !2, !"hello2: %b"}
; CHECK: !4 = !{!1}
; CHECK: !5 = !{!3}
; CHECK: !6 = !{!7, !9, !10}
; CHECK: !7 = !{!7, !8, !"hello2: %a"}
; CHECK: !8 = !{!8, !"hello2"}
; CHECK: !9 = !{!9, !8, !"hello2: %b"}
; CHECK: !10 = !{!10, !11, !"hello: %a"}
; CHECK: !11 = !{!11, !"hello"}
; CHECK: !12 = !{!7}
; CHECK: !13 = !{!9, !10}
; CHECK: !14 = !{!9}
; CHECK: !15 = !{!7, !10}
; CHECK: !16 = !{!10}
; CHECK: !17 = !{!18, !20}
; CHECK: !18 = !{!18, !19, !"hello2: %a"}
; CHECK: !19 = !{!19, !"hello2"}
; CHECK: !20 = !{!20, !19, !"hello2: %b"}
; CHECK: !21 = !{!18, !10}
; CHECK: !22 = !{!20}
; CHECK: !23 = !{!20, !10}
; CHECK: !24 = !{!18}