On Jan 30, 2008, at 6:11 PM, Dale Johannesen wrote: > > On Jan 30, 2008, at 5:13 PM, Dale Johannesen wrote: > >> >> On Jan 30, 2008, at 5:05 PM, Devang Patel wrote: >> >>> handle_used_attribute() sets DECL_PRESERVE_P bit, so what am I >>> missing ? >> >> It was not set in the example in gcc.dg/tree-used.c. I'll step >> through and figure out why, agree it looks like it ought to be. > > In that example there is a declaration with __attribute__((used)), > followed by a definition without it. merge_decls clobbers the > PRESERVE bit when it merges the two nodes gcc constructs. The > DECL_USED bit is not clobbered, which is enough to cause the function > to be emitted with non-llvm-gcc but not with llvm-gcc, which is enough > to get the test to pass. But, the no_dead_strip command is > incorrectly dropped in the non-llvm-gcc version as well. So I've > stumbled into a latent gcc bug, although not one that causes any > testsuite failures AFAICT. > (The attributes list is merged correctly in merge_decls, so my patch > seems to be an improvement. However, there's another case in my > example, where a definition without attribute((used)) is followed by a > declaration with attribute((used)). For that, the USED bit gets set > and is good enough for gcc to emit the body, as before, but both > compilers drop the no_dead_strip: a bug. Unfortunately the USED bit > is not good enough for llvm: llvm drops the second definition if you > run llvm-as | opt | llc instead of using llvm-gcc. So there's still a > bug here that may matter.)
okay.. > Good catch, thanks Devang. :) I remembered this because Objective-C FE sets DECL_PRESERVE_P for certain decls to ensure that llvm optimizer/code generator does not drop them. These are LLVM specific patches in objc-act.c While you're here please make sure that they are not broken. Thanks! - Devang _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits