From abb89b3e460e11e8f9a134199c2d559190bfc47e Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 26 May 2022 14:12:46 -0400 Subject: Remove LivenessLocation (#2248) * #include an absolute path didn't work - because paths were taken to always be relative. * Remove the need for LivenessLocation. * Use LivenessMode. * Fix some comments. Co-authored-by: Yong He --- source/slang/slang-emit.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index a128644d3..0ed17ad7c 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -736,10 +736,9 @@ Result linkAndOptimizeIR( simplifyIR(irModule); { - // Storage for liveness information - List livenessLocations; - const bool shouldTrackLiveness = codeGenContext->shouldTrackLiveness(); - + // Get the liveness mode. + const LivenessMode livenessMode = codeGenContext->shouldTrackLiveness() ? LivenessMode::Enabled : LivenessMode::Disabled; + // // Downstream targets may benefit from having live-range information for // local variables, and our IR currently encodes a reasonably good version @@ -750,9 +749,9 @@ Result linkAndOptimizeIR( // temporary variables into the IR module should take responsibility for // producing their own live-range information. // - if (shouldTrackLiveness) + if (isEnabled(livenessMode)) { - LivenessUtil::locateVariables(irModule, livenessLocations); + LivenessUtil::addVariableRangeStarts(irModule, livenessMode); } // As a late step, we need to take the SSA-form IR and move things *out* @@ -764,9 +763,7 @@ Result linkAndOptimizeIR( { // We only want to accumulate locations if liveness tracking is enabled. - List* locsPtr = shouldTrackLiveness ? &livenessLocations : nullptr; - - eliminatePhis(codeGenContext, locsPtr, irModule); + eliminatePhis(codeGenContext, livenessMode, irModule); #if 0 dumpIRIfEnabled(codeGenContext, irModule, "PHIS ELIMINATED"); #endif @@ -774,9 +771,9 @@ Result linkAndOptimizeIR( // If liveness is enabled add liveness ranges based on the accumulated liveness locations - if (shouldTrackLiveness) + if (isEnabled(livenessMode)) { - LivenessUtil::addLivenessRanges(irModule, livenessLocations); + LivenessUtil::addRangeEnds(irModule, livenessMode); #if 0 dumpIRIfEnabled(codeGenContext, irModule, "LIVENESS"); -- cgit v1.2.3