From 61bfb29963fba9a7e8807bdd7ca1c5e5a8b76fec Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 31 May 2021 00:04:17 -0400 Subject: [PATCH] Don't consider discard and return inside uniform control flow --- src/valid/analyzer.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/valid/analyzer.rs b/src/valid/analyzer.rs index ecae2232a..aae5dcdde 100644 --- a/src/valid/analyzer.rs +++ b/src/valid/analyzer.rs @@ -569,7 +569,11 @@ impl FunctionInfo { S::Break | S::Continue => FunctionUniformity::new(), S::Kill => FunctionUniformity { result: Uniformity::new(), - exit: ExitFlags::MAY_KILL, + exit: if disruptor.is_some() { + ExitFlags::MAY_KILL + } else { + ExitFlags::empty() + }, }, S::Barrier(_) => FunctionUniformity { result: Uniformity { @@ -633,8 +637,11 @@ impl FunctionInfo { non_uniform_result: value.and_then(|expr| self.add_ref(expr)), requirements: UniformityRequirements::empty(), }, - //TODO: if we are in the uniform control flow, should this still be an exit flag? - exit: ExitFlags::MAY_RETURN, + exit: if disruptor.is_some() { + ExitFlags::MAY_RETURN + } else { + ExitFlags::empty() + }, }, // Here and below, the used expressions are already emitted, // and their results do not affect the function return value,