mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	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
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			LLVM
		
	
	
	
	
	
| ; RUN: opt -S -tbaa -basicaa -gvn < %s | FileCheck -check-prefix=BASICAA %s
 | |
| ; RUN: opt -S -tbaa -gvn < %s | FileCheck %s
 | |
| ; rdar://8875631, rdar://8875069
 | |
| 
 | |
| ; BasicAA should notice that the store stores to the entire %u object,
 | |
| ; so the %tmp5 load is PartialAlias with the store and suppress TBAA.
 | |
| ; Without BasicAA, TBAA should say that %tmp5 is NoAlias with the store.
 | |
| 
 | |
| target datalayout = "e-p:64:64:64"
 | |
| 
 | |
| %union.anon = type { double }
 | |
| 
 | |
| @u = global %union.anon { double -2.500000e-01 }, align 8
 | |
| @endianness_test = global i64 1, align 8
 | |
| 
 | |
| define i32 @signbit(double %x) nounwind {
 | |
| ; BASICAA: ret i32 %tmp5.lobit
 | |
| ; CHECK:   ret i32 0
 | |
| entry:
 | |
|   %u = alloca %union.anon, align 8
 | |
|   %tmp9 = getelementptr inbounds %union.anon* %u, i64 0, i32 0
 | |
|   store double %x, double* %tmp9, align 8, !tbaa !0
 | |
|   %tmp2 = load i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3
 | |
|   %idxprom = sext i32 %tmp2 to i64
 | |
|   %tmp4 = bitcast %union.anon* %u to [2 x i32]*
 | |
|   %arrayidx = getelementptr inbounds [2 x i32]* %tmp4, i64 0, i64 %idxprom
 | |
|   %tmp5 = load i32* %arrayidx, align 4, !tbaa !3
 | |
|   %tmp5.lobit = lshr i32 %tmp5, 31
 | |
|   ret i32 %tmp5.lobit
 | |
| }
 | |
| 
 | |
| !0 = !{!4, !4, i64 0}
 | |
| !1 = !{!"omnipotent char", !2}
 | |
| !2 = !{!"Simple C/C++ TBAA", null}
 | |
| !3 = !{!5, !5, i64 0}
 | |
| !4 = !{!"double", !1}
 | |
| !5 = !{!"int", !1}
 |