summaryrefslogtreecommitdiff
path: root/source/slang/ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-12-21 19:50:22 -0500
committerGitHub <noreply@github.com>2017-12-21 19:50:22 -0500
commitfab52a1bd6aa056ba91a2697133e62a169866242 (patch)
tree239e42c6e9fd2907afe52974cccda41555bde2ba /source/slang/ir.cpp
parent6f681279d99e72e717bb2b91763b80e570ae725b (diff)
parent00490154ef0762839556b5884ba9b7523b265a1c (diff)
Merge pull request #324 from tfoleyNV/generic-struct-specialization
Support generic `struct` types during IR-based emit
Diffstat (limited to 'source/slang/ir.cpp')
-rw-r--r--source/slang/ir.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index 38a0f0c03..cd36e8d47 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -3079,7 +3079,20 @@ namespace Slang
{
if(!originalValue)
return;
- context->getClonedValues().Add(originalValue, clonedValue);
+
+ // Note: setting the entry direclty here rather than
+ // using `Add` or `AddIfNotExists` because we can conceivably
+ // clone the same value (e.g., a basic block inside a generic
+ // function) multiple times, and that is okay, and we really
+ // just need to keep track of the most recent value.
+
+ // TODO: The same thing could potentially be handled more
+ // cleanly by having a notion of scoping for these cloned-value
+ // mappings, so that we register cloned values for things
+ // inside of a function to a temporary mapping that we
+ // throw away after the function is done.
+
+ context->getClonedValues()[originalValue] = clonedValue;
}
// Information on values to use when registering a cloned value