brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 34e81e3 Raw
73 lines · plain
1; RUN: not llc -mtriple=amdgcn-- -mcpu=gfx900 -filetype=null %s 2>&1 | FileCheck --strict-whitespace %s2 3; FIXME: Should be adequate to run just4; -passes=amdgpu-printf-runtime-binding, but llc and opt have5; different behavior on error diagnostics. opt uses the default error6; handler which immediately exits, and llc does not. We want to report7; errors for all functions in the module.8 9 10; CHECK: error: foo.cl:1:42: in function test_inttoptr_argument void (i32): printf format string must be a trivially resolved constant string global variable11define amdgpu_kernel void @test_inttoptr_argument(i32 %n) {12  %str = alloca [9 x i8], align 1, addrspace(5)13  %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) inttoptr (i64 1234 to ptr addrspace(4)), ptr addrspace(5) %str, i32 %n), !dbg !414  ret void15}16 17; CHECK: error: foo.cl:1:42: in function test_formatstr_argument void (ptr addrspace(4), i32): printf format string must be a trivially resolved constant string global variable18define amdgpu_kernel void @test_formatstr_argument(ptr addrspace(4) %format.str, i32 %n) {19  %str = alloca [9 x i8], align 1, addrspace(5)20  %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) %format.str, ptr addrspace(5) %str, i32 %n), !dbg !421  ret void22}23 24; CHECK: error: foo.cl:1:42: in function test_formatstr_instruction void (ptr addrspace(4), i32): printf format string must be a trivially resolved constant string global variable25define amdgpu_kernel void @test_formatstr_instruction(ptr addrspace(4) %kernarg, i32 %n) {26  %str = alloca [9 x i8], align 1, addrspace(5)27  %format.str = load ptr addrspace(4), ptr addrspace(4) %kernarg28  %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) %format.str, ptr addrspace(5) %str, i32 %n), !dbg !429  ret void30}31 32@no.initializer = external hidden addrspace(4) constant [6 x i8]33 34; CHECK: error: foo.cl:1:42: in function test_no_initializer_gv void (i32): printf format string must be a trivially resolved constant string global variable35define amdgpu_kernel void @test_no_initializer_gv(i32 %n) {36  %str = alloca [9 x i8], align 1, addrspace(5)37  %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @no.initializer, ptr addrspace(5) %str, i32 %n), !dbg !438  ret void39}40 41@interposable.initializer = weak unnamed_addr addrspace(4) constant [6 x i8] c"%s:%d\00"42 43; CHECK: error: foo.cl:1:42: in function poison_interposable_initializer_gv void (i32): printf format string must be a trivially resolved constant string global variable44define amdgpu_kernel void @poison_interposable_initializer_gv(i32 %n) {45  %str = alloca [9 x i8], align 1, addrspace(5)46  %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @interposable.initializer, ptr addrspace(5) %str, i32 %n), !dbg !447  ret void48}49 50@not.constant = private unnamed_addr addrspace(4) global [6 x i8] c"%s:%d\00", align 151 52 53; CHECK: error: <unknown>:0:0: in function not_constant_gv void (i32): printf format string must be a trivially resolved constant string global variable54define amdgpu_kernel void @not_constant_gv(i32 %n) {55entry:56  %str = alloca [9 x i8], align 1, addrspace(5)57  %arraydecay = getelementptr inbounds [9 x i8], ptr addrspace(5) %str, i32 0, i32 058  %call1 = call i32 (ptr addrspace(4), ...) @printf(ptr addrspace(4) @not.constant, ptr addrspace(5) %arraydecay, i32 %n)59  ret void60}61 62declare i32 @printf(ptr addrspace(4), ...)63 64!llvm.dbg.cu = !{!0}65!llvm.module.flags = !{!2, !3}66 67!0 = distinct !DICompileUnit(language: DW_LANG_OpenCL, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)68!1 = !DIFile(filename: "foo.cl", directory: ".")69!2 = !{i32 2, !"Dwarf Version", i32 4}70!3 = !{i32 2, !"Debug Info Version", i32 3}71!4 = !DILocation(line: 1, column: 42, scope: !5)72!5 = distinct !DISubprogram(name: "arst", scope: null, file: !1, line: 1, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0)73