[PATCH] D135451: [TTI] New PPC target hook enableUncondDivisionSpeculation

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 09:25:27 PDT 2022


fhahn added a comment.

In D135451#3843064 <https://reviews.llvm.org/D135451#3843064>, @alexgatea wrote:

> In D135451#3842992 <https://reviews.llvm.org/D135451#3842992>, @fhahn wrote:
>
>> IIUC this proposal would effectively re-define `udiv` and `urem`'s semantics on the IR level to not have undefined behavior for PPC?
>
> I don't think that's quite correct. We still view them as undefined, it's just that we allow further optimizations to happen that we previously bailed out of. The example I gave shows exactly this; without the speculative execution the div is still hoisted to the preheader, but this is done much later in the pipeline by MachineLICM so we do not optimize it fully (because IndVarSimplifyPass occurs earlier).

Right, but the reason `MachineLICM` can do this today is because at this point we are dealing with machine instructions.

In terms of LLVM IR semantics, this change would allow hoisting an instruction that may produce UB into a path that didn't have UB before AFAICT.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135451/new/

https://reviews.llvm.org/D135451



More information about the llvm-commits mailing list