Commit 7d36daa8 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Fix a gammel-bug: try_create_Immediate() dropped the negation of...

Fix a gammel-bug: try_create_Immediate() dropped the negation of Minus(Const()). In practice this never occurs, because constant folding folds the Minus.

[r27209]
parent 6191bc0f
...@@ -1022,7 +1022,6 @@ int prevents_AM(ir_node *const block, ir_node *const am_candidate, ...@@ -1022,7 +1022,6 @@ int prevents_AM(ir_node *const block, ir_node *const am_candidate,
ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type) ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type)
{ {
int minus = 0; int minus = 0;
tarval *offset = NULL;
int offset_sign = 0; int offset_sign = 0;
long val = 0; long val = 0;
ir_entity *symconst_ent = NULL; ir_entity *symconst_ent = NULL;
...@@ -1083,7 +1082,9 @@ ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type) ...@@ -1083,7 +1082,9 @@ ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type)
} }
if (cnst != NULL) { if (cnst != NULL) {
offset = get_Const_tarval(cnst); tarval *offset = get_Const_tarval(cnst);
if (offset_sign)
offset = tarval_neg(offset);
if (tarval_is_long(offset)) { if (tarval_is_long(offset)) {
val = get_tarval_long(offset); val = get_tarval_long(offset);
} else { } else {
...@@ -1105,17 +1106,11 @@ ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type) ...@@ -1105,17 +1106,11 @@ ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type)
if (symconst_sign) if (symconst_sign)
return NULL; return NULL;
if (get_SymConst_kind(symconst) != symconst_addr_ent) symconst_ent = get_Global_entity(symconst);
return NULL;
symconst_ent = get_SymConst_entity(symconst);
} }
if (cnst == NULL && symconst == NULL) if (cnst == NULL && symconst == NULL)
return NULL; return NULL;
if (offset_sign && offset != NULL) {
offset = tarval_neg(offset);
}
new_node = ia32_create_Immediate(symconst_ent, symconst_sign, val); new_node = ia32_create_Immediate(symconst_ent, symconst_sign, val);
return new_node; return new_node;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment