From 85e4e292e4b1f9cbd85e9db9310fbcbc59e3ac23 Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Fri, 30 Nov 2012 13:28:55 +0800 Subject: Fix GCC 4.6 ARM ICE at reload1.c:1061 See http://code.google.com/p/android/issues/detail?id=20862 Disable r172951 in -O0 to fix issue. r172951 optimizes the case when the estimated funciton size is small, all branches in funciton become short jump, ie. the function doesn't contain far jump which clobber register "lr". Unfortunately the estimation may not be correct before register allocation because spill code may increase the function size and invalidate the assumption about whether to save/restore "lr" or not. Fortunately, "lr" is already save/restored when the funciton use r4-r7 or contains spill code. r172951 works because register allocator must exhaust r4-r7 before spill code, so the size estimation when r4-r7 are NOT used is accurate. Unfortunately this isn't the case in -O0 when compiler doesn't use r4-r7 at all yet somehow the size estimation is wrong. Disable it for -O0 r172951 | carrot | 2011-04-26 09:55:33 +0800 (Tue, 26 Apr 2011) | 5 lines * gcc/config/arm/arm.c (SHORTEST_FAR_JUMP_LENGTH): New constant. (estimate_function_length): New function. (thumb_far_jump_used_p): No far jump is needed in short function. Change-Id: I0973d2141787332fc61501fbe76dc7c44c9d1282 --- gcc-4.4.3/gcc/config/arm/arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc-4.4.3') diff --git a/gcc-4.4.3/gcc/config/arm/arm.c b/gcc-4.4.3/gcc/config/arm/arm.c index 054383ca0..bef07e3d1 100644 --- a/gcc-4.4.3/gcc/config/arm/arm.c +++ b/gcc-4.4.3/gcc/config/arm/arm.c @@ -18526,8 +18526,8 @@ thumb_far_jump_used_p (void) /* In reload pass we haven't got the exact jump instruction length, but we can get a reasonable estimation based on the maximum - possible function length. */ - if (!reload_completed) + possible function length. */ + if (optimize && !reload_completed) { int function_length = estimate_function_length(); if (function_length < SHORTEST_FAR_JUMP_LENGTH) -- cgit v1.2.3