ir_dead_code: Fix segfault on handling a return statement with no value.
authorEric Anholt <eric@anholt.net>
Thu, 29 Apr 2010 20:54:19 +0000 (13:54 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 29 Apr 2010 20:54:19 +0000 (13:54 -0700)
ir_dead_code.cpp

index 81fbeba32136473433a966db02a26b07d39aea3f..a73e9ed9bbb8f231d90ed61deee42acc86d9d9b9 100644 (file)
@@ -251,7 +251,10 @@ ir_dead_code_visitor::visit(ir_call *ir)
 void
 ir_dead_code_visitor::visit(ir_return *ir)
 {
-   ir->get_value()->accept(this);
+   ir_rvalue *val = ir->get_value();
+
+   if (val)
+      val->accept(this);
 }