From 245466d89cfe54b78da486f06d470bc6daaf4625 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 Feb 2023 16:44:04 -0800 Subject: Remove `SharedIRBuilder`. (#2657) Co-authored-by: Yong He --- source/slang/slang-ir-lower-error-handling.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'source/slang/slang-ir-lower-error-handling.cpp') diff --git a/source/slang/slang-ir-lower-error-handling.cpp b/source/slang/slang-ir-lower-error-handling.cpp index e9747e3b6..013f683c0 100644 --- a/source/slang/slang-ir-lower-error-handling.cpp +++ b/source/slang/slang-ir-lower-error-handling.cpp @@ -13,8 +13,6 @@ struct ErrorHandlingLoweringContext IRModule* module; DiagnosticSink* diagnosticSink; - SharedIRBuilder sharedBuilder; - List workList; HashSet workListSet; @@ -32,7 +30,7 @@ struct ErrorHandlingLoweringContext auto throwAttr = funcType->findAttr(); if (!throwAttr) return; - IRBuilder builder(sharedBuilder); + IRBuilder builder(module); builder.setInsertBefore(funcType); auto resultType = builder.getResultType(funcType->getResultType(), throwAttr->getErrorType()); @@ -44,7 +42,7 @@ struct ErrorHandlingLoweringContext paramTypes.add(funcType->getParamType(i)); } auto newFuncType = builder.getFuncType(paramTypes, resultType); - sharedBuilder.replaceGlobalInst(funcType, newFuncType); + funcType->replaceUsesWith(newFuncType); } void processTryCall(IRTryCall* tryCall) @@ -80,7 +78,7 @@ struct ErrorHandlingLoweringContext } auto errorType = throwAttr->getErrorType(); - IRBuilder builder(sharedBuilder); + IRBuilder builder(module); builder.setInsertBefore(tryCall); auto resultType = builder.getResultType(resultValueType, errorType); @@ -127,7 +125,7 @@ struct ErrorHandlingLoweringContext // If we are in a throwing function and sees a `return(val)` inst, // replace it with a `return makeResultValue(val)`, so that it returns a `Result` type. - IRBuilder builder(sharedBuilder); + IRBuilder builder(module); builder.setInsertBefore(ret); auto resultType = builder.getResultType(funcType->getResultType(), throwAttr->getErrorType()); @@ -148,7 +146,7 @@ struct ErrorHandlingLoweringContext // If we are in a throwing function and sees a `throw(e)` inst, // replace it with a `return makeResultError(e)`. - IRBuilder builder(sharedBuilder); + IRBuilder builder(module); builder.setInsertBefore(throwInst); auto resultType = builder.getResultType(funcType->getResultType(), throwAttr->getErrorType()); @@ -197,9 +195,6 @@ struct ErrorHandlingLoweringContext void processModule() { - // Deduplicate equivalent types. - sharedBuilder.deduplicateAndRebuildGlobalNumberingMap(); - // Translate all IRTryCall, IRThrow, IRReturn. processInsts(); @@ -230,7 +225,6 @@ void lowerErrorHandling(IRModule* module, DiagnosticSink* sink) ErrorHandlingLoweringContext context; context.module = module; context.diagnosticSink = sink; - context.sharedBuilder.init(module); return context.processModule(); } } -- cgit v1.2.3