projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
11514f0
)
prefer arithmethic over pointer constants
author
Michael Beck
<beck@ipd.info.uni-karlsruhe.de>
Thu, 29 Jun 2006 09:50:59 +0000
(09:50 +0000)
committer
Michael Beck
<beck@ipd.info.uni-karlsruhe.de>
Thu, 29 Jun 2006 09:50:59 +0000
(09:50 +0000)
[r7963]
ir/opt/reassoc.c
patch
|
blob
|
history
diff --git
a/ir/opt/reassoc.c
b/ir/opt/reassoc.c
index
3b33024
..
b0144db
100644
(file)
--- a/
ir/opt/reassoc.c
+++ b/
ir/opt/reassoc.c
@@
-87,8
+87,20
@@
static void get_comm_Binop_ops(ir_node *binop, ir_node **a, ir_node **c)
assert(is_op_commutative(get_irn_op(binop)));
switch (class_a + 2*class_b) {
assert(is_op_commutative(get_irn_op(binop)));
switch (class_a + 2*class_b) {
- case REAL_CONSTANT + 2*NO_CONSTANT:
case REAL_CONSTANT + 2*REAL_CONSTANT:
case REAL_CONSTANT + 2*REAL_CONSTANT:
+ /* if both are constants, one might be a
+ * pointer constant like NULL, return the other
+ */
+ if (mode_is_reference(get_irn_mode(op_a))) {
+ *a = op_a;
+ *c = op_b;
+ }
+ else {
+ *a = op_b;
+ *c = op_a;
+ }
+ break;
+ case REAL_CONSTANT + 2*NO_CONSTANT:
case REAL_CONSTANT + 2*REGION_CONST:
case REGION_CONST + 2*NO_CONSTANT:
*a = op_b;
case REAL_CONSTANT + 2*REGION_CONST:
case REGION_CONST + 2*NO_CONSTANT:
*a = op_b;