Move the talloc_parent lookup down in a few hot paths.
talloc_parent is still 80% of our runtime, but likely talloc_parent
lookups will be reduced as we improve the handling of memory
ownership.
diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp
index 4010e46..3408f52 100644
--- a/ir_constant_expression.cpp
+++ b/ir_constant_expression.cpp
@@ -127,7 +127,6 @@
void
ir_constant_visitor::visit(ir_expression *ir)
{
- void *ctx = talloc_parent(ir);
value = NULL;
ir_constant *op[2];
unsigned int operand, c;
@@ -498,6 +497,7 @@
return;
}
+ void *ctx = talloc_parent(ir);
this->value = new(ctx) ir_constant(ir->type, &data);
}
@@ -514,7 +514,6 @@
void
ir_constant_visitor::visit(ir_swizzle *ir)
{
- void *ctx = talloc_parent(ir);
ir_constant *v = ir->val->constant_expression_value();
this->value = NULL;
@@ -536,6 +535,7 @@
}
}
+ void *ctx = talloc_parent(ir);
this->value = new(ctx) ir_constant(ir->type, &data);
}
}