[LLVMdev] Order of Operations

David Blaikie dblaikie at gmail.com
Mon Mar 26 12:55:55 PDT 2012


On Mon, Mar 26, 2012 at 12:20 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> Does LLVM (clang) give information about the Order of Operations to the IR?
> Or does it merely just sequence the operations in the correct order?

The latter. (well, in one of the correct orders) The backend doesn't
know about side-effecting functions it is allowed to reorder, it just
doesn't reorder them.

(eg, for "foo(bar(), baz())" Clang emits bar and baz in some order (I
believe left-to-right) and then LLVM doesn't get any information that
it can reorder them, so it doesn't (unless it inlines them or
otherwise proves that they can't effect each other, perhaps))

- David



More information about the llvm-dev mailing list