diff options
| author | Yong He <yonghe@outlook.com> | 2020-09-14 10:28:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-14 10:28:22 -0700 |
| commit | 2e3688af574738650c2753680ce9f417fb22e5e7 (patch) | |
| tree | d99d049a98540336f2d803545d94d91fb200cc8e /source/slang/slang-ir-deduplicate.cpp | |
| parent | 54616718b07b2256271a88b4fc862c6acdb23773 (diff) | |
Dynamic dispatch bug fixes. (#1541)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-deduplicate.cpp')
| -rw-r--r-- | source/slang/slang-ir-deduplicate.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slang/slang-ir-deduplicate.cpp b/source/slang/slang-ir-deduplicate.cpp index 83090e5ff..bbcb8cf03 100644 --- a/source/slang/slang-ir-deduplicate.cpp +++ b/source/slang/slang-ir-deduplicate.cpp @@ -17,6 +17,7 @@ namespace Slang IRInst* addConstantValue(IRConstant* value) { IRConstantKey key = { value }; + value->setFullType((IRType*)addValue(value->getFullType())); if (auto newValue = builder->constantMap.TryGetValue(key)) return *newValue; builder->constantMap[key] = value; @@ -34,15 +35,14 @@ namespace Slang break; } - IRInstKey key = { value }; - if (auto newValue = builder->globalValueNumberingMap.TryGetValue(key)) - return *newValue; - for (UInt i = 0; i < value->getOperandCount(); i++) { value->setOperand(i, addValue(value->getOperand(i))); } value->setFullType((IRType*)addValue(value->getFullType())); + IRInstKey key = { value }; + if (auto newValue = builder->globalValueNumberingMap.TryGetValue(key)) + return *newValue; builder->globalValueNumberingMap[key] = value; return value; } @@ -53,6 +53,7 @@ namespace Slang context.builder = this; bool changed = true; constantMap.Clear(); + globalValueNumberingMap.Clear(); for (auto inst : module->getGlobalInsts()) { if (auto constVal = as<IRConstant>(inst)) @@ -60,7 +61,6 @@ namespace Slang context.addConstantValue(constVal); } } - globalValueNumberingMap.Clear(); List<IRInst*> instToRemove; for (auto inst : module->getGlobalInsts()) { |
