@@ -110,57 +110,12 @@ function lower_throw_extra!(mod::LLVM.Module)
110110 return changed
111111end
112112
113- function fix_alloca_addrspace! (fn:: LLVM.Function )
114- changed = false
115- alloca_as = 5
116-
117- for bb in blocks (fn)
118- for insn in instructions (bb)
119- if isa (insn, LLVM. AllocaInst)
120- ty = value_type (insn)
121- ety = eltype (ty)
122- addrspace (ty) == alloca_as && continue
123-
124- new_insn = nothing
125- @dispose builder= IRBuilder () begin
126- position! (builder, insn)
127- _alloca = alloca! (builder, ety, name (insn))
128- new_insn = addrspacecast! (builder, _alloca, ty)
129- end
130- replace_uses! (insn, new_insn)
131- unsafe_delete! (LLVM. parent (insn), insn)
132- end
133- end
134- end
135-
136- return changed
137- end
138-
139113function emit_trap! (job:: CompilerJob{GCNCompilerTarget} , builder, mod, inst)
140114 trap_ft = LLVM. FunctionType (LLVM. VoidType ())
141115 trap = if haskey (functions (mod), " llvm.trap" )
142116 functions (mod)[" llvm.trap" ]
143117 else
144118 LLVM. Function (mod, " llvm.trap" , trap_ft)
145119 end
146- if Base. libllvm_version < v " 9"
147- rl_ft = LLVM. FunctionType (LLVM. Int32Type (),
148- [LLVM. Int32Type ()])
149- rl = if haskey (functions (mod), " llvm.amdgcn.readfirstlane" )
150- functions (mod)[" llvm.amdgcn.readfirstlane" ]
151- else
152- LLVM. Function (mod, " llvm.amdgcn.readfirstlane" , rl_ft)
153- end
154- # FIXME : Early versions of the AMDGPU target fail to skip machine
155- # blocks with certain side effects when EXEC==0, except when certain
156- # criteria are met within said block. We emit a v_readfirstlane_b32
157- # instruction here, as that is sufficient to trigger a skip. Without
158- # this, the target will only attempt to do a "masked branch", which
159- # only works on vector instructions (trap is a scalar instruction, and
160- # therefore it is executed even when EXEC==0).
161- rl_val = call! (builder, rl_ft, rl, [ConstantInt (Int32 (32 ))])
162- rl_bc = inttoptr! (builder, rl_val, LLVM. PointerType (LLVM. Int32Type ()))
163- store! (builder, rl_val, rl_bc)
164- end
165120 call! (builder, trap_ft, trap)
166121end
0 commit comments