On 2016.10.17 at 17:23 -0500, Bill Schmidt wrote: > Hi, > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77916 identifies a situation > where SLSR will ICE when exposed to a cast from integer to pointer. This > is because we try to convert a PLUS_EXPR with an addend of -1 * S into a > MINUS_EXPR with a subtrahend of S, but the base operand is unexpectedly > of pointer type. This patch recognizes when pointer arithmetic is taking > place and ensures that we use a POINTER_PLUS_EXPR at all such times. In > the case of the PR, this occurs in the logic where the stride S is a known > constant value, but the same problem could occur when it is an SSA_NAME > without known value. Both possibilities are handled here. > > Fixing the code to ensure that the unknown stride case always uses an > initializer for a negative increment allows us to remove the stopgap fix > added for PR77937 as well. > > Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no > regressions, committed.
Perhaps you should consider building ffmpeg with -O3 -march=amdfam10 on X86_64 before committing these patches, because you broke it for the third time in the last couple of days. markus@x4 ffmpeg % cat h264dsp.i extern int fn2(int); extern int fn3(int); int a, b, c; void fn1(long p1) { char *d; for (;; d += p1) { d[0] = fn2(1 >> c >> 1); fn2(c >> a); d[1] = fn3(d[1]) >> 1; d[6] = fn3(d[6] * b + 1) >> 1; d[7] = fn3(d[7] * b + 1) >> 1; d[8] = fn3(d[8] * b + 1) >> 1; } } markus@x4 ffmpeg % gcc -O3 -march=amdfam10 -c h264dsp.i h264dsp.i: In function ‘fn1’: h264dsp.i:4:6: internal compiler error: in replace_one_candidate, at gimple-ssa-strength-reduction.c:3375 void fn1(long p1) { ^~~ 0x12773a9 replace_one_candidate ../../gcc/gcc/gimple-ssa-strength-reduction.c:3375 0x127af77 replace_profitable_candidates ../../gcc/gcc/gimple-ssa-strength-reduction.c:3486 0x127aeeb replace_profitable_candidates ../../gcc/gcc/gimple-ssa-strength-reduction.c:3495 0x127f3ee analyze_candidates_and_replace ../../gcc/gcc/gimple-ssa-strength-reduction.c:3574 0x127f3ee execute ../../gcc/gcc/gimple-ssa-strength-reduction.c:3648 -- Markus