Skip to content

Instantly share code, notes, and snippets.

@fwinter
Created May 6, 2013 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fwinter/5525072 to your computer and use it in GitHub Desktop.
Save fwinter/5525072 to your computer and use it in GitHub Desktop.
This LLVM IR kernel crashes libNVVM 1.0 Stack dump: 0. Running pass 'Function Pass Manager' on module ''. 1. Running pass 'Simplify the CFG' on function '@function' Segmentation fault (core dumped)
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
declare i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() nounwind readnone
declare i32 @llvm.nvvm.read.ptx.sreg.ntid.x() nounwind readnone
declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() nounwind readnone
define void @function (i1 %r0 ,
i32 %r1 ,
i32 %r2 ,
i32 %r3 ,
i1 %r4 ,
i32* %r12 ,
i1* %r18 ,
float* %r24 ,
float* %r25 ,
float* %r26 )
{
L0:
%r5 = xor i1 -1, %r4
%r6 = call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x()
%r7 = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
%r8 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
%r9 = mul i32 %r6,%r7
%r10 = add i32 %r9,%r8
%r11 = icmp sge i32 %r10,%r1
br i1 %r11, label %L1, label %L2
L1:
ret void
L2:
br i1 %r5, label %L3, label %L4
L4:
%r13 = getelementptr i32* %r12, i32 %r10
%r14 = load i32* %r13
br label %L5
L3:
%r15 = xor i1 -1, %r0
br i1 %r15, label %L5, label %L6
L6:
%r16 = add i32 %r10,%r2
br label %L5
L5:
%r17 = phi i32 [%r14 , %L4], [%r16 , %L6]
br i1 %r0, label %L7, label %L8
L8:
%r19 = getelementptr i1* %r18, i32 %r17
%r20 = load i1* %r19
%r21 = xor i1 -1, %r20
br i1 %r21, label %L9, label %L10
L9:
ret void
L10:
br label %L11
L7:
%r22 = icmp sgt i32 %r17,%r3
br i1 %r22, label %L12, label %L13
L12:
ret void
L13:
%r23 = icmp slt i32 %r17,%r2
br i1 %r23, label %L14, label %L15
L14:
ret void
L15:
br label %L11
L11:
%r28 = mul i32 0,1
%r29 = add i32 %r28,0
%r30 = mul i32 %r29,1
%r31 = add i32 %r30,0
%r32 = mul i32 %r31,256
%r33 = add i32 %r32,%r17
%r34 = getelementptr float* %r25, i32 %r33
%r35 = load float* %r34
%r37 = mul i32 0,1
%r38 = add i32 %r37,0
%r39 = mul i32 %r38,1
%r40 = add i32 %r39,0
%r41 = mul i32 %r40,256
%r42 = add i32 %r41,%r17
%r43 = getelementptr float* %r26, i32 %r42
%r44 = load float* %r43
%r46 = fadd float %r44,%r35
%r50 = mul i32 0,1
%r51 = add i32 %r50,0
%r52 = mul i32 %r51,1
%r53 = add i32 %r52,0
%r54 = mul i32 %r53,256
%r55 = add i32 %r54,%r17
%r56 = getelementptr float* %r24, i32 %r55
store float %r46, float* %r56
ret void
}
!nvvm.annotations = !{!0}
!0 = metadata !{void (i1 ,i32 ,i32 ,i32 ,i1 ,i32* ,i1* ,float* ,float* ,float* )* @function, metadata !"kernel", i32 1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment