Skip to content

Commit

Permalink
Try to fix GC lowering tests
Browse files Browse the repository at this point in the history
These tests work fine on most machines, but they break on x86 Travis CI builds.
The breakage is almost certainly due to a mismatch between integer types in
the tests and 'size_t', exposed by recent changes to the GC lowering pass.
  • Loading branch information
jonathanvdc committed Feb 25, 2019
1 parent ee1eaf5 commit 8153b08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,9 +1685,16 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {

// Create a call to the `julia.gc_alloc_bytes` intrinsic, which is like
// `julia.gc_alloc_obj` except it doesn't set the tag.
auto allocBytesIntrinsic = getOrDeclare(jl_intrinsics::GCAllocBytes);
auto newI = builder.CreateCall(
getOrDeclare(jl_intrinsics::GCAllocBytes),
{ CI->getArgOperand(0), CI->getArgOperand(1) });
allocBytesIntrinsic,
{
CI->getArgOperand(0),
builder.CreateIntCast(
CI->getArgOperand(1),
allocBytesIntrinsic->getFunctionType()->getParamType(1),
false)
});
newI->takeName(CI);

// Set the tag.
Expand Down
4 changes: 1 addition & 3 deletions test/llvmpasses/final-lower-gc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ define void @gc_frame_lowering(i64 %a, i64 %b) {
top:
; CHECK-LABEL: @gc_frame_lowering
; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4
; CHECK-NEXT: [[GCFRAME_BYTES:%.*]] = bitcast %jl_value_t addrspace(10)** %gcframe to i8*
; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* [[GCFRAME_BYTES]], i8 0, i32 32, i32 0, i1 false), !tbaa !0
%gcframe = call %jl_value_t addrspace(10)** @julia.new_gc_frame(i32 2)
; CHECK: %ptls = call %jl_value_t*** @julia.ptls_states()
%ptls = call %jl_value_t*** @julia.ptls_states()
Expand Down Expand Up @@ -62,7 +60,7 @@ top:
; CHECK-LABEL: @gc_alloc_lowering
%ptls = call %jl_value_t*** @julia.ptls_states()
%ptls_i8 = bitcast %jl_value_t*** %ptls to i8*
; CHECK: %v = call noalias nonnull %jl_value_t addrspace(10)* @jl_gc_pool_alloc(i8* %ptls_i8, i32 [[POOL:[0-9]+]], i32 16) #0
; CHECK: %v = call noalias nonnull %jl_value_t addrspace(10)* @jl_gc_pool_alloc
%v = call %jl_value_t addrspace(10)* @julia.gc_alloc_bytes(i8* %ptls_i8, i64 8)
%0 = bitcast %jl_value_t addrspace(10)* %v to %jl_value_t addrspace(10)* addrspace(10)*
%1 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)* addrspace(10)* %0, i64 -1
Expand Down

0 comments on commit 8153b08

Please sign in to comment.