------- Additional Comments From ghazi at gcc dot gnu dot org 2005-04-28 13:11 ------- Roger Sayle provided this feedback to me in private email and agreed to have it copied here:
------------------------------------------------------------------ I've glanced through the code and I suspect I know why this isn't working. The MALLOC attribute is traditionally handled in calls.c where it attaches a REG_NOALIAS note to the relevant call_insn. In the case of alloca, however, we don't go through calls.c and instead inline calls to alloca via expand_builtin_alloca in builtins.c instead. My guess is that we need to add a REG_NOALIAS note, or mark/assign the alias set of this pointer in builtins.c. Interestingly, this doesn't explain why the builtins-13.c tests aren't now being optimized by tree-ssa, where the "malloc" attribute should now be getting used during the early alias analysis passes. Unfortunately, I'm not an expert of how to present aliasing information at the RTL-level. But the above should help explain why alloca behaves differently to malloc/calloc/strdup etc. Roger -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20638