diff --git a/src/ccall.cpp b/src/ccall.cpp index 6aa05fd7afada..abc9b8c7257be 100644 --- a/src/ccall.cpp +++ b/src/ccall.cpp @@ -1564,7 +1564,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs) JL_GC_POP(); ctx.builder.CreateCall(prepare_call(gcroot_flush_func)); emit_signal_fence(ctx); - ctx.builder.CreateLoad(ctx.signalPage, true); + ctx.builder.CreateLoad(T_size, ctx.signalPage, true); emit_signal_fence(ctx); return ghostValue(jl_nothing_type); } @@ -1582,7 +1582,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs) JL_GC_POP(); Value *ptls_i16 = emit_bitcast(ctx, ctx.ptlsStates, T_pint16); const int tid_offset = offsetof(jl_tls_states_t, tid); - Value *ptid = ctx.builder.CreateGEP(ptls_i16, ConstantInt::get(T_size, tid_offset / 2)); + Value *ptid = ctx.builder.CreateInBoundsGEP(ptls_i16, ConstantInt::get(T_size, tid_offset / 2)); LoadInst *tid = ctx.builder.CreateAlignedLoad(ptid, sizeof(int16_t)); tbaa_decorate(tbaa_const, tid); return mark_or_box_ccall_result(ctx, tid, retboxed, rt, unionall, static_rt); @@ -1593,7 +1593,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs) JL_GC_POP(); Value *ptls_pv = emit_bitcast(ctx, ctx.ptlsStates, T_pprjlvalue); const int ct_offset = offsetof(jl_tls_states_t, current_task); - Value *pct = ctx.builder.CreateGEP(ptls_pv, ConstantInt::get(T_size, ct_offset / sizeof(void*))); + Value *pct = ctx.builder.CreateInBoundsGEP(ptls_pv, ConstantInt::get(T_size, ct_offset / sizeof(void*))); LoadInst *ct = ctx.builder.CreateAlignedLoad(pct, sizeof(void*)); tbaa_decorate(tbaa_const, ct); return mark_or_box_ccall_result(ctx, ct, retboxed, rt, unionall, static_rt); @@ -1604,7 +1604,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs) JL_GC_POP(); Value *ptls_pv = emit_bitcast(ctx, ctx.ptlsStates, T_ppjlvalue); const int nt_offset = offsetof(jl_tls_states_t, next_task); - Value *pnt = ctx.builder.CreateGEP(ptls_pv, ConstantInt::get(T_size, nt_offset / sizeof(void*))); + Value *pnt = ctx.builder.CreateInBoundsGEP(ptls_pv, ConstantInt::get(T_size, nt_offset / sizeof(void*))); ctx.builder.CreateStore(emit_pointer_from_objref(ctx, boxed(ctx, argv[0])), pnt); return ghostValue(jl_nothing_type); } @@ -1643,7 +1643,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs) checkBB, contBB); ctx.builder.SetInsertPoint(checkBB); ctx.builder.CreateLoad( - ctx.builder.CreateConstGEP1_32(ctx.signalPage, -1), + ctx.builder.CreateConstInBoundsGEP1_32(T_size, ctx.signalPage, -1), true); ctx.builder.CreateBr(contBB); ctx.f->getBasicBlockList().push_back(contBB); diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 4794a7d6f3593..8cc85ec25fb4a 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -437,7 +437,7 @@ static Value *maybe_bitcast(jl_codectx_t &ctx, Value *V, Type *to) { static Value *julia_binding_gv(jl_codectx_t &ctx, Value *bv) { Value *offset = ConstantInt::get(T_size, offsetof(jl_binding_t, value) / sizeof(size_t)); - return ctx.builder.CreateInBoundsGEP(bv, offset); + return ctx.builder.CreateInBoundsGEP(T_prjlvalue, bv, offset); } static Value *julia_binding_gv(jl_codectx_t &ctx, jl_binding_t *b) @@ -2822,7 +2822,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg if (!jl_field_isptr(sty, i) && jl_is_uniontype(jl_field_type(sty, i))) { tbaa_decorate(tbaa_unionselbyte, ctx.builder.CreateAlignedStore( ConstantInt::get(T_int8, 0), - ctx.builder.CreateInBoundsGEP(emit_bitcast(ctx, strct, T_pint8), + ctx.builder.CreateInBoundsGEP(T_int8, emit_bitcast(ctx, strct, T_pint8), ConstantInt::get(T_size, jl_field_offset(sty, i) + jl_field_size(sty, i) - 1)), 1)); } @@ -2871,7 +2871,7 @@ static Value *emit_defer_signal(jl_codectx_t &ctx) PointerType::get(T_sigatomic, 0)); Constant *offset = ConstantInt::getSigned(T_int32, offsetof(jl_tls_states_t, defer_signal) / sizeof(sig_atomic_t)); - return ctx.builder.CreateInBoundsGEP(ptls, ArrayRef(offset), "jl_defer_signal"); + return ctx.builder.CreateInBoundsGEP(T_sigatomic, ptls, ArrayRef(offset), "jl_defer_signal"); } static int compare_cgparams(const jl_cgparams_t *a, const jl_cgparams_t *b) diff --git a/src/codegen.cpp b/src/codegen.cpp index 32ca20e900edf..a8144dff755ff 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2812,7 +2812,7 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f, Instruction *own_ptr; if (jl_is_long(ndp)) { own_ptr = ctx.builder.CreateAlignedLoad(T_prjlvalue, - ctx.builder.CreateConstGEP1_32(T_prjlvalue, + ctx.builder.CreateConstInBoundsGEP1_32(T_prjlvalue, emit_bitcast(ctx, decay_derived(ctx, aryv), T_pprjlvalue), jl_array_data_owner_offset(nd) / sizeof(jl_value_t*)), sizeof(void*)); @@ -4457,6 +4457,7 @@ static void allocate_gc_frame(jl_codectx_t &ctx, BasicBlock *b0) static void emit_last_age_field(jl_codectx_t &ctx) { ctx.world_age_field = ctx.builder.CreateInBoundsGEP( + T_size, ctx.builder.CreateBitCast(ctx.ptlsStates, T_psize), ConstantInt::get(T_size, offsetof(jl_tls_states_t, world_age) / sizeof(size_t))); } @@ -4791,7 +4792,7 @@ static Function* gen_cfun_wrapper( *closure_types = jl_alloc_vec_any(0); jl_array_ptr_1d_push(*closure_types, jargty); Value *runtime_dt = ctx.builder.CreateAlignedLoad(T_prjlvalue, - ctx.builder.CreateConstGEP1_32(T_prjlvalue, nestPtr, jl_array_len(*closure_types)), + ctx.builder.CreateConstInBoundsGEP1_32(T_prjlvalue, nestPtr, jl_array_len(*closure_types)), sizeof(void*)); BasicBlock *boxedBB = BasicBlock::Create(jl_LLVMContext, "isboxed", cw); BasicBlock *loadBB = BasicBlock::Create(jl_LLVMContext, "need-load", cw); @@ -4859,7 +4860,7 @@ static Function* gen_cfun_wrapper( *closure_types = jl_alloc_vec_any(0); jl_array_ptr_1d_push(*closure_types, jargty); Value *runtime_dt = ctx.builder.CreateAlignedLoad(T_prjlvalue, - ctx.builder.CreateConstGEP1_32(T_prjlvalue, nestPtr, jl_array_len(*closure_types)), + ctx.builder.CreateConstInBoundsGEP1_32(T_prjlvalue, nestPtr, jl_array_len(*closure_types)), sizeof(void*)); Value *strct = box_ccall_result(ctx, val, runtime_dt, jargty); inputarg = mark_julia_type(ctx, strct, true, jargty_proper); @@ -5251,12 +5252,12 @@ static jl_cgval_t emit_cfunction(jl_codectx_t &ctx, jl_value_t *output_type, con tbaa_decorate(tbaa, ctx.builder.CreateStore(F, derived_strct)); tbaa_decorate(tbaa, ctx.builder.CreateStore( ctx.builder.CreatePtrToInt(literal_pointer_val(ctx, fexpr_rt.constant), T_size), - ctx.builder.CreateConstGEP1_32(T_size, derived_strct, 1))); + ctx.builder.CreateConstInBoundsGEP1_32(T_size, derived_strct, 1))); Value *zero = ConstantInt::get(T_size, 0); tbaa_decorate(tbaa, ctx.builder.CreateStore(zero, - ctx.builder.CreateConstGEP1_32(T_size, derived_strct, 2))); + ctx.builder.CreateConstInBoundsGEP1_32(T_size, derived_strct, 2))); tbaa_decorate(tbaa, ctx.builder.CreateStore(zero, - ctx.builder.CreateConstGEP1_32(T_size, derived_strct, 3))); + ctx.builder.CreateConstInBoundsGEP1_32(T_size, derived_strct, 3))); F = strct; } } diff --git a/src/intrinsics.cpp b/src/intrinsics.cpp index 8877148addbcc..705271dd8f678 100644 --- a/src/intrinsics.cpp +++ b/src/intrinsics.cpp @@ -580,7 +580,7 @@ static jl_cgval_t emit_pointerref(jl_codectx_t &ctx, jl_cgval_t *argv) Value *thePtr = emit_unbox(ctx, T_pprjlvalue, e, e.typ); return mark_julia_type( ctx, - ctx.builder.CreateAlignedLoad(ctx.builder.CreateGEP(T_prjlvalue, thePtr, im1), align_nb), + ctx.builder.CreateAlignedLoad(ctx.builder.CreateInBoundsGEP(T_prjlvalue, thePtr, im1), align_nb), true, ety); } @@ -596,7 +596,7 @@ static jl_cgval_t emit_pointerref(jl_codectx_t &ctx, jl_cgval_t *argv) im1 = ctx.builder.CreateMul(im1, ConstantInt::get(T_size, LLT_ALIGN(size, jl_datatype_align(ety)))); Value *thePtr = emit_unbox(ctx, T_pint8, e, e.typ); - thePtr = ctx.builder.CreateGEP(T_int8, emit_bitcast(ctx, thePtr, T_pint8), im1); + thePtr = ctx.builder.CreateInBoundsGEP(T_int8, emit_bitcast(ctx, thePtr, T_pint8), im1); MDNode *tbaa = best_tbaa(ety); emit_memcpy(ctx, strct, tbaa, thePtr, nullptr, size, 1); return mark_julia_type(ctx, strct, true, ety); @@ -655,7 +655,7 @@ static jl_cgval_t emit_pointerset(jl_codectx_t &ctx, jl_cgval_t *argv) thePtr = emit_unbox(ctx, T_psize, e, e.typ); Instruction *store = ctx.builder.CreateAlignedStore( ctx.builder.CreatePtrToInt(emit_pointer_from_objref(ctx, boxed(ctx, x)), T_size), - ctx.builder.CreateGEP(T_size, thePtr, im1), align_nb); + ctx.builder.CreateInBoundsGEP(T_size, thePtr, im1), align_nb); tbaa_decorate(tbaa_data, store); } else if (!jl_isbits(ety)) { @@ -667,7 +667,7 @@ static jl_cgval_t emit_pointerset(jl_codectx_t &ctx, jl_cgval_t *argv) uint64_t size = jl_datatype_size(ety); im1 = ctx.builder.CreateMul(im1, ConstantInt::get(T_size, LLT_ALIGN(size, jl_datatype_align(ety)))); - emit_memcpy(ctx, ctx.builder.CreateGEP(T_int8, thePtr, im1), nullptr, x, size, align_nb); + emit_memcpy(ctx, ctx.builder.CreateInBoundsGEP(T_int8, thePtr, im1), nullptr, x, size, align_nb); } else { bool isboxed; diff --git a/src/llvm-final-gc-lowering.cpp b/src/llvm-final-gc-lowering.cpp index ad4cdf0b4d1ed..588d73210c5ba 100644 --- a/src/llvm-final-gc-lowering.cpp +++ b/src/llvm-final-gc-lowering.cpp @@ -107,7 +107,7 @@ void FinalLowerGC::lowerPushGCFrame(CallInst *target, Function &F) StoreInst *inst = builder.CreateAlignedStore( ConstantInt::get(T_size, JL_GC_ENCODE_PUSHARGS(nRoots)), builder.CreateBitCast( - builder.CreateConstGEP1_32(gcframe, 0), + builder.CreateConstInBoundsGEP1_32(T_prjlvalue, gcframe, 0), T_size->getPointerTo()), sizeof(void*)); inst->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe); @@ -115,7 +115,7 @@ void FinalLowerGC::lowerPushGCFrame(CallInst *target, Function &F) inst = builder.CreateAlignedStore( builder.CreateAlignedLoad(pgcstack, sizeof(void*)), builder.CreatePointerCast( - builder.CreateConstGEP1_32(gcframe, 1), + builder.CreateConstInBoundsGEP1_32(T_prjlvalue, gcframe, 1), PointerType::get(T_ppjlvalue, 0)), sizeof(void*)); inst->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe); @@ -133,7 +133,7 @@ void FinalLowerGC::lowerPopGCFrame(CallInst *target, Function &F) IRBuilder<> builder(target->getContext()); builder.SetInsertPoint(target); Instruction *gcpop = - cast(builder.CreateConstGEP1_32(gcframe, 1)); + cast(builder.CreateConstInBoundsGEP1_32(T_prjlvalue, gcframe, 1)); Instruction *inst = builder.CreateAlignedLoad(gcpop, sizeof(void*)); inst->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe); inst = builder.CreateAlignedStore( @@ -159,7 +159,7 @@ Value *FinalLowerGC::lowerGetGCFrameSlot(CallInst *target, Function &F) index = builder.CreateAdd(index, ConstantInt::get(T_int32, 2)); // Lower the intrinsic as a GEP. - auto gep = builder.CreateGEP(gcframe, index); + auto gep = builder.CreateInBoundsGEP(T_prjlvalue, gcframe, index); gep->takeName(target); return gep; } @@ -174,8 +174,8 @@ Value *FinalLowerGC::lowerQueueGCRoot(CallInst *target, Function &F) Instruction *FinalLowerGC::getPgcstack(Instruction *ptlsStates) { Constant *offset = ConstantInt::getSigned(T_int32, offsetof(jl_tls_states_t, pgcstack) / sizeof(void*)); - return GetElementPtrInst::Create( - nullptr, + return GetElementPtrInst::CreateInBounds( + T_ppjlvalue, ptlsStates, ArrayRef(offset), "jl_pgcstack"); diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp index ba3a2a93653a3..a9f323c18dec1 100644 --- a/src/llvm-late-gc-lowering.cpp +++ b/src/llvm-late-gc-lowering.cpp @@ -1560,7 +1560,7 @@ static Value *ExtractScalar(Value *V, Type *VTy, bool isptr, ArrayRef for (unsigned j = 0; j < Idxs.size(); ++j) { IdxList[j + 1] = ConstantInt::get(T_int32, Idxs[j]); } - Value *GEP = irbuilder.CreateGEP(VTy, V, IdxList); + Value *GEP = irbuilder.CreateInBoundsGEP(VTy, V, IdxList); Type *T = GetElementPtrInst::getIndexedType(VTy, IdxList); assert(T->isPointerTy()); V = irbuilder.CreateAlignedLoad(T, GEP, sizeof(void*)); @@ -1976,7 +1976,7 @@ Value *LateLowerGCFrame::EmitTagPtr(IRBuilder<> &builder, Type *T, Value *V) assert(T == T_size || isa(T)); auto TV = cast(V->getType()); auto cast = builder.CreateBitCast(V, T->getPointerTo(TV->getAddressSpace())); - return builder.CreateGEP(T, cast, ConstantInt::get(T_size, -1)); + return builder.CreateInBoundsGEP(T, cast, ConstantInt::get(T_size, -1)); } Value *LateLowerGCFrame::EmitLoadTag(IRBuilder<> &builder, Value *V) @@ -2161,7 +2161,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) { IRBuilder<> Builder (CI); for (; arg_it != CI->arg_end(); ++arg_it) { Builder.CreateAlignedStore(*arg_it, - Builder.CreateGEP(T_prjlvalue, Frame, ConstantInt::get(T_int32, slot++)), + Builder.CreateInBoundsGEP(T_prjlvalue, Frame, ConstantInt::get(T_int32, slot++)), sizeof(void*)); } ReplacementArgs.push_back(nframeargs == 0 ? diff --git a/test/llvmpasses/final-lower-gc.ll b/test/llvmpasses/final-lower-gc.ll index 8d3113b1cc8e4..ca15a60472550 100644 --- a/test/llvmpasses/final-lower-gc.ll +++ b/test/llvmpasses/final-lower-gc.ll @@ -23,11 +23,11 @@ top: %gcframe = call {} addrspace(10)** @julia.new_gc_frame(i32 2) ; CHECK: %ptls = call {}*** @julia.ptls_states() %ptls = call {}*** @julia.ptls_states() -; CHECK-DAG: [[GCFRAME_SIZE_PTR:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 0 +; CHECK-DAG: [[GCFRAME_SIZE_PTR:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 0 ; CHECK-DAG: [[GCFRAME_SIZE_PTR2:%.*]] = bitcast {} addrspace(10)** [[GCFRAME_SIZE_PTR]] to i64* ; CHECK-DAG: store i64 8, i64* [[GCFRAME_SIZE_PTR2]], align 8, !tbaa !0 -; CHECK-DAG: [[GCFRAME_SLOT:%.*]] = getelementptr {}**, {}*** %ptls, i32 0 -; CHECK-DAG: [[PREV_GCFRAME_PTR:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 1 +; CHECK-DAG: [[GCFRAME_SLOT:%.*]] = getelementptr inbounds {}**, {}*** %ptls, i32 0 +; CHECK-DAG: [[PREV_GCFRAME_PTR:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 1 ; CHECK-DAG: [[PREV_GCFRAME_PTR2:%.*]] = bitcast {} addrspace(10)** [[PREV_GCFRAME_PTR]] to {}*** ; CHECK-DAG: [[PREV_GCFRAME:%.*]] = load {}**, {}*** [[GCFRAME_SLOT]], align 8 ; CHECK-DAG: store {}** [[PREV_GCFRAME]], {}*** [[PREV_GCFRAME_PTR2]], align 8, !tbaa !0 @@ -35,18 +35,18 @@ top: ; CHECK-NEXT: store {} addrspace(10)** %gcframe, {} addrspace(10)*** [[GCFRAME_SLOT2]], align 8 call void @julia.push_gc_frame({} addrspace(10)** %gcframe, i32 2) %aboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %a) -; CHECK: %frame_slot_1 = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 3 +; CHECK: %frame_slot_1 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 3 %frame_slot_1 = call {} addrspace(10)** @julia.get_gc_frame_slot({} addrspace(10)** %gcframe, i32 1) store {} addrspace(10)* %aboxed, {} addrspace(10)** %frame_slot_1, align 8 %bboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %b) -; CHECK: %frame_slot_2 = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: %frame_slot_2 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 %frame_slot_2 = call {} addrspace(10)** @julia.get_gc_frame_slot({} addrspace(10)** %gcframe, i32 0) store {} addrspace(10)* %bboxed, {} addrspace(10)** %frame_slot_2, align 8 ; CHECK: call void @boxed_simple({} addrspace(10)* %aboxed, {} addrspace(10)* %bboxed) call void @boxed_simple({} addrspace(10)* %aboxed, {} addrspace(10)* %bboxed) -; CHECK-NEXT: [[PREV_GCFRAME_PTR3:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 1 +; CHECK-NEXT: [[PREV_GCFRAME_PTR3:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 1 ; CHECK-NEXT: [[PREV_GCFRAME_PTR4:%.*]] = load {} addrspace(10)*, {} addrspace(10)** [[PREV_GCFRAME_PTR3]], align 8, !tbaa !0 -; CHECK-NEXT: [[GCFRAME_SLOT3:%.*]] = getelementptr {}**, {}*** %ptls, i32 0 +; CHECK-NEXT: [[GCFRAME_SLOT3:%.*]] = getelementptr inbounds {}**, {}*** %ptls, i32 0 ; CHECK-NEXT: [[GCFRAME_SLOT4:%.*]] = bitcast {}*** [[GCFRAME_SLOT3]] to {} addrspace(10)** ; CHECK-NEXT: store {} addrspace(10)* [[PREV_GCFRAME_PTR4]], {} addrspace(10)** [[GCFRAME_SLOT4]], align 8, !tbaa !0 call void @julia.pop_gc_frame({} addrspace(10)** %gcframe) diff --git a/test/llvmpasses/gcroots.ll b/test/llvmpasses/gcroots.ll index 1b96fc2d5d356..15bdaf433ee34 100644 --- a/test/llvmpasses/gcroots.ll +++ b/test/llvmpasses/gcroots.ll @@ -14,13 +14,13 @@ top: ; CHECK: %gcframe = alloca {} addrspace(10)*, i32 4 ; CHECK: call {} addrspace(10)* @jl_box_int64 %aboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %a) -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] ; CHECK-NEXT: store {} addrspace(10)* %aboxed, {} addrspace(10)** [[GEP0]] %bboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %b) ; CHECK-NEXT: %bboxed = ; Make sure the same gc slot isn't re-used -; CHECK-NOT: getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0]] -; CHECK: [[GEP1:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT1:[0-9]+]] +; CHECK-NOT: getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0]] +; CHECK: [[GEP1:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT1:[0-9]+]] ; CHECK-NEXT: store {} addrspace(10)* %bboxed, {} addrspace(10)** [[GEP1]] ; CHECK-NEXT: call void @boxed_simple call void @boxed_simple({} addrspace(10)* %aboxed, @@ -32,7 +32,7 @@ define void @leftover_alloca({} addrspace(10)* %a) { ; If this pass encounters an alloca, it'll just sink it into the gcframe, ; relying on mem2reg to catch simple cases such as this earlier ; CHECK-LABEL: @leftover_alloca -; CHECK: %var = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe +; CHECK: %var = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe %ptls = call {}*** @julia.ptls_states() %var = alloca {} addrspace(10)* store {} addrspace(10)* %a, {} addrspace(10)** %var @@ -50,7 +50,7 @@ define void @simple_union() { %ptls = call {}*** @julia.ptls_states() ; CHECK: %a = call { {} addrspace(10)*, i8 } @union_ret() %a = call { {} addrspace(10)*, i8 } @union_ret() -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] ; CHECK-NEXT: [[EXTRACT:%.*]] = extractvalue { {} addrspace(10)*, i8 } %a, 0 ; CHECK-NEXT: store {} addrspace(10)* [[EXTRACT]], {} addrspace(10)** [[GEP0]] call void @union_arg({{} addrspace(10)*, i8} %a) @@ -85,7 +85,7 @@ blabel: br label %common common: %phi = phi {} addrspace(10)* [ %aboxed, %alabel ], [ %bboxed, %blabel ] -; CHECK: [[GEP:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: [[GEP:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 ; CHECK: store {} addrspace(10)* %phi, {} addrspace(10)** [[GEP]] call void @one_arg_boxed({} addrspace(10)* %phi) ret void @@ -188,7 +188,7 @@ define {{} addrspace(10)*, i8} @ret_use_struct() { %ptls = call {}*** @julia.ptls_states() ; CHECK: %aunion = call { {} addrspace(10)*, i8 } @union_ret() %aunion = call { {} addrspace(10)*, i8 } @union_ret() -; CHECK-DAG: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] +; CHECK-DAG: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] ; CHECK-DAG: [[EXTRACT:%.*]] = extractvalue { {} addrspace(10)*, i8 } %aunion, 0 ; CHECK-NEXT: store {} addrspace(10)* [[EXTRACT]], {} addrspace(10)** [[GEP0]] ; CHECK-NEXT: call void @jl_safepoint() @@ -381,14 +381,14 @@ header: a: ; This needs a store ; CHECK-LABEL: a: -; CHECK: [[GEP1:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] +; CHECK: [[GEP1:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0:[0-9]+]] ; CHECK: store {} addrspace(10)* %phi, {} addrspace(10)** [[GEP1]] call void @one_arg_boxed({} addrspace(10)* %phi) br label %latch latch: ; This as well in case we went the other path -; CHECK: [[GEP2:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0]] +; CHECK: [[GEP2:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 [[GEPSLOT0]] ; CHECK: store {} addrspace(10)* %phi, {} addrspace(10)** [[GEP2]] %obj = call {} addrspace(10)* @alloc() %cond = call i1 @check_property({} addrspace(10)* %phi) @@ -644,7 +644,7 @@ top: define i8 @vector_arrayptrs() { ; CHECK-LABEL: @vector_arrayptrs ; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3 -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 ; CHECK: store {} addrspace(10)* %obj1, {} addrspace(10)** [[GEP0]] ; top: @@ -665,7 +665,7 @@ define i8 @masked_arrayptrs() { ; CHECK-LABEL: @masked_arrayptrs ; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3 ; CHECK: %arrayptrs = call <2 x i8 addrspace(13)*> @llvm.masked.load.v2p13i8.p11v2p13i8(<2 x i8 addrspace(13)*> addrspace(11)* %arrayptrptr, i32 16, <2 x i1> , <2 x i8 addrspace(13)*> zeroinitializer) -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 ; CHECK: store {} addrspace(10)* %obj1, {} addrspace(10)** [[GEP0]] ; top: @@ -686,7 +686,7 @@ define i8 @gather_arrayptrs() { ; CHECK-LABEL: @gather_arrayptrs ; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3 ; CHECK: %arrayptrs = call <2 x i8 addrspace(13)*> @llvm.masked.gather.v2p13i8.v2p11p13i8(<2 x i8 addrspace(13)* addrspace(11)*> %arrayptrptrs, i32 16, <2 x i1> , <2 x i8 addrspace(13)*> zeroinitializer) -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 ; CHECK: store {} addrspace(10)* %obj1, {} addrspace(10)** [[GEP0]] ; top: @@ -706,7 +706,7 @@ define i8 @gather_arrayptrs_alltrue() { ; CHECK-LABEL: @gather_arrayptrs ; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3 ; CHECK: %arrayptrs = call <2 x i8 addrspace(13)*> @llvm.masked.gather.v2p13i8.v2p11p13i8(<2 x i8 addrspace(13)* addrspace(11)*> %arrayptrptrs, i32 16, <2 x i1> , <2 x i8 addrspace(13)*> zeroinitializer) -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 ; CHECK: store {} addrspace(10)* %obj1, {} addrspace(10)** [[GEP0]] ; top: @@ -725,7 +725,7 @@ top: define i8 @lost_select_decayed(i1 %arg1) { ; CHECK-LABEL: @lost_select_decayed ; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3 -; CHECK: [[GEP0:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 +; CHECK: [[GEP0:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2 ; CHECK: store {} addrspace(10)* [[SOMETHING:%.*]], {} addrspace(10)** [[GEP0]] top: %ptls = call {}*** @julia.ptls_states() diff --git a/test/llvmpasses/late-lower-gc.ll b/test/llvmpasses/late-lower-gc.ll index ae2dfc9c5794c..90603722b07db 100644 --- a/test/llvmpasses/late-lower-gc.ll +++ b/test/llvmpasses/late-lower-gc.ll @@ -40,7 +40,7 @@ top: %ptls_i8 = bitcast {}*** %ptls to i8* ; CHECK: %v = call {} addrspace(10)* @julia.gc_alloc_bytes(i8* %ptls_i8, [[SIZE_T:i.[0-9]+]] 8) ; CHECK-NEXT: [[V2:%.*]] = bitcast {} addrspace(10)* %v to {} addrspace(10)* addrspace(10)* -; CHECK-NEXT: [[V_HEADROOM:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)* addrspace(10)* [[V2]], i64 -1 +; CHECK-NEXT: [[V_HEADROOM:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(10)* [[V2]], i64 -1 ; CHECK-NEXT: store atomic {} addrspace(10)* @tag, {} addrspace(10)* addrspace(10)* [[V_HEADROOM]] unordered, align 8, !tbaa !0 %v = call noalias {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_i8, i64 8, {} addrspace(10)* @tag) ; CHECK-NEXT: ret {} addrspace(10)* %v @@ -59,7 +59,7 @@ top: %ptls_i8 = bitcast {}*** %ptls to i8* ; CHECK: %v = call {} addrspace(10)* @julia.gc_alloc_bytes(i8* %ptls_i8, [[SIZE_T:i.[0-9]+]] 8) ; CHECK-NEXT: [[V2:%.*]] = bitcast {} addrspace(10)* %v to {} addrspace(10)* addrspace(10)* -; CHECK-NEXT: [[V_HEADROOM:%.*]] = getelementptr {} addrspace(10)*, {} addrspace(10)* addrspace(10)* [[V2]], i64 -1 +; CHECK-NEXT: [[V_HEADROOM:%.*]] = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(10)* [[V2]], i64 -1 ; CHECK-NEXT: store atomic {} addrspace(10)* @tag, {} addrspace(10)* addrspace(10)* [[V_HEADROOM]] unordered, align 8, !tbaa !0 %v = call noalias {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_i8, i64 8, {} addrspace(10)* @tag) ; CHECK-NEXT: %v64 = bitcast {} addrspace(10)* %v to i64 addrspace(10)*