diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-12 16:00:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-12 16:00:05 -0700 |
| commit | 261b2f1f2bc13ccf7db5ec68c825ffc7b0781f7f (patch) | |
| tree | 4953e376e705a8110cb8164dda5b239c04f2768b /source/slang/slang-ir.cpp | |
| parent | bbd9c2e6d7b57f5acc3238083ab2f7c7b140df5e (diff) | |
Use scratchData on `IRInst` to replace HashSets. (#2978)
* Use scratchData on `IRInst` to replace HashSets.
* Update test results.
* Initialize scratchData.
* Update autodiff documentation.
* Use enum instead of bool.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index a44667a79..35803cedb 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -1982,25 +1982,7 @@ namespace Slang } // - bool operator==(IRInstKey const& left, IRInstKey const& right) - { - if(left.inst->getOp() != right.inst->getOp()) return false; - if(left.inst->getFullType() != right.inst->getFullType()) return false; - if(left.inst->operandCount != right.inst->operandCount) return false; - - auto argCount = left.inst->operandCount; - auto leftArgs = left.inst->getOperands(); - auto rightArgs = right.inst->getOperands(); - for( UInt aa = 0; aa < argCount; ++aa ) - { - if(leftArgs[aa].get() != rightArgs[aa].get()) - return false; - } - - return true; - } - - HashCode IRInstKey::getHashCode() + HashCode IRInstKey::_getHashCode() { auto code = Slang::getHashCode(inst->getOp()); code = combineHash(code, Slang::getHashCode(inst->getFullType())); @@ -7186,7 +7168,7 @@ namespace Slang } } - bool IRInst::mightHaveSideEffects() + bool IRInst::mightHaveSideEffects(SideEffectAnalysisOptions options) { // TODO: We should drive this based on flags specified // in `ir-inst-defs.h` isntead of hard-coding things here, @@ -7230,7 +7212,7 @@ namespace Slang // common subexpression elimination, etc. // auto call = cast<IRCall>(this); - return !isSideEffectFreeFunctionalCall(call); + return !isSideEffectFreeFunctionalCall(call, options); } break; |
