glsl: use a non-malloc'd storage for short ir_variable names

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák
2016-10-07 22:26:58 +02:00
parent 21e11b5282
commit 7a2387c3e0
3 changed files with 22 additions and 3 deletions

View File

@@ -599,7 +599,8 @@ public:
inline bool is_name_ralloced() const
{
return this->name != ir_variable::tmp_name;
return this->name != ir_variable::tmp_name &&
this->name != this->name_storage;
}
/**
@@ -624,6 +625,16 @@ public:
*/
const char *name;
private:
/**
* If the name length fits into name_storage, it's used, otherwise
* the name is ralloc'd. shader-db mining showed that 70% of variables
* fit here. This is a win over ralloc where only ralloc_header has
* 20 bytes on 64-bit (28 bytes with DEBUG), and we can also skip malloc.
*/
char name_storage[16];
public:
struct ir_variable_data {
/**