[PATCH] Don't combine across likely spilled hard reg setters (PR rtl-optimization/59477)

Jakub Jelinek jakub@redhat.com
Thu Jan 16 08:27:00 GMT 2014


On Thu, Jan 16, 2014 at 03:41:57AM +0000, Joern Rennecke wrote:
> On 15 January 2014 21:55, Jakub Jelinek <jakub@redhat.com> wrote:
> ...
> > The patch removes the likely_spilled_retval stuff Joern wrote a few years
> > ago because I believe this change should obsolete that.  But, have tried to
> > reproduce the ICE using sh-elf target and haven't managed to do so, 4.9 is
> > quite a different compiler from 2005-ish gcc.
> 
> You wouldn't see an ICE, but wrong-code.

I've mistyped it above, yeah, I was looking with your functions reverted
and without the rest of my patch if combiner would even attempt to combine
something into the second insn (loading fr1, after the fr0 set) and that
didn't happen on the trunk.

> That being said, it sounds like your case 2) should handle this.

Anyway, for all the changed *.o files I've done:
for i in `cat /tmp/M1`; do readelf -Ws $i | awk '($4=="FUNC" && $7!="UND"){print $8" "$3}' | sort > /tmp/1; readelf -Ws ../obj877/$i | awk '($4=="FUNC" && $7!="UND"){print $8" "$3}' | sort > /tmp/2; j=`cat /tmp/1 | wc -l`; k=`diff -up /tmp/1 /tmp/2 | grep -v '^+++' | grep '^+' | wc -l`; echo $i $k/$j; done
to see how many functions in those files actually changed because of this
patch and the numbers are below.  The numbers are smaller though, because
it only looks at function sizes, there could be code generation change even
in function that has the same size (e.g. if later alignment makes the
change not visible in the size).  For x86_64, the sums are that
5384 functions out of the 43856 symbols (in these ~ 8% of all *.o files)
changed function size.  That still looks like a big change.

I wonder if instead of not creating the LOG_LINKS we could just somehow taint
them, add a flag to struct insn_link that we need to be careful about
combining across that link, then in combine_instructions or the flags together
from all the used links and if try_combine is called with this
crosses_likely_spilled_setter_p
flag, if recog accepts the result look at all constraints on all operands of the
new insn and if for any constraint anywhere REG_CLASS_FROM_CONSTRAINT is likely
spilled, punt.  Thoughts on if this could be reliable?

i686:
gcc/builtins.o 0/201
gcc/gimple-fold.o 1/71
gcc/tree-sra.o 1/124
gcc/tree-ssa-structalias.o 0/164
gcc/tree-vect-stmts.o 0/128
gcc/tree-vrp.o 0/172
gcc/cp/error.o 0/61
i686-pc-linux-gnu/libcilkrts/.libs/cilk-abi-cilk-for.o 0/16
x86_64:
gcc/builtins.o 0/195
gcc/cfgexpand.o 0/112
gcc/cfghooks.o 0/56
gcc/cgraphunit.o 1/30
gcc/df-core.o 1/82
gcc/final.o 2/89
gcc/fold-const.o 1/144
gcc/ggc-common.o 2/45
gcc/gimple-fold.o 0/70
gcc/gimple-pretty-print.o 1/74
gcc/godump.o 3/18
gcc/haifa-sched.o 3/162
gcc/i386.o 1/500
gcc/ipa-inline.o 0/46
gcc/opts-common.o 1/18
gcc/opts.o 1/17
gcc/passes.o 7/120
gcc/reg-stack.o 0/44
gcc/sched-rgn.o 1/86
gcc/sel-sched-ir.o 1/238
gcc/toplev.o 0/27
gcc/tree-eh.o 0/138
gcc/tree-inline.o 1/111
gcc/tree-sra.o 1/121
gcc/tree-ssa-live.o 0/45
gcc/tree-ssa-phiprop.o 0/24
gcc/tree-ssa-sccvn.o 0/119
gcc/tree-ssa-structalias.o 0/165
gcc/tree-vect-stmts.o 1/129
gcc/tree-vrp.o 1/176
gcc/varasm.o 2/196
gcc/ada/ali-util.o 1/111
gcc/ada/errout.o 1/86
gcc/ada/lib-xref.o 1/93
gcc/ada/urealp.o 2/88
gcc/ada/utils.o 0/141
gcc/build/read-rtl.o 2/23
gcc/c/c-decl.o 1/160
gcc/c/c-objc-common.o 1/8
gcc/c-family/c-opts.o 0/20
gcc/c-family/c-pch.o 1/8
gcc/cp/cp-objcp-common.o 1/15
gcc/cp/optimize.o 0/6
gcc/fortran/expr.o 1/72
gcc/fortran/intrinsic.o 0/44
gcc/fortran/scanner.o 1/47
gcc/go/expressions.o 81/765
gcc/go/gogo.o 14/351
gcc/go/gogo-tree.o 5/64
gcc/go/go.o 1/6
gcc/go/import-archive.o 1/24
gcc/go/import.o 1/47
gcc/go/parse.o 4/148
gcc/go/runtime.o 3/11
gcc/go/statements.o 21/402
gcc/go/types.o 31/566
gcc/go/unsafe.o 0/5
x86_64-unknown-linux-gnu/boehm-gc/.libs/finalize.o 2/23
x86_64-unknown-linux-gnu/boehm-gc/.libs/pthread_support.o 3/36
x86_64-unknown-linux-gnu/boehm-gc/.libs/ptr_chck.o 1/9
x86_64-unknown-linux-gnu/libcilkrts/.libs/cilk-abi-cilk-for.o 2/15
x86_64-unknown-linux-gnu/libcilkrts/.libs/cilk_fiber-unix.o 0/15
x86_64-unknown-linux-gnu/libgfortran/.libs/environ.o 2/18
x86_64-unknown-linux-gnu/libgfortran/.libs/file_pos.o 1/4
x86_64-unknown-linux-gnu/libgfortran/.libs/inquire.o 1/2
x86_64-unknown-linux-gnu/libgfortran/.libs/intrinsics.o 2/34
x86_64-unknown-linux-gnu/libgfortran/.libs/list_read.o 1/22
x86_64-unknown-linux-gnu/libgfortran/.libs/open.o 2/4
x86_64-unknown-linux-gnu/libgfortran/.libs/transfer.o 3/49
x86_64-unknown-linux-gnu/libgfortran/.libs/unit.o 1/19
x86_64-unknown-linux-gnu/libgfortran/.libs/unix.o 1/60
x86_64-unknown-linux-gnu/libgo/.libs/bufio.o 1/70
x86_64-unknown-linux-gnu/libgo/.libs/bytes.o 2/87
x86_64-unknown-linux-gnu/libgo/.libs/expvar.o 0/49
x86_64-unknown-linux-gnu/libgo/.libs/flag.o 4/94
x86_64-unknown-linux-gnu/libgo/.libs/fmt.o 8/159
x86_64-unknown-linux-gnu/libgo/.libs/image.o 2/132
x86_64-unknown-linux-gnu/libgo/.libs/io.o 2/44
x86_64-unknown-linux-gnu/libgo/.libs/malloc.o 0/19
x86_64-unknown-linux-gnu/libgo/.libs/net.o 32/533
x86_64-unknown-linux-gnu/libgo/.libs/os.o 4/135
x86_64-unknown-linux-gnu/libgo/.libs/proc.o 1/92
x86_64-unknown-linux-gnu/libgo/.libs/reflect-go.o 22/458
x86_64-unknown-linux-gnu/libgo/.libs/regexp.o 2/98
x86_64-unknown-linux-gnu/libgo/.libs/runtime-go.o 0/32
x86_64-unknown-linux-gnu/libgo/.libs/sort.o 3/42
x86_64-unknown-linux-gnu/libgo/.libs/strconv.o 1/74
x86_64-unknown-linux-gnu/libgo/.libs/strings.o 3/89
x86_64-unknown-linux-gnu/libgo/.libs/sync.o 1/23
x86_64-unknown-linux-gnu/libgo/.libs/testing.o 0/104
x86_64-unknown-linux-gnu/libgomp/.libs/task.o 0/12
x86_64-unknown-linux-gnu/libitm/.libs/beginend.o 1/21
x86_64-unknown-linux-gnu/libitm/.libs/method-serial.o 1/240
x86_64-unknown-linux-gnu/libitm/.libs/retry.o 3/7
x86_64-unknown-linux-gnu/libitm/.libs/useraction.o 1/5
x86_64-unknown-linux-gnu/libjava/.libs/defineclass.o 0/46
x86_64-unknown-linux-gnu/libjava/.libs/gnu-CORBA.o 492/1766
x86_64-unknown-linux-gnu/libjava/.libs/gnu-java-awt-dnd-peer-gtk.o 7/32
x86_64-unknown-linux-gnu/libjava/.libs/gnu-java-awt-peer-gtk.o 242/1138
x86_64-unknown-linux-gnu/libjava/.libs/gnu-java-awt-peer-swing.o 92/325
x86_64-unknown-linux-gnu/libjava/.libs/gnu-java-beans.o 92/474
x86_64-unknown-linux-gnu/libjava/.libs/gnu-java-lang-management.o 25/131
x86_64-unknown-linux-gnu/libjava/.libs/gnu-javax-management.o 20/64
x86_64-unknown-linux-gnu/libjava/.libs/gnu-javax-rmi.o 53/124
x86_64-unknown-linux-gnu/libjava/.libs/gnu-javax-sound-midi.o 18/207
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-aelfred2.o 40/229
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-dom.o 158/1328
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-libxmlj.o 60/468
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-pipeline.o 52/298
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-stream.o 127/559
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-transform.o 86/396
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-util.o 39/203
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-validation.o 67/504
x86_64-unknown-linux-gnu/libjava/.libs/gnu-xml-xpath.o 64/374
x86_64-unknown-linux-gnu/libjava/.libs/java-lang-management.o 12/68
x86_64-unknown-linux-gnu/libjava/.libs/javax-imageio.o 142/742
x86_64-unknown-linux-gnu/libjava/.libs/javax-rmi.o 4/49
x86_64-unknown-linux-gnu/libjava/.libs/javax-xml.o 32/350
x86_64-unknown-linux-gnu/libjava/.libs/jni.o 1/303
x86_64-unknown-linux-gnu/libjava/.libs/jvmti.o 8/68
x86_64-unknown-linux-gnu/libjava/.libs/link.o 8/39
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-CORBA_2_3.o 2/24
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-CORBA.o 122/898
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-CosNaming.o 34/323
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-DynamicAny.o 25/631
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-IOP.o 14/149
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-Messaging.o 2/7
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-PortableInterceptor.o 21/155
x86_64-unknown-linux-gnu/libjava/.libs/org-omg-PortableServer.o 31/239
x86_64-unknown-linux-gnu/libjava/.libs/org-relaxng.o 5/35
x86_64-unknown-linux-gnu/libjava/.libs/org-w3c.o 2/25
x86_64-unknown-linux-gnu/libjava/.libs/org-xml.o 37/296
x86_64-unknown-linux-gnu/libjava/.libs/posix-threads.o 2/21
x86_64-unknown-linux-gnu/libjava/.libs/prims.o 3/75
x86_64-unknown-linux-gnu/libjava/.libs/stacktrace.o 1/20
x86_64-unknown-linux-gnu/libjava/.libs/verify.o 1/36
x86_64-unknown-linux-gnu/32/libcilkrts/.libs/cilk-abi-cilk-for.o 1/16
x86_64-unknown-linux-gnu/libffi/src/.libs/closures.o 1/11
x86_64-unknown-linux-gnu/libgo/archive/.libs/tar.o 1/41
x86_64-unknown-linux-gnu/libgo/archive/.libs/zip.o 5/77
x86_64-unknown-linux-gnu/libgo/compress/.libs/flate.o 3/90
x86_64-unknown-linux-gnu/libgo/compress/.libs/gzip.o 5/16
x86_64-unknown-linux-gnu/libgo/compress/.libs/lzw.o 1/22
x86_64-unknown-linux-gnu/libgo/compress/.libs/zlib.o 4/15
x86_64-unknown-linux-gnu/libgo/container/.libs/heap.o 4/7
x86_64-unknown-linux-gnu/libgo/crypto/.libs/cipher.o 7/42
x86_64-unknown-linux-gnu/libgo/crypto/.libs/ecdsa.o 3/22
x86_64-unknown-linux-gnu/libgo/crypto/.libs/elliptic.o 0/67
x86_64-unknown-linux-gnu/libgo/crypto/.libs/hmac.o 3/8
x86_64-unknown-linux-gnu/libgo/crypto/.libs/rsa.o 4/23
x86_64-unknown-linux-gnu/libgo/crypto/.libs/tls.o 20/175
x86_64-unknown-linux-gnu/libgo/crypto/.libs/x509.o 1/63
x86_64-unknown-linux-gnu/libgo/database/.libs/sql.o 13/135
x86_64-unknown-linux-gnu/libgo/debug/.libs/dwarf.o 8/163
x86_64-unknown-linux-gnu/libgo/debug/.libs/elf.o 0/104
x86_64-unknown-linux-gnu/libgo/debug/.libs/macho.o 0/41
x86_64-unknown-linux-gnu/libgo/debug/.libs/pe.o 0/25
x86_64-unknown-linux-gnu/libgo/encoding/.libs/asn1.o 3/60
x86_64-unknown-linux-gnu/libgo/encoding/.libs/binary.o 2/51
x86_64-unknown-linux-gnu/libgo/encoding/.libs/gob.o 23/223
x86_64-unknown-linux-gnu/libgo/encoding/.libs/hex.o 1/15
x86_64-unknown-linux-gnu/libgo/encoding/.libs/json.o 10/178
x86_64-unknown-linux-gnu/libgo/encoding/.libs/pem.o 1/10
x86_64-unknown-linux-gnu/libgo/encoding/.libs/xml.o 10/112
x86_64-unknown-linux-gnu/libgo/exp/.libs/proxy.o 1/21
x86_64-unknown-linux-gnu/libgo/go/.libs/ast.o 33/301
x86_64-unknown-linux-gnu/libgo/go/.libs/build.o 3/40
x86_64-unknown-linux-gnu/libgo/go/.libs/doc.o 0/76
x86_64-unknown-linux-gnu/libgo/go/.libs/format.o 1/4
x86_64-unknown-linux-gnu/libgo/go/.libs/parser.o 4/172
x86_64-unknown-linux-gnu/libgo/go/.libs/printer.o 6/69
x86_64-unknown-linux-gnu/libgo/go/.libs/scanner.o 1/37
x86_64-unknown-linux-gnu/libgo/go/.libs/token.o 1/43
x86_64-unknown-linux-gnu/libgo/html/.libs/template.o 5/125
x86_64-unknown-linux-gnu/libgo/image/.libs/color.o 10/25
x86_64-unknown-linux-gnu/libgo/image/.libs/draw.o 2/12
x86_64-unknown-linux-gnu/libgo/image/.libs/gif.o 3/28
x86_64-unknown-linux-gnu/libgo/image/.libs/jpeg.o 2/42
x86_64-unknown-linux-gnu/libgo/image/.libs/png.o 4/28
x86_64-unknown-linux-gnu/libgo/log/.libs/syslog.o 2/25
x86_64-unknown-linux-gnu/libgo/math/.libs/big.o 2/138
x86_64-unknown-linux-gnu/libgo/math/.libs/cmplx.o 0/29
x86_64-unknown-linux-gnu/libgo/math/.libs/rand.o 2/43
x86_64-unknown-linux-gnu/libgo/net/.libs/http.o 25/377
x86_64-unknown-linux-gnu/libgo/net/.libs/rpc.o 13/92
x86_64-unknown-linux-gnu/libgo/net/.libs/smtp.o 2/34
x86_64-unknown-linux-gnu/libgo/net/.libs/textproto.o 1/72
x86_64-unknown-linux-gnu/libgo/net/.libs/url.o 1/37
x86_64-unknown-linux-gnu/libgo/old/.libs/regexp.o 1/99
x86_64-unknown-linux-gnu/libgo/old/.libs/template.o 4/53
x86_64-unknown-linux-gnu/libgo/os/.libs/exec.o 4/75
x86_64-unknown-linux-gnu/libgo/path/.libs/filepath.o 2/30
x86_64-unknown-linux-gnu/libgo/runtime/.libs/pprof.o 1/49
x86_64-unknown-linux-gnu/libgo/testing/.libs/quick.o 2/15
x86_64-unknown-linux-gnu/libgo/text/.libs/scanner.o 0/28
x86_64-unknown-linux-gnu/libgo/text/.libs/template.o 7/147
x86_64-unknown-linux-gnu/libjava/gnu/.libs/awt.o 1/4
x86_64-unknown-linux-gnu/libjava/gnu/.libs/classpath.o 3/34
x86_64-unknown-linux-gnu/libjava/java/.libs/applet.o 5/34
x86_64-unknown-linux-gnu/libjava/java/.libs/awt.o 392/2163
x86_64-unknown-linux-gnu/libjava/java/.libs/beans.o 26/259
x86_64-unknown-linux-gnu/libjava/java/.libs/io.o 100/893
x86_64-unknown-linux-gnu/libjava/java/.libs/lang.o 37/1127
x86_64-unknown-linux-gnu/libjava/java/.libs/math.o 27/195
x86_64-unknown-linux-gnu/libjava/java/.libs/net.o 111/557
x86_64-unknown-linux-gnu/libjava/java/.libs/nio.o 38/517
x86_64-unknown-linux-gnu/libjava/java/.libs/process-Posix.o 1/20
x86_64-unknown-linux-gnu/libjava/java/.libs/rmi.o 2/46
x86_64-unknown-linux-gnu/libjava/java/.libs/security.o 77/433
x86_64-unknown-linux-gnu/libjava/java/.libs/sql.o 7/83
x86_64-unknown-linux-gnu/libjava/java/.libs/text.o 96/485
x86_64-unknown-linux-gnu/libjava/java/.libs/util.o 236/2270
x86_64-unknown-linux-gnu/libjava/javax/.libs/accessibility.o 7/61
x86_64-unknown-linux-gnu/libjava/javax/.libs/activation.o 19/155
x86_64-unknown-linux-gnu/libjava/javax/.libs/crypto.o 27/179
x86_64-unknown-linux-gnu/libjava/javax/.libs/management.o 72/394
x86_64-unknown-linux-gnu/libjava/javax/.libs/naming.o 46/229
x86_64-unknown-linux-gnu/libjava/javax/.libs/print.o 10/53
x86_64-unknown-linux-gnu/libjava/javax/.libs/swing.o 1159/3899
x86_64-unknown-linux-gnu/libjava/libltdl/.libs/ltdl.o 9/56
x86_64-unknown-linux-gnu/libjava/sun/.libs/misc.o 1/7
x86_64-unknown-linux-gnu/libsanitizer/asan/.libs/asan_interceptors.o 0/1142
x86_64-unknown-linux-gnu/libsanitizer/sanitizer_common/.libs/sanitizer_thread_registry.o 0/35
x86_64-unknown-linux-gnu/libsanitizer/tsan/.libs/tsan_interceptors.o 0/1352
x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/compatibility.o 30/140

	Jakub



More information about the Gcc-patches mailing list