diff options
| author | Yong He <yonghe@outlook.com> | 2020-06-25 13:19:45 -0700 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2020-06-25 13:23:28 -0700 |
| commit | a1fed5e49bc1c8452752d13d401ee0bbbc5c71c4 (patch) | |
| tree | 03e54a0d33caf5196416315489a8d01b973c7a5e /source/slang/slang-ir-link.cpp | |
| parent | ffa9a3575ff888dc494ba4878f52441c64a9e08c (diff) | |
Partial fixes to code review comments
Diffstat (limited to 'source/slang/slang-ir-link.cpp')
| -rw-r--r-- | source/slang/slang-ir-link.cpp | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp index e556fd738..f80f97aff 100644 --- a/source/slang/slang-ir-link.cpp +++ b/source/slang/slang-ir-link.cpp @@ -89,25 +89,6 @@ struct IRSpecContextBase } }; -enum class GlobalValueClass -{ - StructKey, - Other -}; - -// Get the "class" of a global value. If there are more than one value of the same class, -// only one value in each class will be selected during linking. -GlobalValueClass getGlobalValueClass(IRInst* value) -{ - switch (value->op) - { - case kIROp_StructKey: - return GlobalValueClass::StructKey; - default: - return GlobalValueClass::Other; - } -} - void registerClonedValue( IRSpecContextBase* context, IRInst* clonedValue, @@ -147,11 +128,9 @@ void registerClonedValue( IROriginalValuesForClone const& originalValues) { registerClonedValue(context, clonedValue, originalValues.originalVal); - auto valueClass = getGlobalValueClass(clonedValue); for( auto s = originalValues.sym; s; s = s->nextWithSameName ) { - if (getGlobalValueClass(s->irGlobalValue) == valueClass) - registerClonedValue(context, clonedValue, s->irGlobalValue); + registerClonedValue(context, clonedValue, s->irGlobalValue); } } @@ -1234,12 +1213,10 @@ IRInst* cloneGlobalValueWithLinkage( // definitions over declarations. // IRInst* bestVal = nullptr; - auto valueClass = getGlobalValueClass(originalVal); for(IRSpecSymbol* ss = sym; ss; ss = ss->nextWithSameName ) { IRInst* newVal = ss->irGlobalValue; - if (getGlobalValueClass(newVal) == valueClass && - isBetterForTarget(context, newVal, bestVal)) + if (isBetterForTarget(context, newVal, bestVal)) bestVal = newVal; } |
