[cfe-dev] How to configure clang, to get const functions out of the loop (like on FreeBSD) ?

John McCall via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 18 11:37:42 PDT 2017


> On Aug 18, 2017, at 10:49 AM, Dimitry Andric <dimitry at andric.com> wrote:
> On 16 Aug 2017, at 17:24, John McCall via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>> 
>>> On Aug 16, 2017, at 6:15 AM, Nat! <nat at mulle-kybernetik.com> wrote:
>>> John McCall schrieb:
>>> 
>>>> I don't know of any reason why this would be different on different platforms, and I can verify that hacking a .ll file to pretend to be freebsd doesn't convince LLVM to hoist it.  Much more likely is that the FreeBSD version is a very old version of Clang; maybe there is a more recent change that prevents hoisting of const calls in some situations.  At any rate, your best bet is to file a bug.
>>>> 
>>>> John.
>>> 
>>> Hi John,
>>> 
>>> Thanks for the reponse.
>>> 
>>> In the meantime, I've tried various freebsd clang versions. The regression happens between 3.8.1 and 3.9.0. I tried 3.8.1 on my own linux machine and the compiler also did hoist `foo` out of the loop.
>>> 
>>> So it seems that the godbolt explorer is somehow fooling with me, since there 3.8.1 does not do it. That's so curious though, that I still believe it must be a change in the config options somehow. (I tried with Firefox and Chrome).
>>> 
>>> I put up a bug report https://bugs.llvm.org/show_bug.cgi?id=34208 on this matter. But filing a bug is likely not my best bet. I say that with my experience of another optimizing bug which pains me a lot (https://bugs.llvm.org/show_bug.cgi?id=24448). It's been open for ~ 2 years :)
>>> 
>>> So is there an easy way for me to narrow this bug down further to the commit level ? I read about llvmlab somewhere once, but http://lab.llvm.org/ seems closed ...
>> 
>> Well, you could certainly just check out the source code and use 'git bisect'.
> 
> I did, and it apparently regressed because of this commit:
> 
> https://reviews.llvm.org/rL272489 ("[LICM] Make isGuaranteedToExecute more accurate")
> 
> Apparently this was a fix for <https://bugs.llvm.org/show_bug.cgi?id=27857>.

This seems like an unintentional regression, then.

John.



More information about the cfe-dev mailing list