Skip to content

Commit 1fee392

Browse files
committed
change to loop and add test
1 parent 45efeda commit 1fee392

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
@@ -1040,8 +1040,17 @@ function run_passes_ipo_safe(
10401040
sv::OptimizationState,
10411041
optimize_until::Union{Nothing, Int, String} = nothing, # run all passes by default
10421042
)
1043-
if optimize_until isa String && !(optimize_until in ALL_PASS_NAMES)
1044-
error("invalid `optimize_until` argument, no such optimization pass")
1043+
if optimize_until isa String
1044+
found_pass = false
1045+
for pass in ALL_PASS_NAMES
1046+
if optimize_until == pass
1047+
found_pass = true
1048+
break
1049+
end
1050+
end
1051+
if !found_pass
1052+
error("invalid `optimize_until` argument, no such optimization pass")
1053+
end
10451054
end
10461055

10471056
__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)