From 8145c6bca7a1f80d7ce2e1a21b8e83def04ec74c Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Sun, 26 Feb 2023 00:25:33 -0800 Subject: [PATCH] Bugfix to localify: properly handle workqueue dedup (actually remove from set when popping from queue) --- src/backend/localify.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/localify.rs b/src/backend/localify.rs index 9050355..2770575 100644 --- a/src/backend/localify.rs +++ b/src/backend/localify.rs @@ -100,12 +100,13 @@ impl<'a, V: Visitor> BlockVisitor<'a, V> { self.visit_use(arg); } } - // Otherwise, it may be an alias (but resolved above) or - // PickOutput, which we "see through" in handle_use of - // consumers. } fn visit_use(&mut self, value: Value) { let value = self.body.resolve_alias(value); + if let ValueDef::PickOutput(value, _, _) = self.body.values[value] { + self.visit_use(value); + return; + } if self.trees.owner.contains_key(&value) { // If this is a treeified value, then don't process the use, // but process the instruction directly here. @@ -154,6 +155,7 @@ impl<'a> Context<'a> { let mut workqueue: Vec = self.cfg.rpo.values().cloned().collect(); let mut workqueue_set: HashSet = workqueue.iter().cloned().collect(); while let Some(block) = workqueue.pop() { + workqueue_set.remove(&block); let live = self.block_end_live[block].clone(); let mut visitor = BlockVisitor::new(self.body, self.trees, LivenessVisitor { live }); visitor.visit_block(block);