aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/stmt.c16
2 files changed, 13 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9544c3c..aea6f59 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-20 Jan Hubicka <jh@suse.cz>
+
+ * stmt.c (lshift_cheap_p): Support properly optimize_insn_for_speed_p.
+
2010-11-20 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR other/46202
diff --git a/gcc/stmt.c b/gcc/stmt.c
index e045330..b376da0 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -2122,19 +2122,21 @@ struct case_bit_test
static
bool lshift_cheap_p (void)
{
- static bool init = false;
- static bool cheap = true;
+ static bool init[2] = {false, false};
+ static bool cheap[2] = {true, true};
- if (!init)
+ bool speed_p = optimize_insn_for_speed_p ();
+
+ if (!init[speed_p])
{
rtx reg = gen_rtx_REG (word_mode, 10000);
int cost = rtx_cost (gen_rtx_ASHIFT (word_mode, const1_rtx, reg), SET,
- optimize_insn_for_speed_p ());
- cheap = cost < COSTS_N_INSNS (3);
- init = true;
+ speed_p);
+ cheap[speed_p] = cost < COSTS_N_INSNS (3);
+ init[speed_p] = true;
}
- return cheap;
+ return cheap[speed_p];
}
/* Comparison function for qsort to order bit tests by decreasing