@@ -118,7 +118,8 @@ RuntimeOptimizer::RuntimeOptimizer (ShadingSystemImpl &shadingsys,
118
118
m_opt_middleman(shadingsys.m_opt_middleman),
119
119
m_pass(0 ),
120
120
m_next_newconst(0 ), m_next_newtemp(0 ),
121
- m_stat_opt_locking_time(0 ), m_stat_specialization_time(0 )
121
+ m_stat_opt_locking_time(0 ), m_stat_specialization_time(0 ),
122
+ m_stop_optimizing(false )
122
123
{
123
124
memset (&m_shaderglobals, 0 , sizeof (ShaderGlobals));
124
125
m_shaderglobals.context = shadingcontext ();
@@ -1841,6 +1842,9 @@ RuntimeOptimizer::optimize_instance ()
1841
1842
if (m_pass != 0 && inst ()->unused ())
1842
1843
break ;
1843
1844
1845
+ if (m_stop_optimizing)
1846
+ break ;
1847
+
1844
1848
// Track basic blocks and conditional states
1845
1849
find_conditionals ();
1846
1850
find_basic_blocks ();
@@ -1862,6 +1866,9 @@ RuntimeOptimizer::optimize_instance ()
1862
1866
size_t num_ops = inst ()->ops ().size ();
1863
1867
int skipops = 0 ; // extra inserted ops to skip over
1864
1868
for (int opnum = 0 ; opnum < (int )num_ops; opnum += 1 ) {
1869
+ if (m_stop_optimizing)
1870
+ break ;
1871
+
1865
1872
// Before getting a reference to this op, be sure that a space
1866
1873
// is reserved at the end in case a folding routine inserts an
1867
1874
// op. That ensures that the reference won't be invalid.
@@ -2027,6 +2034,8 @@ RuntimeOptimizer::optimize_instance ()
2027
2034
2028
2035
if (optimize () >= 2 && m_opt_elide_useless_ops)
2029
2036
changed += useless_op_elision (op, opnum);
2037
+ if (m_stop_optimizing)
2038
+ break ;
2030
2039
2031
2040
// Peephole optimization involving pair of instructions
2032
2041
if (optimize () >= 2 && m_opt_peephole)
0 commit comments