aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-12-22 06:15:04 +0000
committerGitHub <noreply@github.com>2020-12-22 06:15:04 +0000
commit2b62b5ef34044ad4dfc8b04713688c78ea541f7c (patch)
tree60f25c7778c763f1b1c023df55a6bdd546a421e5 /passes
parent4949ef124718ead99b4da91da18c17d42c6f373c (diff)
parent9396678db4f0e32192e73697c012d25432d602ca (diff)
downloadyosys-2b62b5ef34044ad4dfc8b04713688c78ea541f7c.tar.gz
yosys-2b62b5ef34044ad4dfc8b04713688c78ea541f7c.tar.bz2
yosys-2b62b5ef34044ad4dfc8b04713688c78ea541f7c.zip
Merge pull request #2498 from StefanBruens/Fix_opt_lut
Fix use-after-free in LUT opt pass
Diffstat (limited to 'passes')
-rw-r--r--passes/opt/opt_lut.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/passes/opt/opt_lut.cc b/passes/opt/opt_lut.cc
index 07a91af8a..623101016 100644
--- a/passes/opt/opt_lut.cc
+++ b/passes/opt/opt_lut.cc
@@ -277,12 +277,13 @@ struct OptLutWorker
module->connect(lut_output, value);
sigmap.add(lut_output, value);
- module->remove(lut);
luts.erase(lut);
luts_arity.erase(lut);
luts_dlogics.erase(lut);
luts_dlogic_inputs.erase(lut);
+ module->remove(lut);
+
eliminated_count++;
if (limit > 0)
limit--;
@@ -493,11 +494,12 @@ struct OptLutWorker
luts_arity[lutM] = lutM_arity;
luts.erase(lutR);
luts_arity.erase(lutR);
- lutR->module->remove(lutR);
worklist.insert(lutM);
worklist.erase(lutR);
+ lutR->module->remove(lutR);
+
combined_count++;
if (limit > 0)
limit--;