summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-check-differentiability.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-11-06 01:47:26 +0800
committerGitHub <noreply@github.com>2024-11-05 09:47:26 -0800
commitb118451e301d734e3e783b3acdf871f3f6ea851c (patch)
tree277f160d31e2c442f724bc6a2d3c09fabff403ca /source/slang/slang-ir-check-differentiability.cpp
parent53dd5928c35d5a5cb1f7d2a563348fd1fa87d672 (diff)
Move switch statement bodies to their own lines (#5493)
* Move switch statement bodies to their own lines * format --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-ir-check-differentiability.cpp')
-rw-r--r--source/slang/slang-ir-check-differentiability.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/source/slang/slang-ir-check-differentiability.cpp b/source/slang/slang-ir-check-differentiability.cpp
index 2a1194ebe..d18c47689 100644
--- a/source/slang/slang-ir-check-differentiability.cpp
+++ b/source/slang/slang-ir-check-differentiability.cpp
@@ -34,7 +34,8 @@ public:
switch (decorations->getOp())
{
case kIROp_ForwardDifferentiableDecoration:
- case kIROp_BackwardDifferentiableDecoration: return true;
+ case kIROp_BackwardDifferentiableDecoration:
+ return true;
}
}
return false;
@@ -63,8 +64,10 @@ public:
break;
case kIROp_UserDefinedBackwardDerivativeDecoration:
case kIROp_BackwardDerivativeDecoration:
- case kIROp_BackwardDifferentiableDecoration: return true;
- default: break;
+ case kIROp_BackwardDifferentiableDecoration:
+ return true;
+ default:
+ break;
}
}
return false;
@@ -94,7 +97,8 @@ public:
->findDecoration<IRUserDefinedBackwardDerivativeDecoration>())
return isDifferentiableFunc(bwdDerivative->getBackwardDerivativeFunc(), level);
return isDifferentiableFunc(func->getOperand(0), level);
- default: break;
+ default:
+ break;
}
func = getResolvedInstForDecorations(func);
@@ -175,7 +179,8 @@ public:
switch (addr->getOp())
{
case kIROp_Var:
- case kIROp_Param: return isDifferentiableType(diffTypeContext, addr->getDataType());
+ case kIROp_Param:
+ return isDifferentiableType(diffTypeContext, addr->getDataType());
case kIROp_FieldAddress:
if (!as<IRFieldAddress>(addr)->getField() ||
as<IRFieldAddress>(addr)
@@ -191,7 +196,8 @@ public:
return false;
addr = as<IRGetElementPtr>(addr)->getBase();
break;
- default: return false;
+ default:
+ return false;
}
}
return false;
@@ -203,7 +209,8 @@ public:
{
switch (inst->getOp())
{
- case kIROp_DetachDerivative: return false;
+ case kIROp_DetachDerivative:
+ return false;
case kIROp_Call:
{
auto call = as<IRCall>(inst);
@@ -211,7 +218,8 @@ public:
call->getCallee(),
CheckDifferentiabilityPassContext::DifferentiableLevel::Forward);
}
- default: return isDifferentiableType(diffTypeContext, inst->getDataType());
+ default:
+ return isDifferentiableType(diffTypeContext, inst->getDataType());
}
}
@@ -308,7 +316,8 @@ public:
{
switch (inst->getOp())
{
- case kIROp_FloatLit: return true;
+ case kIROp_FloatLit:
+ return true;
case kIROp_Call:
return shouldTreatCallAsDifferentiable(inst) ||
isDifferentiableFunc(as<IRCall>(inst)->getCallee(), requiredDiffLevel) &&
@@ -340,7 +349,8 @@ public:
{
switch (inst->getOp())
{
- case kIROp_DetachDerivative: return false;
+ case kIROp_DetachDerivative:
+ return false;
case kIROp_Call:
if (shouldTreatCallAsDifferentiable(inst))
return false;
@@ -449,7 +459,8 @@ public:
}
}
break;
- default: break;
+ default:
+ break;
}
}
}