diff options
| author | Clifford Wolf <clifford@clifford.at> | 2019-03-12 20:09:47 +0100 | 
|---|---|---|
| committer | Clifford Wolf <clifford@clifford.at> | 2019-03-12 20:09:47 +0100 | 
| commit | ab5b50ae3c9e63fe3da3ae0451500c1cb5be1743 (patch) | |
| tree | 05799d46025b2486c4b6e51f8054b52d6f04fcfa | |
| parent | ef48b62cb1206a3b72c00735fe817683ccf0f005 (diff) | |
| download | yosys-ab5b50ae3c9e63fe3da3ae0451500c1cb5be1743.tar.gz yosys-ab5b50ae3c9e63fe3da3ae0451500c1cb5be1743.tar.bz2 yosys-ab5b50ae3c9e63fe3da3ae0451500c1cb5be1743.zip  | |
Only set MEM2REG_FL_CONST_LHS/MEM2REG_FL_VAR_LHS for non-init writes, fixes #867
Signed-off-by: Clifford Wolf <clifford@clifford.at>
| -rw-r--r-- | frontends/ast/simplify.cc | 14 | 
1 files changed, 8 insertions, 6 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index ae7dec88d..f747a07cd 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -2954,12 +2954,14 @@ void AstNode::mem2reg_as_needed_pass1(dict<AstNode*, pool<std::string>> &mem2reg  				proc_flags[mem] |= AstNode::MEM2REG_FL_EQ1;  			} -			// remember if this is a constant index or not -			if (children[0]->children.size() && children[0]->children[0]->type == AST_RANGE && children[0]->children[0]->children.size()) { -				if (children[0]->children[0]->children[0]->type == AST_CONSTANT) -					mem2reg_candidates[mem] |= AstNode::MEM2REG_FL_CONST_LHS; -				else -					mem2reg_candidates[mem] |= AstNode::MEM2REG_FL_VAR_LHS; +			// for proper (non-init) writes: remember if this is a constant index or not +			if ((flags & MEM2REG_FL_INIT) == 0) { +				if (children[0]->children.size() && children[0]->children[0]->type == AST_RANGE && children[0]->children[0]->children.size()) { +					if (children[0]->children[0]->children[0]->type == AST_CONSTANT) +						mem2reg_candidates[mem] |= AstNode::MEM2REG_FL_CONST_LHS; +					else +						mem2reg_candidates[mem] |= AstNode::MEM2REG_FL_VAR_LHS; +				}  			}  			// remember where this is  | 
