457 lines · plain
1; RUN: not mlir-translate -import-llvm -emit-expensive-warnings -split-input-file %s 2>&1 -o /dev/null | FileCheck %s2 3; Check that debug records with an unsupported argument are dropped.4 5; CHECK: import-failure.ll6; CHECK-SAME: warning: unhandled debug variable record #dbg_value(!DIArgList(i64 %{{.*}}, i64 undef), !{{.*}}, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value), !{{.*}})7; CHECK: import-failure.ll8; CHECK-SAME: warning: unhandled debug variable record #dbg_value(!{{.*}}, !{{.*}}, !DIExpression(), !{{.*}})9define void @unsupported_argument(i64 %arg1) {10 #dbg_value(!DIArgList(i64 %arg1, i64 undef), !3, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value), !5)11 #dbg_value(!6, !3, !DIExpression(), !5)12 ret void13}14 15!llvm.dbg.cu = !{!1}16!llvm.module.flags = !{!0}17!0 = !{i32 2, !"Debug Info Version", i32 3}18!1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2)19!2 = !DIFile(filename: "import-failure.ll", directory: "/")20!3 = !DILocalVariable(scope: !4, name: "arg1", file: !2, line: 1, arg: 1, align: 64);21!4 = distinct !DISubprogram(name: "intrinsic", scope: !2, file: !2, spFlags: DISPFlagDefinition, unit: !1)22!5 = !DILocation(line: 1, column: 2, scope: !4)23!6 = !{}24 25; // -----26 27; CHECK: import-failure.ll28; CHECK-SAME: error: unsupported TBAA node format: !{{.*}} = !{!{{.*}}, i64 1, !"omnipotent char"}29define dso_local void @tbaa(ptr %0) {30 store i32 1, ptr %0, align 4, !tbaa !231 ret void32}33 34!2 = !{!3, !3, i64 0, i64 4}35!3 = !{!4, i64 4, !"int"}36!4 = !{!5, i64 1, !"omnipotent char"}37!5 = !{!"Simple C++ TBAA"}38 39; // -----40 41; CHECK: import-failure.ll42; CHECK-SAME: error: has cycle in TBAA graph: ![[ID:.*]] = distinct !{![[ID]], i64 4, !"int"}43define dso_local void @tbaa(ptr %0) {44 store i32 1, ptr %0, align 4, !tbaa !245 ret void46}47 48!2 = !{!3, !3, i64 0, i64 4}49!3 = !{!3, i64 4, !"int"}50 51; // -----52 53; CHECK: import-failure.ll54; CHECK-SAME: warning: expected an access group node to be empty and distinct55; CHECK: error: unsupported access group node: !0 = !{}56define void @access_group(ptr %arg1) {57 %1 = load i32, ptr %arg1, !llvm.access.group !058 ret void59}60 61!0 = !{}62 63; // -----64 65; CHECK: <unknown>66; CHECK-SAME: warning: expected all loop properties to be either debug locations or metadata nodes67; CHECK: <unknown>68; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, i32 42}69define void @invalid_loop_node(i64 %n, ptr %A) {70entry:71 br label %end, !llvm.loop !072end:73 ret void74}75 76!0 = distinct !{!0, i32 42}77 78; // -----79 80; CHECK: <unknown>81; CHECK-SAME: warning: cannot import empty loop property82; CHECK: <unknown>83; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}84define void @invalid_loop_node(i64 %n, ptr %A) {85entry:86 br label %end, !llvm.loop !087end:88 ret void89}90 91!0 = distinct !{!0, !1}92!1 = distinct !{}93 94; // -----95 96; CHECK: <unknown>97; CHECK-SAME: warning: cannot import loop property without a name98; CHECK: <unknown>99; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}100define void @invalid_loop_node(i64 %n, ptr %A) {101entry:102 br label %end, !llvm.loop !0103end:104 ret void105}106 107!0 = distinct !{!0, !1}108!1 = distinct !{i1 0}109 110; // -----111 112; CHECK: <unknown>113; CHECK-SAME: warning: cannot import loop properties with duplicated names llvm.loop.disable_nonforced114; CHECK: <unknown>115; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1, !1}116define void @unsupported_loop_annotation(i64 %n, ptr %A) {117entry:118 br label %end, !llvm.loop !0119end:120 ret void121}122 123!0 = distinct !{!0, !1, !1}124!1 = !{!"llvm.loop.disable_nonforced"}125 126; // -----127 128; CHECK: <unknown>129; CHECK-SAME: warning: expected metadata node llvm.loop.disable_nonforced to hold no value130; CHECK: <unknown>131; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}132define void @unsupported_loop_annotation(i64 %n, ptr %A) {133entry:134 br label %end, !llvm.loop !0135end:136 ret void137}138 139!0 = distinct !{!0, !1}140!1 = !{!"llvm.loop.disable_nonforced", i1 0}141 142; // -----143 144; CHECK: <unknown>145; CHECK-SAME: warning: expected metadata nodes llvm.loop.unroll.enable and llvm.loop.unroll.disable to be mutually exclusive146; CHECK: <unknown>147; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1, !2}148define void @unsupported_loop_annotation(i64 %n, ptr %A) {149entry:150 br label %end, !llvm.loop !0151end:152 ret void153}154 155!0 = distinct !{!0, !1, !2}156!1 = !{!"llvm.loop.unroll.enable"}157!2 = !{!"llvm.loop.unroll.disable"}158 159; // -----160 161; CHECK: <unknown>162; CHECK-SAME: warning: expected metadata node llvm.loop.vectorize.enable to hold a boolean value163; CHECK: <unknown>164; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}165define void @unsupported_loop_annotation(i64 %n, ptr %A) {166entry:167 br label %end, !llvm.loop !0168end:169 ret void170}171 172!0 = distinct !{!0, !1}173!1 = !{!"llvm.loop.vectorize.enable"}174 175; // -----176 177; CHECK: <unknown>178; CHECK-SAME: warning: expected metadata node llvm.loop.vectorize.width to hold an i32 value179; CHECK: <unknown>180; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}181define void @unsupported_loop_annotation(i64 %n, ptr %A) {182entry:183 br label %end, !llvm.loop !0184end:185 ret void186}187 188!0 = distinct !{!0, !1}189!1 = !{!"llvm.loop.vectorize.width", !0}190 191; // -----192 193; CHECK: <unknown>194; CHECK-SAME: warning: expected metadata node llvm.loop.vectorize.followup_all to hold an MDNode195; CHECK: <unknown>196; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}197define void @unsupported_loop_annotation(i64 %n, ptr %A) {198entry:199 br label %end, !llvm.loop !0200end:201 ret void202}203 204!0 = distinct !{!0, !1}205!1 = !{!"llvm.loop.vectorize.followup_all", i32 42}206 207; // -----208 209; CHECK: <unknown>210; CHECK-SAME: warning: expected metadata node llvm.loop.parallel_accesses to hold one or multiple MDNodes211; CHECK: <unknown>212; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1}213define void @unsupported_loop_annotation(i64 %n, ptr %A) {214entry:215 br label %end, !llvm.loop !0216end:217 ret void218}219 220!0 = distinct !{!0, !1}221!1 = !{!"llvm.loop.parallel_accesses", i32 42}222 223; // -----224 225; CHECK: <unknown>226; CHECK-SAME: warning: unknown loop annotation llvm.loop.typo227; CHECK: <unknown>228; CHECK-SAME: warning: unhandled metadata: !0 = distinct !{!0, !1, !2}229define void @unsupported_loop_annotation(i64 %n, ptr %A) {230entry:231 br label %end, !llvm.loop !0232end:233 ret void234}235 236!0 = distinct !{!0, !1, !2}237!1 = !{!"llvm.loop.disable_nonforced"}238!2 = !{!"llvm.loop.typo"}239 240; // -----241 242; CHECK: <unknown>243; CHECK-SAME: warning: could not lookup access group244define void @unused_access_group(ptr %arg) {245entry:246 %0 = load i32, ptr %arg, !llvm.access.group !0247 br label %end, !llvm.loop !1248end:249 ret void250}251 252!0 = distinct !{}253!1 = distinct !{!1, !2}254!2 = !{!"llvm.loop.parallel_accesses", !0, !3}255!3 = distinct !{}256 257; // -----258 259; CHECK: <unknown>260; CHECK-SAME: warning: dropped instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0)261define void @unused_scope() {262 call void @llvm.experimental.noalias.scope.decl(metadata !0)263 ret void264}265 266declare void @llvm.experimental.noalias.scope.decl(metadata)267 268!0 = !{!1}269!1 = !{!1, !2}270!2 = distinct !{!2, !"The domain"}271 272; // -----273 274; CHECK: import-failure.ll275; CHECK-SAME: dereferenceable metadata operand must be a non-negative constant integer276define void @deref(i64 %0) {277 %2 = inttoptr i64 %0 to ptr, !dereferenceable !0278 ret void279}280 281!0 = !{i64 -4}282 283; // -----284 285; CHECK: import-failure.ll286; CHECK-SAME: warning: unhandled data layout token: ni:42287target datalayout = "e-ni:42-i64:64"288 289; // -----290 291; CHECK: import-failure.ll292; CHECK-SAME: malformed specification, must be of the form "m:<mangling>"293target datalayout = "e-m-i64:64"294 295; // -----296 297; CHECK: <unknown>298; CHECK-SAME: warning: incompatible call and callee types: '!llvm.func<void (i64)>' and '!llvm.func<void (ptr)>'299define void @incompatible_call_and_callee_types() {300 call void @callee(i64 0)301 ret void302}303 304declare void @callee(ptr)305 306; // -----307 308; CHECK: <unknown>309; CHECK-SAME: warning: incompatible call and callee types: '!llvm.func<void ()>' and '!llvm.func<i32 ()>'310define void @f() personality ptr @__gxx_personality_v0 {311entry:312 invoke void @g() to label %bb1 unwind label %bb2313bb1:314 ret void315bb2:316 %0 = landingpad i32 cleanup317 unreachable318}319 320declare i32 @g()321 322declare i32 @__gxx_personality_v0(...)323 324; // -----325 326@g = private global ptr blockaddress(@fn, %bb1)327define void @fn() {328 ret void329; CHECK: unreachable block 'bb1' with address taken330bb1:331 ret void332}333 334; // -----335 336!10 = !{ i32 1, !"foo", i32 1 }337!11 = !{ i32 4, !"bar", i32 37 }338!12 = !{ i32 2, !"qux", i32 42 }339; CHECK: unsupported module flag value for key 'qux' : !4 = !{!"foo", i32 1}340!13 = !{ i32 3, !"qux", !{ !"foo", i32 1 }}341!llvm.module.flags = !{ !10, !11, !12, !13 }342 343; // -----344 345!llvm.module.flags = !{!41873}346 347!41873 = !{i32 1, !"ProfileSummary", !41874}348!41874 = !{!41875, !41876, !41877, !41878, !41880, !41881, !41882, !41883, !41884}349!41875 = !{!"ProfileFormat", !"InstrProf"}350!41876 = !{!"TotalCount", i64 263646}351!41877 = !{!"MaxCount", i64 86427}352!41878 = !{!"MaxInternalCount", i64 86427}353; CHECK: expected 'MaxFunctionCount' key, but found: !"NumCounts"354!41880 = !{!"NumCounts", i64 3712}355!41881 = !{!"NumFunctions", i64 796}356!41882 = !{!"IsPartialProfile", i64 0}357!41883 = !{!"PartialProfileRatio", double 0.000000e+00}358!41884 = !{!"DetailedSummary", !41885}359!41885 = !{!41886, !41887}360!41886 = !{i32 10000, i64 86427, i32 1}361!41887 = !{i32 100000, i64 86427, i32 1}362 363; // -----364 365!llvm.module.flags = !{!51873}366 367!51873 = !{i32 1, !"ProfileSummary", !51874}368!51874 = !{!51875, !51876, !51877, !51878, !51879, !51880, !51881, !51882, !51883, !51884}369!51875 = !{!"ProfileFormat", !"InstrProf"}370!51876 = !{!"TotalCount", i64 263646}371!51877 = !{!"MaxCount", i64 86427}372!51878 = !{!"MaxInternalCount", i64 86427}373!51879 = !{!"MaxFunctionCount", i64 4691}374!51880 = !{!"NumCounts", i64 3712}375; CHECK: expected integer metadata value for key 'NumFunctions'376!51881 = !{!"NumFunctions", double 0.000000e+00}377!51882 = !{!"IsPartialProfile", i64 0}378!51883 = !{!"PartialProfileRatio", double 0.000000e+00}379!51884 = !{!"DetailedSummary", !51885}380!51885 = !{!51886, !51887}381!51886 = !{i32 10000, i64 86427, i32 1}382!51887 = !{i32 100000, i64 86427, i32 1}383 384; // -----385 386!llvm.module.flags = !{!61873}387 388!61873 = !{i32 1, !"ProfileSummary", !61874}389!61874 = !{!61875, !61876, !61877, !61878, !61879, !61880, !61881, !61882, !61883, !61884}390; CHECK: expected 'SampleProfile', 'InstrProf' or 'CSInstrProf' values, but found: !"MyThingyFmt"391!61875 = !{!"ProfileFormat", !"MyThingyFmt"}392!61876 = !{!"TotalCount", i64 263646}393!61877 = !{!"MaxCount", i64 86427}394!61878 = !{!"MaxInternalCount", i64 86427}395!61879 = !{!"MaxFunctionCount", i64 4691}396!61880 = !{!"NumCounts", i64 3712}397!61881 = !{!"NumFunctions", i64 796}398!61882 = !{!"IsPartialProfile", i64 0}399!61883 = !{!"PartialProfileRatio", double 0.000000e+00}400!61884 = !{!"DetailedSummary", !61885}401!61885 = !{!61886, !61887}402!61886 = !{i32 10000, i64 86427, i32 1}403!61887 = !{i32 100000, i64 86427, i32 1}404 405; // -----406 407!llvm.module.flags = !{!71873}408 409!71873 = !{i32 1, !"ProfileSummary", !71874}410!71874 = !{!71875, !71876, !71877, !71878, !71879, !71880, !71881, !71882, !71883}411!71875 = !{!"ProfileFormat", !"InstrProf"}412!71876 = !{!"TotalCount", i64 263646}413!71877 = !{!"MaxCount", i64 86427}414!71878 = !{!"MaxInternalCount", i64 86427}415!71879 = !{!"MaxFunctionCount", i64 4691}416!71880 = !{!"NumCounts", i64 3712}417!71881 = !{!"NumFunctions", i64 796}418!71882 = !{!"IsPartialProfile", i64 0}419; CHECK: the last summary entry is 'PartialProfileRatio', expected 'DetailedSummary'420!71883 = !{!"PartialProfileRatio", double 0.000000e+00}421 422; // -----423 424!llvm.module.flags = !{!81873}425 426!81873 = !{i32 1, !"ProfileSummary", !81874}427; CHECK: expected at 8 entries in 'ProfileSummary'428!81874 = !{!81875, !81876, !81877, !81878, !81879, !81880, !81881}429!81875 = !{!"ProfileFormat", !"InstrProf"}430!81876 = !{!"TotalCount", i64 263646}431!81877 = !{!"MaxCount", i64 86427}432!81878 = !{!"MaxInternalCount", i64 86427}433!81879 = !{!"MaxFunctionCount", i64 4691}434!81880 = !{!"NumCounts", i64 3812}435!81881 = !{!"NumFunctions", i64 796}436 437; // -----438 439!llvm.module.flags = !{!91873}440 441!91873 = !{i32 1, !"ProfileSummary", !91874}442!91874 = !{!91875, !91876, !91877, !91878, !91879, !91880, !91881, !91882, !91883, !91884}443!91875 = !{!"ProfileFormat", !"InstrProf"}444; CHECK: expected 2-element tuple metadata445!91876 = !{!"TotalCount", i64 263646, i64 263646}446!91877 = !{!"MaxCount", i64 86427}447!91878 = !{!"MaxInternalCount", i64 86427}448!91879 = !{!"MaxFunctionCount", i64 4691}449!91880 = !{!"NumCounts", i64 3712}450!91881 = !{!"NumFunctions", i64 796}451!91882 = !{!"IsPartialProfile", i64 0}452!91883 = !{!"PartialProfileRatio", double 0.000000e+00}453!91884 = !{!"DetailedSummary", !91885}454!91885 = !{!91886, !91887}455!91886 = !{i32 10000, i64 86427, i32 1}456!91887 = !{i32 100000, i64 86427, i32 1}457