-
I'm trying to implement closures using MIR C and I'm wondering about the efficiency of the following code:
Will the optimiser always generate code similar to local variable access for a, b and c? If not Is there anything that can be done to improve efficiency? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I don't know what do you mean exactly. I see not necessary read memory MIR-generator right now does practically nothing for memory access optimizations. I am sure I'll work on improving code for memory accesses. I thought about this many times. On the first stage it will be probably adding alias info to MIR memory operands, generation of this info by I'd like to keep a balance between optimization complexity and its performance impact. The complexity of GCC/LLVM is so big and results in permanent struggling with optimization bugs. I know it well as half of my work time I spend on fixing RA PRs in GCC. |
Beta Was this translation helpful? Give feedback.
I don't know what do you mean exactly. I see not necessary read memory
l->a
right after its storing. It is not that bad as modern processors have store-to-load forwarding but still it is better to remove redundant load.MIR-generator right now does practically nothing for memory access optimizations.
I am sure I'll work on improving code for memory accesses. I thought about this many times. On the first stage it will be probably adding alias info to MIR memory operands, generation of this info by
c2m
based on type info, and using alias info for moderate memory optimizations. In the future flow sensitive point-to-analysis might be implemented.I'd like to keep a balance between optimizatio…