aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_general.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-10-30 22:58:44 +0000
committergingerBill <bill@gingerbill.org>2022-10-30 22:58:44 +0000
commit8fa571c283dca207e9eae7b2924db3bbc9d6aa39 (patch)
tree805f03db4ae3dfd6de28a5b18a804fe357789c2c /src/llvm_backend_general.cpp
parent83f3ae14d53bcc5fd16ace676535634e94fdf500 (diff)
Use direct parameter value in `lb_find_ident` when possible
Diffstat (limited to 'src/llvm_backend_general.cpp')
-rw-r--r--src/llvm_backend_general.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp
index 0dabee076..18cdd196d 100644
--- a/src/llvm_backend_general.cpp
+++ b/src/llvm_backend_general.cpp
@@ -2590,6 +2590,15 @@ lbValue lb_find_or_add_entity_string_byte_slice_with_type(lbModule *m, String co
lbValue lb_find_ident(lbProcedure *p, lbModule *m, Entity *e, Ast *expr) {
+ if (e->flags & EntityFlag_Param) {
+ // NOTE(bill): Bypass the stack copied variable for
+ // direct parameters as there is no need for the direct load
+ auto *found = map_get(&p->direct_parameters, e);
+ if (found) {
+ return *found;
+ }
+ }
+
auto *found = map_get(&m->values, e);
if (found) {
auto v = *found;