Daniel Berlin via llvm-dev
2016-Aug-24 15:57 UTC
[llvm-dev] LLVM 3.9 RC2's SCCP pass removing calls to external functions?!
Actually, this is false. It will infer the attribute :) On Wed, Aug 24, 2016 at 5:47 AM, Renato Golin via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On 24 August 2016 at 11:45, Alexandre Isoard <alexandre.isoard at gmail.com> > wrote: > > However, he also stated that in the case the functions returns void it is > > not removed, which suggest there is something fishier going on. > > Looking back at the example (and LangRef, for function attributes), > looks like it's not legal to remove because the function does *not* > have "readnone" or "readonly", so LLVM can't prove it side-effect > free. > > Sanjoy's fix is probably on the right track. > > --renato > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160824/1b1ffc59/attachment.html>
Daniel Berlin via llvm-dev
2016-Aug-24 15:59 UTC
[llvm-dev] LLVM 3.9 RC2's SCCP pass removing calls to external functions?!
(though it's still illegal to remove it in this particular case). I'm just saying, just because you don't make a function read-only or read-none, doesn't mean clang/llvm won't infer the attribute. Here, it's illegal because you don't have the definition. The function is also may-throw. So even if it was readnone/readonly, we could not remove the call. On Wed, Aug 24, 2016 at 8:57 AM, Daniel Berlin <dberlin at dberlin.org> wrote:> Actually, this is false. > It will infer the attribute :) > > > > On Wed, Aug 24, 2016 at 5:47 AM, Renato Golin via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> On 24 August 2016 at 11:45, Alexandre Isoard <alexandre.isoard at gmail.com> >> wrote: >> > However, he also stated that in the case the functions returns void it >> is >> > not removed, which suggest there is something fishier going on. >> >> Looking back at the example (and LangRef, for function attributes), >> looks like it's not legal to remove because the function does *not* >> have "readnone" or "readonly", so LLVM can't prove it side-effect >> free. >> >> Sanjoy's fix is probably on the right track. >> >> --renato >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160824/c5c62af1/attachment-0001.html>
Renato Golin via llvm-dev
2016-Aug-24 17:23 UTC
[llvm-dev] LLVM 3.9 RC2's SCCP pass removing calls to external functions?!
On 24 August 2016 at 16:59, Daniel Berlin <dberlin at dberlin.org> wrote:> Here, it's illegal because you don't have the definition.This case also fails when the function is "extern". cheers, --renato