From 011d4281647e3a2a3cf0dbdda1fa65cc1b8ed881 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 10 Nov 2023 13:55:14 -0800 Subject: Cleanup builtin arithmetic interfaces. (#3317) * wip: clean up IArithmetic * wip. * Cleanup builtin arithmetic interfaces. * Fix. * Fixes. * Fix. * Fix. * Fix. --------- Co-authored-by: Yong He --- source/slang/slang-ir-constexpr.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/slang/slang-ir-constexpr.cpp') diff --git a/source/slang/slang-ir-constexpr.cpp b/source/slang/slang-ir-constexpr.cpp index 34b56bfef..63ca32650 100644 --- a/source/slang/slang-ir-constexpr.cpp +++ b/source/slang/slang-ir-constexpr.cpp @@ -56,6 +56,9 @@ bool isConstExpr(IRInst* value) case kIROp_FloatLit: case kIROp_BoolLit: case kIROp_Func: + case kIROp_StructKey: + case kIROp_WitnessTable: + case kIROp_Generic: return true; default: @@ -136,6 +139,8 @@ bool opCanBeConstExpr(IROp op) case kIROp_GetOptionalValue: case kIROp_DifferentialPairGetDifferential: case kIROp_DifferentialPairGetPrimal: + case kIROp_LookupWitness: + case kIROp_Specialize: // TODO: more cases return true; @@ -146,10 +151,8 @@ bool opCanBeConstExpr(IROp op) bool opCanBeConstExprByForwardPass(IRInst* value) { - // TODO: realistically need to special-case `call` - // operations here, so that we check whether the - // callee function is fixed/known, and if it is - // whether it has been declared as constant-foldable + // TODO: handle call inst here. + if (value->getOp() == kIROp_Param) return false; return opCanBeConstExpr(value->getOp()); -- cgit v1.2.3