Skip to content

Instantly share code, notes, and snippets.

@arsenm
Created March 30, 2013 02:07
Show Gist options
  • Save arsenm/5274961 to your computer and use it in GitHub Desktop.
Save arsenm/5274961 to your computer and use it in GitHub Desktop.
Test case for memdep crash
; ModuleID = 'input.bc'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-a0:0:64-f80:32:32"
target triple = "amdil-pc-amdopencl"
@.str = internal addrspace(2) constant [6 x i8] c"uint*\00"
@.str1 = internal addrspace(2) constant [6 x i8] c"uint*\00"
@llvm.argtypename.annotations.__OpenCL_memdep_requires_dominator_tree_kernel = global [2 x i8*] [i8* bitcast ([6 x i8] addrspace(2)* @.str to i8*), i8* bitcast ([6 x i8] addrspace(2)* @.str1 to i8*)], section "llvm.metadata"
@sgv = internal addrspace(2) constant [1 x i8] zeroinitializer
@fgv = internal addrspace(2) constant [1 x i8] zeroinitializer
@lvgv = internal constant [0 x i8*] zeroinitializer
@rvgv = internal constant [0 x i8*] zeroinitializer
@llvm.global.annotations = appending global [1 x { i8*, i8*, i8*, i8*, i8*, i32 }] [{ i8*, i8*, i8*, i8*, i8*, i32 } { i8* bitcast (void (i32 addrspace(1)*, i32 addrspace(2)*)* @__OpenCL_memdep_requires_dominator_tree_kernel to i8*), i8* bitcast ([1 x i8] addrspace(2)* @sgv to i8*), i8* bitcast ([1 x i8] addrspace(2)* @fgv to i8*), i8* bitcast ([0 x i8*]* @lvgv to i8*), i8* bitcast ([0 x i8*]* @rvgv to i8*), i32 0 }], section "llvm.metadata"
define void @__OpenCL_memdep_requires_dominator_tree_kernel(i32 addrspace(1)* nocapture %bufUInt, i32 addrspace(2)* nocapture %pattern) nounwind {
entry:
br label %for.body
for.exit: ; preds = %for.body
ret void
for.body: ; preds = %for.body, %entry
%i.01 = phi i32 [ 0, %entry ], [ %tmp8.7, %for.body ]
%arrayidx = getelementptr i32 addrspace(1)* %bufUInt, i32 %i.01
%arrayidx5 = getelementptr i32 addrspace(2)* %pattern, i32 %i.01
%tmp6 = load i32 addrspace(2)* %arrayidx5, align 4
store i32 %tmp6, i32 addrspace(1)* %arrayidx, align 4
%tmp82 = or i32 %i.01, 1
%arrayidx.1 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp82
%arrayidx5.1 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp82
%tmp6.1 = load i32 addrspace(2)* %arrayidx5.1, align 4
store i32 %tmp6.1, i32 addrspace(1)* %arrayidx.1, align 4
%tmp8.13 = or i32 %i.01, 2
%arrayidx.2 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp8.13
%arrayidx5.2 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp8.13
%tmp6.2 = load i32 addrspace(2)* %arrayidx5.2, align 4
store i32 %tmp6.2, i32 addrspace(1)* %arrayidx.2, align 4
%tmp8.24 = or i32 %i.01, 3
%arrayidx.3 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp8.24
%arrayidx5.3 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp8.24
%tmp6.3 = load i32 addrspace(2)* %arrayidx5.3, align 4
store i32 %tmp6.3, i32 addrspace(1)* %arrayidx.3, align 4
%tmp8.35 = or i32 %i.01, 4
%arrayidx.4 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp8.35
%arrayidx5.4 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp8.35
%tmp6.4 = load i32 addrspace(2)* %arrayidx5.4, align 4
store i32 %tmp6.4, i32 addrspace(1)* %arrayidx.4, align 4
%tmp8.46 = or i32 %i.01, 5
%arrayidx.5 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp8.46
%arrayidx5.5 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp8.46
%tmp6.5 = load i32 addrspace(2)* %arrayidx5.5, align 4
store i32 %tmp6.5, i32 addrspace(1)* %arrayidx.5, align 4
%tmp8.57 = or i32 %i.01, 6
%arrayidx.6 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp8.57
%arrayidx5.6 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp8.57
%tmp6.6 = load i32 addrspace(2)* %arrayidx5.6, align 4
store i32 %tmp6.6, i32 addrspace(1)* %arrayidx.6, align 4
%tmp8.68 = or i32 %i.01, 7
%arrayidx.7 = getelementptr i32 addrspace(1)* %bufUInt, i32 %tmp8.68
%arrayidx5.7 = getelementptr i32 addrspace(2)* %pattern, i32 %tmp8.68
%tmp6.7 = load i32 addrspace(2)* %arrayidx5.7, align 4
store i32 %tmp6.7, i32 addrspace(1)* %arrayidx.7, align 4
%tmp8.7 = add i32 %i.01, 8
%cmp.7 = icmp ult i32 %tmp8.7, 1024
br i1 %cmp.7, label %for.body, label %for.exit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment