[PATCH] D11577: Reassociate: Implement isUnmovableInstruction() without a hardcoded list

Matthias Braun matze at braunis.de
Tue Jul 28 16:36:06 PDT 2015


MatzeB added a comment.

In http://reviews.llvm.org/D11577#213942, @bkramer wrote:

> In http://reviews.llvm.org/D11577#213912, @MatzeB wrote:
>
> > Note that this change takes the [USF]Div and [USF]Rem instructions out of the list, with llvms semantics they do not produce side effects (but just a poison value) so this should be fine. I'm also running the llvm-testsuite now to get some more testing for this change.
>
>
> Integer div by zero will still trap so div and rem cannot be moved freely between basic blocks without changing behavior. I'm not sure if Reassociate performs movements that could move instructions into a different path in the CFG, but if it does we'll need something stronger like `isSafeToSpeculativelyExecute`.


>From what I can see it does not move the instructions into different CFG paths but just inside a basic block, but that may already fail if you reorder an instruction potentially triggering undefined behaviour and a call I think, so switching to isSafeToSpeculativelyExecute() is the right call.


Repository:
  rL LLVM

http://reviews.llvm.org/D11577







More information about the llvm-commits mailing list