1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Bitcode/upgrade-masked-keep-metadata.ll
Krzysztof Parzyszek ac7c6e9962 Preserve metadata on masked intrinsics in auto-upgrade
When auto-upgrade was replacing a call to a masked intrinsic, it would
not copy the metadata from the original call.

If an intrinsic had metadata, but did not need any updates, the metadata
would stay, but if an update was needed, the would end up being removed.
A similar effect could be observed with masked_expandload and
masked_compressstore, which at the moment are not handled by auto-upgrade:
the metadata remained untouched.

Differential Revision: https://reviews.llvm.org/D101201
2021-05-05 15:51:46 -05:00

146 lines
8.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s | FileCheck %s
define <4 x i32> @load(<4 x i32>* nocapture readonly %a0) !dbg !8 {
; CHECK-LABEL: @load(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[V0:%.*]] = call <4 x i32> @llvm.masked.load.v4i32.p0v4i32(<4 x i32>* [[A0:%.*]], i32 16, <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> undef), !dbg [[DBG19:![0-9]+]], !tbaa [[TBAA20:![0-9]+]]
; CHECK-NEXT: ret <4 x i32> [[V0]], !dbg [[DBG23:![0-9]+]]
;
entry:
%v0 = call <4 x i32> @llvm.masked.load.v4i32.p0v4i32(<4 x i32>* %a0, i32 16, <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> undef), !dbg !19, !tbaa !20
ret <4 x i32> %v0, !dbg !23
}
define void @store(<4 x i32> %a0, <4 x i32>* nocapture %a1) !dbg !24 {
; CHECK-LABEL: @store(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.masked.store.v4i32.p0v4i32(<4 x i32> [[A0:%.*]], <4 x i32>* [[A1:%.*]], i32 16, <4 x i1> <i1 false, i1 true, i1 false, i1 true>), !dbg [[DBG30:![0-9]+]], !tbaa [[TBAA20]]
; CHECK-NEXT: ret void, !dbg [[DBG31:![0-9]+]]
;
entry:
call void @llvm.masked.store.v4i32.p0v4i32(<4 x i32> %a0, <4 x i32>* %a1, i32 16, <4 x i1> <i1 false, i1 true, i1 false, i1 true>), !dbg !30, !tbaa !20
ret void, !dbg !31
}
define <4 x i32> @gather(<4 x i32*> %a0) !dbg !32 {
; CHECK-LABEL: @gather(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[V0:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[A0:%.*]], i32 16, <4 x i1> <i1 true, i1 true, i1 true, i1 false>, <4 x i32> undef), !dbg [[DBG35:![0-9]+]], !tbaa [[TBAA20]]
; CHECK-NEXT: ret <4 x i32> [[V0]], !dbg [[DBG36:![0-9]+]]
;
entry:
%v0 = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %a0, i32 16, <4 x i1> <i1 true, i1 true, i1 true, i1 false>, <4 x i32> undef), !dbg !35, !tbaa !20
ret <4 x i32> %v0, !dbg !36
}
define void @scatter(<4 x i32> %a0, <4 x i32*> %a1) !dbg !37 {
; CHECK-LABEL: @scatter(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[A0:%.*]], <4 x i32*> [[A1:%.*]], i32 16, <4 x i1> <i1 false, i1 true, i1 true, i1 true>), !dbg [[DBG41:![0-9]+]], !tbaa [[TBAA20]]
; CHECK-NEXT: ret void, !dbg [[DBG42:![0-9]+]]
;
entry:
call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> %a0, <4 x i32*> %a1, i32 16, <4 x i1> <i1 false, i1 true, i1 true, i1 true>), !dbg !41, !tbaa !20
ret void, !dbg !42
}
define <4 x i32> @expandload(i32* nocapture readonly %a0) !dbg !43 {
; CHECK-LABEL: @expandload(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[V0:%.*]] = call <4 x i32> @llvm.masked.expandload.v4i32(i32* [[A0:%.*]], <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef), !dbg [[DBG49:![0-9]+]], !tbaa [[TBAA50:![0-9]+]]
; CHECK-NEXT: ret <4 x i32> [[V0]], !dbg [[DBG52:![0-9]+]]
;
entry:
%v0 = call <4 x i32> @llvm.masked.expandload.v4i32(i32* %a0, <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef), !dbg !49, !tbaa !50
ret <4 x i32> %v0, !dbg !52
}
define void @compressstore(<4 x i32> %a0, i32* nocapture %a1) !dbg !53 {
; CHECK-LABEL: @compressstore(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.masked.compressstore.v4i32(<4 x i32> [[A0:%.*]], i32* [[A1:%.*]], <4 x i1> <i1 false, i1 false, i1 true, i1 true>), !dbg [[DBG59:![0-9]+]], !tbaa [[TBAA50]]
; CHECK-NEXT: ret void, !dbg [[DBG60:![0-9]+]]
;
entry:
call void @llvm.masked.compressstore.v4i32(<4 x i32> %a0, i32* %a1, <4 x i1> <i1 false, i1 false, i1 true, i1 true>), !dbg !59, !tbaa !50
ret void, !dbg !60
}
declare <4 x i32> @llvm.masked.load.v4i32.p0v4i32(<4 x i32>*, i32 immarg, <4 x i1>, <4 x i32>) #0
declare void @llvm.masked.store.v4i32.p0v4i32(<4 x i32>, <4 x i32>*, i32 immarg, <4 x i1>) #1
declare <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*>, i32 immarg, <4 x i1>, <4 x i32>) #2
declare void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>, <4 x i32*>, i32 immarg, <4 x i1>) #3
declare <4 x i32> @llvm.masked.expandload.v4i32(i32*, <4 x i1>, <4 x i32>) #2
declare void @llvm.masked.compressstore.v4i32(<4 x i32>, i32*, <4 x i1>) #1
attributes #0 = { argmemonly nofree nosync nounwind readonly willreturn }
attributes #1 = { argmemonly nofree nosync nounwind willreturn writeonly }
attributes #2 = { nofree nosync nounwind readonly willreturn }
attributes #3 = { nofree nosync nounwind willreturn writeonly }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
!llvm.ident = !{!7}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project 985ab6e1fa575fc41ebfdafbba401e5787661584)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.c", directory: "/test")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{i32 7, !"uwtable", i32 1}
!7 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project 985ab6e1fa575fc41ebfdafbba401e5787661584)"}
!8 = distinct !DISubprogram(name: "load", scope: !1, file: !1, line: 3, type: !9, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
!9 = !DISubroutineType(types: !10)
!10 = !{!11, !16}
!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "v4i32", file: !1, line: 1, baseType: !12)
!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 128, flags: DIFlagVector, elements: !14)
!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!14 = !{!15}
!15 = !DISubrange(count: 4)
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
!17 = !{!18}
!18 = !DILocalVariable(name: "a0", arg: 1, scope: !8, file: !1, line: 3, type: !16)
!19 = !DILocation(line: 4, column: 10, scope: !8)
!20 = !{!21, !21, i64 0}
!21 = !{!"omnipotent char", !22, i64 0}
!22 = !{!"Simple C/C++ TBAA"}
!23 = !DILocation(line: 4, column: 3, scope: !8)
!24 = distinct !DISubprogram(name: "store", scope: !1, file: !1, line: 7, type: !25, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !27)
!25 = !DISubroutineType(types: !26)
!26 = !{null, !11, !16}
!27 = !{!28, !29}
!28 = !DILocalVariable(name: "a0", arg: 1, scope: !24, file: !1, line: 7, type: !11)
!29 = !DILocalVariable(name: "a1", arg: 2, scope: !24, file: !1, line: 7, type: !16)
!30 = !DILocation(line: 8, column: 7, scope: !24)
!31 = !DILocation(line: 9, column: 1, scope: !24)
!32 = distinct !DISubprogram(name: "gather", scope: !1, file: !1, line: 11, type: !9, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !33)
!33 = !{!34}
!34 = !DILocalVariable(name: "a0", arg: 1, scope: !32, file: !1, line: 11, type: !16)
!35 = !DILocation(line: 12, column: 10, scope: !32)
!36 = !DILocation(line: 12, column: 3, scope: !32)
!37 = distinct !DISubprogram(name: "scatter", scope: !1, file: !1, line: 15, type: !25, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !38)
!38 = !{!39, !40}
!39 = !DILocalVariable(name: "a0", arg: 1, scope: !37, file: !1, line: 15, type: !11)
!40 = !DILocalVariable(name: "a1", arg: 2, scope: !37, file: !1, line: 15, type: !16)
!41 = !DILocation(line: 16, column: 7, scope: !37)
!42 = !DILocation(line: 17, column: 1, scope: !37)
!43 = distinct !DISubprogram(name: "expandload", scope: !1, file: !1, line: 19, type: !44, scopeLine: 19, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !47)
!44 = !DISubroutineType(types: !45)
!45 = !{!11, !46}
!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)
!47 = !{!48}
!48 = !DILocalVariable(name: "a0", arg: 1, scope: !43, file: !1, line: 19, type: !46)
!49 = !DILocation(line: 19, column: 40, scope: !43)
!50 = !{!51, !51, i64 0}
!51 = !{!"int", !21, i64 0}
!52 = !DILocation(line: 20, column: 3, scope: !43)
!53 = distinct !DISubprogram(name: "compressstore", scope: !1, file: !1, line: 23, type: !54, scopeLine: 23, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !56)
!54 = !DISubroutineType(types: !55)
!55 = !{null, !11, !46}
!56 = !{!57, !58}
!57 = !DILocalVariable(name: "a0", arg: 1, scope: !53, file: !1, line: 23, type: !11)
!58 = !DILocalVariable(name: "a1", arg: 2, scope: !53, file: !1, line: 23, type: !46)
!59 = !DILocation(line: 24, column: 7, scope: !53)
!60 = !DILocation(line: 25, column: 1, scope: !53)