When compiling function: void xxx(short* __restrict__ a, short* __restrict__ b) { int i; for (i = 0; i < 8; i++) { a[i] = b[i]; } }
before sched2 we have: (note 13 12 14 3 [bb 3] NOTE_INSN_BASIC_BLOCK) (insn 14 13 15 3 ./a.c:6 (set (reg:SI 2 cx [orig:106 *vect_p.14_18 ] [106]) (mem:SI (reg/v/f:SI 1 dx [orig:103 b ] [103]) [2 *vect_p.14_18+0 S4 A32])) 44 {*movsi_1} (expr_list:REG_EQUIV (mem:SI (reg/v/f:SI 1 dx [orig:103 b ] [103]) [2 *vect_p.14_18+0 S4 A32]) (nil))) (insn 15 14 18 3 ./a.c:6 (set (mem:SI (reg/v/f:SI 0 ax [orig:102 a ] [102]) [2 *vect_p.18_24+0 S4 A32]) (reg:SI 2 cx [orig:106 *vect_p.14_18 ] [106])) 44 {*movsi_1} (expr_list:REG_DEAD (reg:SI 2 cx [orig:106 *vect_p.14_18 ] [106]) (nil))) (insn 18 15 19 3 ./a.c:6 (set (reg:SI 2 cx [orig:107 *vect_p.22_11 ] [107]) (mem:SI (plus:SI (reg/v/f:SI 1 dx [orig:103 b ] [103]) (const_int 4 [0x4])) [2 *vect_p.22_11+0 S4 A32])) 44 {*movsi_1} (expr_list:REG_EQUIV (mem:SI (plus:SI (reg/v/f:SI 1 dx [orig:103 b ] [103]) (const_int 4 [0x4])) [2 *vect_p.22_11+0 S4 A32]) (nil))) (insn 19 18 20 3 ./a.c:6 (set (mem:SI (plus:SI (reg/v/f:SI 0 ax [orig:102 a ] [102]) (const_int 4 [0x4])) [2 *vect_p.27_12+0 S4 A32]) (reg:SI 2 cx [orig:107 *vect_p.22_11 ] [107])) 44 {*movsi_1} (expr_list:REG_DEAD (reg:SI 2 cx [orig:107 *vect_p.22_11 ] [107]) (nil))) insn 15 is a store and 18 is a load from a different location (two different restrict pointers). These insns should not have a dependency between them but we can see in sched2 that they do have: ;; ====================================================== ;; -- basic block 3 from 14 to 62 -- after reload ;; ====================================================== ;; --------------- forward dependences: ------------ ;; --- Region Dependences --- b 3 bb 0 ;; insn code bb dep prio cost reservation ;; ---- ---- -- --- ---- ---- ----------- ;; 14 44 3 0 18 4 decodern,p2 : 62 25 24 23 19 18 15 ;; 15 44 3 1 14 1 decoder0,(p4+p3) : 62 61 24 22 18 ;; 18 44 3 2 14 4 decodern,p2 : 62 24 22 19 ;; 19 44 3 2 10 1 decoder0,(p4+p3) : 62 61 22 ;; 22 44 3 3 10 4 decodern,p2 : 62 24 23 ;; 23 44 3 2 6 1 decoder0,(p4+p3) : 62 61 ;; 24 44 3 4 10 4 decodern,p2 : 62 25 ;; 25 44 3 2 6 1 decoder0,(p4+p3) : 62 61 ;; 61 41 3 4 6 3 decoder0,(p2+(p0|p1)) : 62 ;; 62 477 3 9 6 6 decoder0 : Using built-in specs. COLLECT_GCC=./xgcc Target: i386-elf-linux Configured with: ../gcc-4.6-20100605/configure --target=i386-elf-linux --enable-languages=c Thread model: posix gcc version 4.6.0 20100605 (experimental) (GCC) COLLECT_GCC_OPTIONS='-O3' '-fsched-verbose=10' '-fno-ivopts' '-fdump-rtl-all' '-v' '-save-temps' '-mtune=i386' '-march=i386' cc1 -E -quiet -v -iprefix ./../lib/gcc/i386-elf-linux/4.6.0/ ./a.c -mtune=i386 -march=i386 -fsched-verbose=10 -fno-ivopts -fdump-rtl-all -O3 -fpch-preprocess -o a.i ignoring nonexistent directory "./../lib/gcc/i386-elf-linux/4.6.0/include" ignoring nonexistent directory "./../lib/gcc/i386-elf-linux/4.6.0/include-fixed" ignoring nonexistent directory "./../lib/gcc/i386-elf-linux/4.6.0/../../../../i386-elf-linux/sys-include" ignoring nonexistent directory "./../lib/gcc/i386-elf-linux/4.6.0/../../../../i386-elf-linux/include" ignoring nonexistent directory "./../lib/gcc/../../lib/gcc/i386-elf-linux/4.6.0/include" ignoring nonexistent directory "./../lib/gcc/../../lib/gcc/i386-elf-linux/4.6.0/include-fixed" ignoring nonexistent directory "./../lib/gcc/../../lib/gcc/i386-elf-linux/4.6.0/../../../../i386-elf-linux/sys-include" ignoring nonexistent directory "./../lib/gcc/../../lib/gcc/i386-elf-linux/4.6.0/../../../../i386-elf-linux/include" #include "..." search starts here: #include <...> search starts here: End of search list. COLLECT_GCC_OPTIONS='-O3' '-fsched-verbose=10' '-fno-ivopts' '-fdump-rtl-all' '-v' '-save-temps' '-mtune=i386' '-march=i386' cc1 -fpreprocessed a.i -quiet -dumpbase a.c -mtune=i386 -march=i386 -auxbase a -O3 -version -fsched-verbose=10 -fno-ivopts -fdump-rtl-all -o a.s GNU C (GCC) version 4.6.0 20100605 (experimental) (i386-elf-linux) compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-44), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C (GCC) version 4.6.0 20100605 (experimental) (i386-elf-linux) compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-44), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 70c36ceb949c29da0fad8309ce635380 COLLECT_GCC_OPTIONS='-O3' '-fsched-verbose=10' '-fno-ivopts' '-fdump-rtl-all' '-v' '-save-temps' '-mtune=i386' '-march=i386' as -V -Qy --32 -o a.o a.s GNU assembler version 2.17.50.0.6-9.el5 (x86_64-redhat-linux) using BFD version 2.17.50.0.6-9.el5 20061020 COMPILER_PATH= LIBRARY_PATH= COLLECT_GCC_OPTIONS='-O3' '-fsched-verbose=10' '-fno-ivopts' '-fdump-rtl-all' '-v' '-save-temps' '-mtune=i386' '-march=i386' ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 crt1.o crti.o crtbegin.o a.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh crtend.o crtn.o -- Summary: false dependencies are computed after vectorization Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: roy dot 1rosen at gmail dot com GCC build triplet: elf GCC host triplet: linux GCC target triplet: i386 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44479