comparison gen/optimizer.cpp @ 1507:f86fd3b77285

Eliminate comparisons between GC allocations and constants. This removes some `assert(this !is null)`s when member functions get inlined. Also tweak pass order a bit.
author Frits van Bommel <fvbommel wxs.nl>
date Sat, 20 Jun 2009 14:28:59 +0200
parents 76936858d1c6
children c88b16d4a13c
comparison
equal deleted inserted replaced
1506:76936858d1c6 1507:f86fd3b77285
152 // Inline again, to catch things like now nonvirtual 152 // Inline again, to catch things like now nonvirtual
153 // function calls, foreach delegates passed to inlined 153 // function calls, foreach delegates passed to inlined
154 // opApply's, etc. where the actual function being called 154 // opApply's, etc. where the actual function being called
155 // wasn't known during the first inliner pass. 155 // wasn't known during the first inliner pass.
156 addPass(pm, createFunctionInliningPass()); 156 addPass(pm, createFunctionInliningPass());
157 157 }
158 // Run clean-up again. 158 }
159 addPass(pm, createScalarReplAggregatesPass()); 159
160 addPass(pm, createInstructionCombiningPass()); 160 if (optimizeLevel >= 2) {
161 } 161 if (!disableLangSpecificPasses) {
162 } 162 if (!disableSimplifyRuntimeCalls)
163 163 addPass(pm, createSimplifyDRuntimeCalls());
164 if (optimizeLevel >= 2 && !disableLangSpecificPasses) { 164
165 if (!disableSimplifyRuntimeCalls) 165 #ifdef USE_METADATA
166 addPass(pm, createSimplifyDRuntimeCalls()); 166 if (!disableGCToStack)
167 167 addPass(pm, createGarbageCollect2Stack());
168 #ifdef USE_METADATA 168 #endif
169 if (!disableGCToStack) { 169 }
170 addPass(pm, createGarbageCollect2Stack()); 170 // Run some clean-up passes
171 // Run some clean-up 171 addPass(pm, createInstructionCombiningPass());
172 addPass(pm, createInstructionCombiningPass()); 172 addPass(pm, createScalarReplAggregatesPass());
173 addPass(pm, createScalarReplAggregatesPass()); 173 addPass(pm, createCFGSimplificationPass());
174 addPass(pm, createCFGSimplificationPass()); 174 addPass(pm, createInstructionCombiningPass());
175 } 175 }
176 #endif 176
177 }
178
179 // -O3 177 // -O3
180 if (optimizeLevel >= 3) 178 if (optimizeLevel >= 3)
181 { 179 {
182 addPass(pm, createArgumentPromotionPass()); 180 addPass(pm, createArgumentPromotionPass());
183 addPass(pm, createTailDuplicationPass()); 181 addPass(pm, createTailDuplicationPass());