summaryrefslogtreecommitdiff
path: root/ir_function_inlining.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-05-01 00:31:35 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-05-01 00:31:35 -0700
commit05ddebac0a45bf07fa60b04b22f29234ca26a4a4 (patch)
tree501d04d5dce82c574eb3d59bf16650ee5c3f217e /ir_function_inlining.cpp
parentc07fdae33f083f6337a2810c36d6dcb2dbeacff2 (diff)
Fix ir_return cloning to actually use the cloned subexpression.
This caused a nasty bug where the function inliner would create new variables for each of the formal parameters, but the body would still reference the old copies. This was highly visible since the dead code eliminator (rightly) removed the new declarations, leading to printed IR that referenced non-existent variable names.
Diffstat (limited to 'ir_function_inlining.cpp')
-rw-r--r--ir_function_inlining.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp
index c623cd010b..0d072c1b76 100644
--- a/ir_function_inlining.cpp
+++ b/ir_function_inlining.cpp
@@ -264,8 +264,7 @@ ir_function_cloning_visitor::visit(ir_return *ir)
rval = this->result->as_rvalue();
assert(rval);
- result = new ir_assignment(new ir_dereference(this->retval),
- ir->get_value(), NULL);
+ result = new ir_assignment(new ir_dereference(this->retval), rval, NULL);
}