diff options
| author | Yong He <yonghe@outlook.com> | 2024-09-18 13:46:20 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-18 13:46:20 -0700 |
| commit | 2d83875f4b376f047c4541a6f6c13d36e5aa228b (patch) | |
| tree | ba41c6faa6e97b6821ac8ea635f2ae52ca8d1f4c /source/slang/slang-ir-use-uninitialized-values.cpp | |
| parent | 85b996a75683b5364456d731a9cb4aee5c3fada2 (diff) | |
Add `IRWArray` interface, and make StructuredBuffer conform to them. (#5097)
* Add `IRWArray` interface, and make StructuredBuffer conform to them.
* Update user guide.
* Fix.
* Fixes.
Diffstat (limited to 'source/slang/slang-ir-use-uninitialized-values.cpp')
| -rw-r--r-- | source/slang/slang-ir-use-uninitialized-values.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/source/slang/slang-ir-use-uninitialized-values.cpp b/source/slang/slang-ir-use-uninitialized-values.cpp index 8661ba0dc..56b13aa09 100644 --- a/source/slang/slang-ir-use-uninitialized-values.cpp +++ b/source/slang/slang-ir-use-uninitialized-values.cpp @@ -448,21 +448,6 @@ namespace Slang return false; } - static bool isWrittenTo(IRInst* inst) - { - for (auto alias : getAliasableInstructions(inst)) - { - for (auto use = alias->firstUse; use; use = use->nextUse) - { - InstructionUsageType usage = getInstructionUsageType(use->getUser(), alias); - if (usage == Store || usage == StoreParent) - return true; - } - } - - return false; - } - static bool isDirectlyWrittenTo(IRInst* inst) { for (auto use = inst->firstUse; use; use = use->nextUse) @@ -580,36 +565,6 @@ namespace Slang } } - static void checkParameterAsInOut(IRParam* param, IRFunc* func, bool isThis, DiagnosticSink* sink) - { - // If the inout is used for the sake of interface conformance, let it be - for (auto use = func->firstUse; use; use = use->nextUse) - { - if (as<IRWitnessTableEntry>(use->getUser())) - return; - } - - // If there is at least one write... - if (isWrittenTo(param)) - return; - - // ...or if there is an intrinsic_asm instruction - for (const auto& b : func->getBlocks()) - { - for (auto inst = b->getFirstInst(); inst; inst = inst->next) - { - if (as<IRGenericAsm>(inst)) - return; - } - } - - sink->diagnose(param, - isThis - ? Diagnostics::methodNeverMutates - : Diagnostics::inOutNeverStoredInto, - param); - } - static void checkUninitializedValues(IRFunc* func, DiagnosticSink* sink) { // Differentiable functions will generate undefined values @@ -631,22 +586,15 @@ namespace Slang if (auto entry = func->findDecoration<IREntryPointDecoration>()) stage = entry->getProfile().getStage(); - bool structMethod = func->findDecoration<IRMethodDecoration>(); - // Check out parameters if (!isUnmodifying(func)) { int index = 0; for (auto param : firstBlock->getParams()) { - bool isThis = structMethod && (index == 0); - ParameterCheckType checkType = isPotentiallyUnintended(param, stage, index); if (checkType == AsOut) checkParameterAsOut(reachability, func, param, sink); - else if (checkType == AsInOut) - checkParameterAsInOut(param, func, isThis, sink); - index++; } } |
