This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/48583] New: Mismatch between CFG and IR after cfglayout
- From: "eraman at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Apr 2011 23:48:27 +0000
- Subject: [Bug rtl-optimization/48583] New: Mismatch between CFG and IR after cfglayout
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48583
Summary: Mismatch between CFG and IR after cfglayout
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: eraman@google.com
Created attachment 23970
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23970
RTL dump after into_cfglayout pass.
With gcc built from trunk revision 20110404,
$ trunk_gcc -O2 gcc/testsuite/g++.dg/opt/nrv5.C -fdump-rtl-all-all
In nrv5.C.149r.into_cfglayout, function 'void test(bool)' (_Z4testb) has the
following snippet:
;; Start of basic block ( 2) -> 4
;; Pred edge 2 [39.0%] (fallthru)
(note 9 8 11 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(many RTL instructions)
(insn 37 36 40 4 (set (mem/s/j/c:QI (plus:DI (reg/f:DI 20 frame)
(const_int -16 [0xfffffffffffffff0])) [0+0 S1 A64])
(reg:QI 82)) nrv5.C:39 66 {*movqi_internal}
(nil))
;; End of basic block 4 -> ( 6)
;; Succ edge 6 [100.0%] (fallthru)
;; Start of basic block ( 2) -> 5
;; Pred edge 2 [61.0%]
(code_label 40 37 41 5 21 "" [1 uses])
(note 41 40 43 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
The last instruction in bb 4 is insn 37, which is not a jump. The successor
edge of bb 5 is 6 and is labeled a fallthru. But note that bb 5, and not bb 6,
follows insn 37.
In nrv5.C.148r.vregs, insn 37 is followed by a jump_insn which jumps to bb 6.
The problem seems to be in try_redirect_by_replacing_jump in cfgrtl.c when
called from try_optimize_cfg in cfgcleanup.c. That seems to delete the jump
even though the successor edge is not a fallthru.