+This option is disabled by default for most languages, enabled by
+default for languages that use garbage collection.

This is not true as of this patch.

Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c      (revision 232580)
+++ tree-ssa-loop-ivopts.c      (working copy)
@@ -2815,6 +2815,16 @@
    struct iv_cand *cand = NULL;
    tree type, orig_type;

+  /* -fkeep-gc-roots-live means that we have to keep a real pointer
+     live, but the ivopts code may replace a real pointer with one
+     pointing before or after the memory block that is then adjusted
+     into the memory block during the loop.  FIXME: It would likely be
+     better to actually force the pointer live and still use ivopts;
+     for example, it would be enough to write the pointer into memory
+     and keep it there until after the loop.  */
+  if (flag_keep_gc_roots_live && POINTER_TYPE_P (TREE_TYPE (base)))
+    return NULL;

Is there a reason to exclude a candidate if the base is just a pointer to an object? Or does it just not make a difference?

I feel somewhat uneasy that this probably isn't a full solution either. But it seems like a reasonable starting point. I'm still not sure we want to advertise the option to users, as it might overpromise at the moment. Do we have precedent for internal-only options?

Or maybe we do need some other form to represent the need to keep a pointer alive in the IL. I suspect that for gcc-6 your patch is probably reasonable, but we should mark the option as internal and likely to go away in the future.


Bernd

Reply via email to