diff options
author | Eric Anholt <[email protected]> | 2010-08-05 12:10:31 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-08-05 12:56:03 -0700 |
commit | 9f82806c7b5109553cf806a5652e6b6198665094 (patch) | |
tree | d09c0725d013f3ede715c0b02d007af6f761b727 /src/glsl/ir_basic_block.cpp | |
parent | 3bd7e70bf7c4a9a52b425284c9f23689f00de93c (diff) |
glsl2: Don't dead-code eliminate a call where the return value is unused.
This showed up since the disabling of inlining at compile time, which
I apparently didn't regenerate piglit summary for.
Fixes:
glsl-deadcode-call.
Diffstat (limited to 'src/glsl/ir_basic_block.cpp')
-rw-r--r-- | src/glsl/ir_basic_block.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index f9953ea42da..a8338259620 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -49,6 +49,14 @@ public: bool has_call; }; +bool +ir_has_call(ir_instruction *ir) +{ + ir_has_call_visitor v; + ir->accept(&v); + return v.has_call; +} + /** * Calls a user function for every basic block in the instruction stream. * @@ -115,8 +123,6 @@ void call_for_basic_blocks(exec_list *instructions, call_for_basic_blocks(&ir_sig->body, callback, data); } } else if (ir->as_assignment()) { - ir_has_call_visitor v; - /* If there's a call in the expression tree being assigned, * then that ends the BB too. * @@ -130,8 +136,7 @@ void call_for_basic_blocks(exec_list *instructions, * expression flattener may be useful before using the basic * block finder to get more maximal basic blocks out. */ - ir->accept(&v); - if (v.has_call) { + if (ir_has_call(ir)) { callback(leader, ir, data); leader = NULL; } |