Skip to content

Commit cab1fe3

Browse files
committed
Fix some test issues
1 parent 39aff78 commit cab1fe3

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

src/codegen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7368,7 +7368,8 @@ static jl_llvm_functions_t
73687368
const char *name = jl_symbol_name(slot_symbol(ctx, ctx.vaSlot));
73697369
if (!name[0])
73707370
name = "...";
7371-
arg.setName(name + StringRef("[") + Twine(vidx++) + StringRef("]::") + type);
7371+
vidx++;
7372+
arg.setName(name + StringRef("[") + Twine(vidx) + StringRef("]::") + type);
73727373
}
73737374
}
73747375
}

test/compiler/codegen.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ if opt_level > 0
253253
load_dummy_ref_ir = get_llvm(load_dummy_ref, Tuple{Int})
254254
@test !occursin("jl_gc_pool_alloc", load_dummy_ref_ir)
255255
# Hopefully this is reliable enough. LLVM should be able to optimize this to a direct return.
256-
@test occursin("ret $Iptr %0", load_dummy_ref_ir)
256+
@test occursin("ret $Iptr %\"x::Int64\"", load_dummy_ref_ir)
257257
end
258258

259259
# Issue 22770

test/llvmpasses/fastmath.jl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
# RUN: julia --startup-file=no %s %t && llvm-link -S %t/* -o %t/module.ll
3+
# RUN: julia --startup-file=no %s %t -O && llvm-link -S %t/* -o %t/module.ll
44
# RUN: cat %t/module.ll | FileCheck %s
55

66
## Notes:
@@ -14,21 +14,31 @@ include(joinpath("..", "testhelpers", "llvmpasses.jl"))
1414

1515
import Base.FastMath
1616

17-
# CHECK: call fast float @llvm.sqrt.f32(float %{{[0-9]+}})
17+
# CHECK: call fast float @llvm.sqrt.f32(float %"x::Float32")
1818
emit(FastMath.sqrt_fast, Float32)
1919

2020

2121
# Float16 operations should be performed as Float32, unless @fastmath is specified
2222
# TODO: this is not true for platforms that natively support Float16
2323

2424
foo(x::T,y::T) where T = x-y == zero(T)
25-
# LOWER: fsub half %0, %1
26-
# FINAL: %2 = fpext half %0 to float
27-
# FINAL: %3 = fpext half %1 to float
28-
# FINAL: fsub half %2, %3
25+
# CHECK: define {{(swiftcc )?}}i8 @julia_foo_{{[0-9]+}}({{.*}}half %[[X:"x::Float16"]], half %[[Y:"y::Float16"]]) {{.*}}{
26+
# CHECK-DAG: %[[XEXT:[0-9]+]] = fpext half %[[X]] to float
27+
# CHECK-DAG: %[[YEXT:[0-9]+]] = fpext half %[[Y]] to float
28+
# CHECK: %[[DIFF:[0-9]+]] = fsub float %[[XEXT]], %[[YEXT]]
29+
# CHECK: %[[TRUNC:[0-9]+]] = fptrunc float %[[DIFF]] to half
30+
# CHECK: %[[DIFFEXT:[0-9]+]] = fpext half %[[TRUNC]] to float
31+
# CHECK: %[[CMP:[0-9]+]] = fcmp oeq float %[[DIFFEXT]], 0.000000e+00
32+
# CHECK: %[[ZEXT:[0-9]+]] = zext i1 %[[CMP]] to i8
33+
# CHECK: ret i8 %[[ZEXT]]
34+
# CHECK: }
2935
emit(foo, Float16, Float16)
3036

3137
@fastmath foo(x::T,y::T) where T = x-y == zero(T)
32-
# LOWER: fsub fast half %0, %1
33-
# FINAL: fsub fast half %0, %1
38+
# CHECK: define {{(swiftcc )?}}i8 @julia_foo_{{[0-9]+}}({{.*}}half %[[X:"x::Float16"]], half %[[Y:"y::Float16"]]) {{.*}}{
39+
# CHECK: %[[DIFF:[0-9]+]] = fsub fast half %[[X]], %[[Y]]
40+
# CHECK: %[[CMP:[0-9]+]] = fcmp fast oeq half %[[DIFF]], 0xH0000
41+
# CHECK: %[[ZEXT:[0-9]+]] = zext i1 %[[CMP]] to i8
42+
# CHECK: ret i8 %[[ZEXT]]
43+
# CHECK: }
3444
emit(foo, Float16, Float16)

0 commit comments

Comments
 (0)