llvm-6502/test/CodeGen/X86/2010-09-16-asmcrash.ll
Duncan P. N. Exon Smith 1ef70ff39b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00

57 lines
2.1 KiB
LLVM

; RUN: llc < %s -mtriple=x86_64-unknown-freebsd8.1 -o /dev/null
; This formerly crashed, PR 8154.
module asm ".weak sem_close"
module asm ".equ sem_close, _sem_close"
module asm ".weak sem_destroy"
module asm ".equ sem_destroy, _sem_destroy"
module asm ".weak sem_getvalue"
module asm ".equ sem_getvalue, _sem_getvalue"
module asm ".weak sem_init"
module asm ".equ sem_init, _sem_init"
module asm ".weak sem_open"
module asm ".equ sem_open, _sem_open"
module asm ".weak sem_post"
module asm ".equ sem_post, _sem_post"
module asm ".weak sem_timedwait"
module asm ".equ sem_timedwait, _sem_timedwait"
module asm ".weak sem_trywait"
module asm ".equ sem_trywait, _sem_trywait"
module asm ".weak sem_unlink"
module asm ".equ sem_unlink, _sem_unlink"
module asm ".weak sem_wait"
module asm ".equ sem_wait, _sem_wait"
%struct._sem = type { i32, %struct._usem }
%struct._usem = type { i32, i32, i32 }
define void @_sem_timedwait(%struct._sem* noalias %sem) nounwind ssp {
entry:
br i1 undef, label %while.cond.preheader, label %sem_check_validity.exit
while.cond.preheader: ; preds = %entry
%tmp4 = getelementptr inbounds %struct._sem* %sem, i64 0, i32 1, i32 1
br label %while.cond
sem_check_validity.exit: ; preds = %entry
ret void
while.cond: ; preds = %while.body, %while.cond.preheader
br i1 undef, label %while.body, label %while.end
while.body: ; preds = %while.cond
%0 = call i8 asm sideeffect "\09lock ; \09\09\09cmpxchgl $2,$1 ;\09 sete\09$0 ;\09\091:\09\09\09\09# atomic_cmpset_int", "={ax},=*m,r,{ax},*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* %tmp4, i32 undef, i32 undef, i32* %tmp4) nounwind, !srcloc !0
br i1 undef, label %while.cond, label %return
while.end: ; preds = %while.cond
br i1 undef, label %if.end18, label %return
if.end18: ; preds = %while.end
unreachable
return: ; preds = %while.end, %while.body
ret void
}
!0 = !{i32 158484}