[PATCH] D49144: [FunctionAttrs] Infer the speculatable attribute

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 15:51:44 PDT 2018


hfinkel added a comment.

In https://reviews.llvm.org/D49144#1158047, @Meinersbur wrote:

> > My assumption here is that we need to assume that any loads performed by the function, and any incoming arguments, might be poison. As a result, we can't have any branches, PHIs, or stores (even to local static allocas) - because doing any of these things with poison values is UB. Is that correct?
>
> Control flow that might lead to infinite loops might be a problem, but why not allow at least acyclic control flow?
>
> If the value stored to an alloca is thrown away after the `ret`, why is it a problem to be executed speculatively?


I first started coding it that way. Even if we branch on a poison value, why does it matter so long as there are no observable side effects? My fear was that, if we do that, and then we hoist the call, and then we inline the function body, we now may have a case where we clearly branch on a poison value and that, as I understand it, is UB. I may be mistaken, and if I am, then we should allow branching and stores to static allocas, etc.


Repository:
  rL LLVM

https://reviews.llvm.org/D49144





More information about the llvm-commits mailing list