Do not propagate mem2reg attribute through to result
authorEddie Hung <eddie@fpgeh.com>
Thu, 22 Aug 2019 23:57:59 +0000 (16:57 -0700)
committerEddie Hung <eddie@fpgeh.com>
Thu, 22 Aug 2019 23:57:59 +0000 (16:57 -0700)
frontends/ast/simplify.cc
tests/various/mem2reg.ys

index 8493aa51397bfe23d2b66c95592527ff33555f99..86dd80c6507964e60ad21a85b011705422c7c9d4 100644 (file)
@@ -151,7 +151,8 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                                        reg->is_reg = true;
                                        reg->is_signed = node->is_signed;
                                        for (auto &it : node->attributes)
-                                               reg->attributes.emplace(it.first, it.second->clone());
+                                               if (it.first != ID(mem2reg))
+                                                       reg->attributes.emplace(it.first, it.second->clone());
                                        reg->filename = node->filename;
                                        reg->linenum = node->linenum;
                                        children.push_back(reg);
index 00389c70008c0687ea0ceb8075920b7da056a05a..85d6267c5985592794f47d385909093ac25013b4 100644 (file)
@@ -11,3 +11,4 @@ proc
 cd top
 select -assert-count 1 m:data1 a:src=<<EOT:4 %i
 select -assert-count 2 w:data2[*] a:src=<<EOT:5 %i
+select -assert-none a:mem2reg