Skip to content

Commit 0141925

Browse files
committed
change to loop and add test
1 parent 3b954a2 commit 0141925

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Compiler/src/optimize.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,17 @@ function run_passes_ipo_safe(
10101010
sv::OptimizationState,
10111011
optimize_until::Union{Nothing, Int, String} = nothing, # run all passes by default
10121012
)
1013-
if optimize_until isa String && !(optimize_until in ALL_PASS_NAMES)
1014-
error("invalid `optimize_until` argument, no such optimization pass")
1013+
if optimize_until isa String
1014+
found_pass = false
1015+
for pass in ALL_PASS_NAMES
1016+
if optimize_until == pass
1017+
found_pass = true
1018+
break
1019+
end
1020+
end
1021+
if !found_pass
1022+
error("invalid `optimize_until` argument, no such optimization pass")
1023+
end
10151024
end
10161025

10171026
__stage__ = 0 # used by @pass

Compiler/test/ssair.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,3 +821,5 @@ let cl = Int32[32, 1, 1, 1000, 240, 230]
821821
cl2 = ccall(:jl_uncompress_codelocs, Any, (Any, Int), str, 2)
822822
@test cl == cl2
823823
end
824+
825+
@test_throws ErrorException Base.code_ircode(+, (Float64, Float64); optimize_until = "nonexisting pass name")

0 commit comments

Comments
 (0)