Skip to content

Commit 6cd4a76

Browse files
committed
some more cleanup
1 parent b7005c7 commit 6cd4a76

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

src/compiler/optimize.jl

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,6 @@ function loop_optimizations_tm!(pm::LLVM.ModulePassManager, tm::LLVM.TargetMachi
9999
end
100100
end
101101

102-
function more_loop_optimizations_newPM!(fpm::LLVM.NewPMPassManager)
103-
add!(fpm, NewPMLoopPassManager()) do lpm
104-
add!(lpm, LoopRotatePass())
105-
# moving IndVarSimplify here prevented removing the loop in perf_sumcartesian(10:-1:1)
106-
# add!(lpm, LoopIdiomPass()) TODO(NewPM): This seems to have gotten removed
107-
108-
# LoopRotate strips metadata from terminator, so run LowerSIMD afterwards
109-
add!(lpm, LowerSIMDLoopPass()) # Annotate loop marked with "loopinfo" as LLVM parallel loop
110-
add!(lpm, LICMPass())
111-
add!(lpm, JuliaLICMPass())
112-
end
113-
add!(fpm, InstCombinePass())
114-
add!(fpm, JLInstSimplifyPass())
115-
add!(fpm, NewPMLoopPassManager()) do lpm
116-
add!(lpm, IndVarSimplifyPass())
117-
add!(lpm, LoopDeletionPass())
118-
end
119-
add!(fpm, LoopUnrollPass(opt_level=2))
120-
end
121-
122102
@static if VERSION < v"1.11-"
123103
function cpu_features_tm!(pm::LLVM.ModulePassManager, tm::LLVM.TargetMachine)
124104
@static if isdefined(LLVM.Interop, :cpu_features!)
@@ -315,7 +295,6 @@ function addOptimizationPasses!(mpm::LLVM.NewPMPassManager)
315295
# merging the `alloca` for the unboxed data and the `alloca` created by the `alloc_opt`
316296
# pass.
317297

318-
319298
add!(fpm, AllocOptPass())
320299
# consider AggressiveInstCombinePass at optlevel > 2
321300

@@ -335,7 +314,23 @@ function addOptimizationPasses!(mpm::LLVM.NewPMPassManager)
335314
# remove those before optimizing loops.
336315
add!(fpm, AllocOptPass())
337316

338-
more_loop_optimizations_newPM!(fpm)
317+
add!(fpm, NewPMLoopPassManager(use_memory_ssa=true)) do lpm
318+
add!(lpm, LoopRotatePass())
319+
# moving IndVarSimplify here prevented removing the loop in perf_sumcartesian(10:-1:1)
320+
add!(lpm, LoopIdiomRecognizePass())
321+
322+
# LoopRotate strips metadata from terminator, so run LowerSIMD afterwards
323+
add!(lpm, LowerSIMDLoopPass()) # Annotate loop marked with "loopinfo" as LLVM parallel loop
324+
add!(lpm, LICMPass())
325+
add!(lpm, JuliaLICMPass())
326+
end
327+
add!(fpm, InstCombinePass())
328+
add!(fpm, JLInstSimplifyPass())
329+
add!(fpm, NewPMLoopPassManager()) do lpm
330+
add!(lpm, IndVarSimplifyPass())
331+
add!(lpm, LoopDeletionPass())
332+
end
333+
add!(fpm, LoopUnrollPass(opt_level=2))
339334

340335
# Run our own SROA on heap objects before LLVM's
341336
add!(fpm, AllocOptPass())

0 commit comments

Comments
 (0)