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

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 5 01:02:03 PDT 2015


> The proposed change is to split the semantics of convergent into two
> 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


More information about the llvm-dev mailing list