[llvm-dev] [RFC] Refinement of convergent semantics

Sanjoy Das via llvm-dev
2015-09-05T08:02:03Z

> annotations:
>
> convergent - this operation may not be made control dependent on any
> additional values (aka may not be sunk into a condition)

Does every unknown function need to be conservatively considered
containing a convergent operation?  IOW, I'd want LLVM to unswitch
this:

 for (…) {
   if (c) { … }
   call (*func_ptr)();
 }

but (*func_ptr)() may contain a convergent operation in it (and it may
later get devirtualized and inlined).

Also, how about transforms like these:

  if (a & b)
    convergent();

==>

  if (a)
    if (b)
      convergent();

?

> nospeculate - this operation may not be added to any program trace
> on which it was not previously executed (same as notrap?)

How is this different from, say, a store to the heap?  Or a volatile
load?  If not, maybe nospeculate operations can just be modeled as
writing to the heap?

-- Sanjoy