projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a158947
)
Fixed local optimization.
author
Sebastian Buchwald
<Sebastian.Buchwald@kit.edu>
Wed, 28 Sep 2011 04:26:13 +0000
(06:26 +0200)
committer
Sebastian Buchwald
<Sebastian.Buchwald@kit.edu>
Wed, 28 Sep 2011 04:30:40 +0000
(06:30 +0200)
The transformation (a << c1) | c2 => (a | (c2 >> c1)) << c1
is only valid if the lower bits of c2 are clean.
This fixes opt/pr37102.c.
ir/ir/iropt.c
patch
|
blob
|
history
diff --git
a/ir/ir/iropt.c
b/ir/ir/iropt.c
index
ba9a141
..
bd58883
100644
(file)
--- a/
ir/ir/iropt.c
+++ b/
ir/ir/iropt.c
@@
-3108,6
+3108,14
@@
static ir_node *transform_node_bitop_shift(ir_node *n)
if (is_Shl(left)) {
tv_bitop = tarval_shr(tv2, tv1);
+
+ /* Check whether we have lost some bits during the right shift. */
+ if (is_Or(n) || is_Eor(n)) {
+ ir_tarval *tv_back_again = tarval_shl(tv_bitop, tv1);
+
+ if (tarval_cmp(tv_back_again, tv2) != ir_relation_equal)
+ return n;
+ }
} else if (is_Shr(left)) {
if (is_Or(n) || is_Eor(n)) {
/*