summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-10-12 01:53:00 +0800
committerGitHub <noreply@github.com>2023-10-11 10:53:00 -0700
commit459572c36df1aefc5c80ee04e460efbd5c307f4a (patch)
tree388315dc422c34a9fcc9e045f6d2a163810421ba
parent61132c7e198fe372fc739ba0a1edbc8efef386d2 (diff)
Small warnings and bugs (#3272)
* Correctly use removeTrivialSingleIterationLoops during simplification * remove unused variables * Fix invalid fallthrough --------- Co-authored-by: Yong He <yonghe@outlook.com>
-rw-r--r--source/slang/slang-emit.cpp2
-rw-r--r--source/slang/slang-ir-addr-inst-elimination.cpp2
-rw-r--r--source/slang/slang-ir-loop-unroll.cpp2
-rw-r--r--source/slang/slang-ir-pytorch-cpp-binding.cpp2
-rw-r--r--source/slang/slang-ir-specialize-resources.cpp2
-rw-r--r--source/slang/slang-language-server-auto-format.cpp1
-rw-r--r--source/slang/slang-parser.cpp2
7 files changed, 6 insertions, 7 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 6f78c5d66..ce982a58c 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -938,7 +938,7 @@ Result linkAndOptimizeIR(
{
IRSimplificationOptions simplificationOptions = IRSimplificationOptions::getFast();
simplificationOptions.cfgOptions.removeTrivialSingleIterationLoops = true;
- simplifyIR(irModule, IRSimplificationOptions::getFast(), sink);
+ simplifyIR(irModule, simplificationOptions, sink);
}
// As a late step, we need to take the SSA-form IR and move things *out*
diff --git a/source/slang/slang-ir-addr-inst-elimination.cpp b/source/slang/slang-ir-addr-inst-elimination.cpp
index 6fb21e1ef..2581ea37f 100644
--- a/source/slang/slang-ir-addr-inst-elimination.cpp
+++ b/source/slang/slang-ir-addr-inst-elimination.cpp
@@ -98,7 +98,7 @@ struct AddressInstEliminationContext
auto call = as<IRCall>(use->getUser());
// Don't change the use if addr is a non mutable address.
- if (auto refType = as<IRConstRefType>(getRootAddr(addr)->getDataType()))
+ if (as<IRConstRefType>(getRootAddr(addr)->getDataType()))
{
return;
}
diff --git a/source/slang/slang-ir-loop-unroll.cpp b/source/slang/slang-ir-loop-unroll.cpp
index 6970942c9..31715e7b1 100644
--- a/source/slang/slang-ir-loop-unroll.cpp
+++ b/source/slang/slang-ir-loop-unroll.cpp
@@ -471,7 +471,7 @@ bool unrollLoopsInModule(IRModule* module, DiagnosticSink* sink)
for (auto inst : module->getGlobalInsts())
{
- if (auto genFunc = as<IRGeneric>(inst))
+ if (as<IRGeneric>(inst))
continue;
if (auto func = as<IRGlobalValueWithCode>(inst))
diff --git a/source/slang/slang-ir-pytorch-cpp-binding.cpp b/source/slang/slang-ir-pytorch-cpp-binding.cpp
index 3a7e8b9fb..432cd93f3 100644
--- a/source/slang/slang-ir-pytorch-cpp-binding.cpp
+++ b/source/slang/slang-ir-pytorch-cpp-binding.cpp
@@ -650,7 +650,7 @@ void markTypeForPyExport(IRType* type, DiagnosticSink* sink)
String tryGetExportTypeName(IRBuilder* builder, IRType* type)
{
- if (auto structType = as<IRStructType>(type))
+ if (as<IRStructType>(type))
{
if (auto pyExportDecoration = type->findDecoration<IRPyExportDecoration>())
return String(pyExportDecoration->getExportName());
diff --git a/source/slang/slang-ir-specialize-resources.cpp b/source/slang/slang-ir-specialize-resources.cpp
index 95dc39729..bb3d59bf2 100644
--- a/source/slang/slang-ir-specialize-resources.cpp
+++ b/source/slang/slang-ir-specialize-resources.cpp
@@ -1243,7 +1243,7 @@ bool isIllegalSPIRVParameterType(IRType* type)
// If we are emitting SPIRV direclty, we need to specialize
// all Texture types.
- if (auto texType = as<IRTextureType>(type))
+ if (as<IRTextureType>(type))
return true;
return false;
}
diff --git a/source/slang/slang-language-server-auto-format.cpp b/source/slang/slang-language-server-auto-format.cpp
index 154122769..d91e726cc 100644
--- a/source/slang/slang-language-server-auto-format.cpp
+++ b/source/slang/slang-language-server-auto-format.cpp
@@ -102,6 +102,7 @@ List<TextRange> extractFormattingExclusionRanges(UnownedStringSlice text)
endToken = token;
goto breakLabel;
}
+ break;
case TokenType::LBrace:
{
if (braceCounter == 0)
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index 54b93a1ef..696575f8b 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -6530,7 +6530,6 @@ namespace Slang
SPIRVAsmExpr* asmExpr = parser->astBuilder->create<SPIRVAsmExpr>();
parser->ReadToken(TokenType::LBrace);
- bool failed = false;
while(!parser->tokenReader.isAtEnd())
{
if(parser->LookAheadToken(TokenType::RBrace))
@@ -6539,7 +6538,6 @@ namespace Slang
asmExpr->insts.add(*inst);
else
{
- failed = true;
// Recover to the semi or brace
while(!(parser->LookAheadToken(TokenType::Semicolon)
|| parser->LookAheadToken(TokenType::RBrace)