Skip to content

Commit 73c113a

Browse files
committed
Debugging aid: stop_optimizing flag
1 parent b00404a commit 73c113a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/liboslexec/runtimeoptimize.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ RuntimeOptimizer::RuntimeOptimizer (ShadingSystemImpl &shadingsys,
118118
m_opt_middleman(shadingsys.m_opt_middleman),
119119
m_pass(0),
120120
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)
122123
{
123124
memset (&m_shaderglobals, 0, sizeof(ShaderGlobals));
124125
m_shaderglobals.context = shadingcontext();
@@ -1841,6 +1842,9 @@ RuntimeOptimizer::optimize_instance ()
18411842
if (m_pass != 0 && inst()->unused())
18421843
break;
18431844

1845+
if (m_stop_optimizing)
1846+
break;
1847+
18441848
// Track basic blocks and conditional states
18451849
find_conditionals ();
18461850
find_basic_blocks ();
@@ -1862,6 +1866,9 @@ RuntimeOptimizer::optimize_instance ()
18621866
size_t num_ops = inst()->ops().size();
18631867
int skipops = 0; // extra inserted ops to skip over
18641868
for (int opnum = 0; opnum < (int)num_ops; opnum += 1) {
1869+
if (m_stop_optimizing)
1870+
break;
1871+
18651872
// Before getting a reference to this op, be sure that a space
18661873
// is reserved at the end in case a folding routine inserts an
18671874
// op. That ensures that the reference won't be invalid.
@@ -2027,6 +2034,8 @@ RuntimeOptimizer::optimize_instance ()
20272034

20282035
if (optimize() >= 2 && m_opt_elide_useless_ops)
20292036
changed += useless_op_elision (op, opnum);
2037+
if (m_stop_optimizing)
2038+
break;
20302039

20312040
// Peephole optimization involving pair of instructions
20322041
if (optimize() >= 2 && m_opt_peephole)

src/liboslexec/runtimeoptimize.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ class RuntimeOptimizer : public OSOProcessorBase {
358358
std::set<UserDataNeeded> m_userdata_needed;
359359
double m_stat_opt_locking_time; ///< locking time
360360
double m_stat_specialization_time; ///< specialization time
361+
bool m_stop_optimizing; ///< for debugging
361362

362363
// Persistant data shared between layers
363364
bool m_unknown_message_sent; ///< Somebody did a non-const setmessage

0 commit comments

Comments
 (0)