RFC: --enable-checking=valgrind.

Jan Hubicka jh@suse.cz
Wed Nov 13 05:32:00 GMT 2002


> On Tue, 12 Nov 2002, Jan Hubicka wrote:
> > > On Mon, Nov 11, 2002 at 04:55:17AM -0500, Hans-Peter Nilsson wrote:
> > > > ==5784== Conditional jump or move depends on uninitialised value(s)
> > > > ==5784==    at 0x81EE503: get_attr_prefix_0f (insn-attrtab.c:23298)
> 
> > > Hmm.  This is probabably just one bug, in genattrtab, but genattrtab
> > > is such a mess I don't know where to begin looking.
> > It is probably bug in the machine description.
> > We use type information to figure out how many arguments instruction
> > have.
> > In case it has fewer arugments, we access uninitialized memory that
> > "usually works :)".  If you will just go to gdb and do "p debug_rtx (insn)"
> > I think I can fix the bugs easilly.
> 
> Hum, as I said I was just soliciting feedback about whether this
> feature would be useful at all, and would then rather get the
> patch into shape to be applied so people can do this by
> themselves.  But since you think it's useful and Zack dives into
> reviewing the details, I guess it is, and it's time to shape up
> the damn patch. :-)
> 
> It'll take a week to run regression tests, so I hope I can just
> settle for a successful bootstrap & check without
> --enable-checking=valgrind and a successful bootstrap with it.
> Bootstrap hasn't even finished compiling the java libs.  Maybe I
> can get a "discount", to just need --enable-languages=c.
> 
> Here's the insn in get_attr_prefix_0f for the first trigging call
> when, with a suitable --save-temps, doing
> valgrind  --num-callers=20 --gdb-attach=yes ./stage1/cc1
>  -fpreprocessed libgcc2.i -quiet -dumpbase libgcc2.c
>  -auxbase-strip /tmp/bb.s -g -O2 -W -Wall  -Wwrite-strings
>  -Wstrict-prototypes -Wmissing-prototypes -version -fPIC -o /tmp/bb.s
> (I can't seem to get useful debug info out of the bootstrapped
> cc1, using gdb-5.2.1)
> 
> Please excuse the line-wrapping.
> 
> (jump_insn:HI 22 285 36 0x4176ba50 (set (pc)
>         (if_then_else (lt (reg:CCGOC 17 flags)
>                 (const_int 0 [0x0]))
>             (label_ref 295)
>             (pc))) 509 {*jcc_1} (insn_list:REG_DEP_ANTI 268 (insn_list:REG_DEP_ANTI 263 (insn_list:REG_DEP_ANTI 264
> (insn_list:REG_DEP_ANTI 5 (insn_list:REG_DEP_ANTI 208 (insn_list:REG_DEP_ANTI 209 (insn_list:REG_DEP_ANTI 284 (insn_list 285
> (insn_list:REG_DEP_ANTI 267 (insn_list:REG_DEP_ANTI 269 (insn_list:REG_DEP_ANTI 270 (insn_list:REG_DEP_ANTI 271 (insn_list:REG_DEP_ANTI 265
> (insn_list:REG_DEP_ANTI 266 (insn_list:REG_DEP_ANTI 226 (nil))))))))))))))))
>     (expr_list:REG_DEAD (reg:CCGOC 17 flags)
>         (expr_list:REG_BR_PROB (const_int 2100 [0x834])
>             (nil))))
> 
> the same insn also trigs later, for a total of three
> indications.
Hi,
here is patch for that.  It is interesting pass ordering problem :)
Hope it will reduce "many" into at least "half many"

Honza

Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.401
diff -c -3 -p -r1.401 i386.md
*** i386.md	31 Oct 2002 15:21:22 -0000	1.401
--- i386.md	13 Nov 2002 13:30:05 -0000
***************
*** 187,199 ****
  	   (if_then_else (match_operand 1 "constant_call_address_operand" "")
  	     (const_int 4)
  	     (const_int 0))
  	 (eq_attr "type" "ibr")
! 	   (if_then_else (and (ge (minus (match_dup 0) (pc))
! 				  (const_int -128))
! 			      (lt (minus (match_dup 0) (pc))
! 				  (const_int 124)))
! 	     (const_int 1)
! 	     (const_int 4))
  	 ]
  	 (symbol_ref "/* Update immediate_length and other attributes! */
  		      abort(),1")))
--- 187,196 ----
  	   (if_then_else (match_operand 1 "constant_call_address_operand" "")
  	     (const_int 4)
  	     (const_int 0))
+ 	 ;; We don't know the size before shorten_branches.  Optimisitically
+ 	 ;; expect the instruction to fit for better scheduling.
  	 (eq_attr "type" "ibr")
! 	   (const_int 1)
  	 ]
  	 (symbol_ref "/* Update immediate_length and other attributes! */
  		      abort(),1")))
***************
*** 12837,12849 ****
    "%+j%C1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "prefix_0f")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 0)
! 	     (const_int 1)))])
  
  (define_insn "*jcc_2"
    [(set (pc)
--- 12834,12846 ----
    "%+j%C1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "length")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 2)
! 	     (const_int 6)))])
  
  (define_insn "*jcc_2"
    [(set (pc)
***************
*** 12855,12867 ****
    "%+j%c1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "prefix_0f")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 0)
! 	     (const_int 1)))])
  
  ;; In general it is not safe to assume too much about CCmode registers,
  ;; so simplify-rtx stops when it sees a second one.  Under certain 
--- 12852,12864 ----
    "%+j%c1\t%l0"
    [(set_attr "type" "ibr")
     (set_attr "modrm" "0")
!    (set (attr "length")
  	   (if_then_else (and (ge (minus (match_dup 0) (pc))
  				  (const_int -128))
  			      (lt (minus (match_dup 0) (pc))
  				  (const_int 124)))
! 	     (const_int 2)
! 	     (const_int 6)))])
  
  ;; In general it is not safe to assume too much about CCmode registers,
  ;; so simplify-rtx stops when it sees a second one.  Under certain 
***************
*** 13122,13127 ****
--- 13119,13131 ----
    ""
    "jmp\t%l0"
    [(set_attr "type" "ibr")
+    (set (attr "length")
+ 	   (if_then_else (and (ge (minus (match_dup 0) (pc))
+ 				  (const_int -128))
+ 			      (lt (minus (match_dup 0) (pc))
+ 				  (const_int 124)))
+ 	     (const_int 2)
+ 	     (const_int 5)))
     (set_attr "modrm" "0")])
  
  (define_expand "indirect_jump"
***************
*** 13248,13261 ****
  			            (const_int 124))))
  		      (const_int 2)
  		      (const_int 16)))
!    (set (attr "type")
! 	(if_then_else (and (eq_attr "alternative" "0")
! 			   (and (ge (minus (match_dup 0) (pc))
! 			            (const_int -128))
! 			        (lt (minus (match_dup 0) (pc))
! 			            (const_int 124))))
! 		      (const_string "ibr")
! 		      (const_string "multi")))])
  
  (define_split
    [(set (pc)
--- 13252,13260 ----
  			            (const_int 124))))
  		      (const_int 2)
  		      (const_int 16)))
!    ;; We don't know the type before shorten branches.  Optimistically expect
!    ;; the loop instruction to match.
!    (set (attr "type") (const_string "ibr"))])
  
  (define_split
    [(set (pc)



More information about the Gcc-patches mailing list