Enable constant propagation for more math functions

Erik Schnetter via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 12:10:05 PDT 2015


Vedant

Thanks for the pointer. I think that "CHECK: ret" statements are missing.

-erik

On Thu, Aug 27, 2015 at 2:38 PM, Vedant Kumar <vsk at apple.com> wrote:

> check-all runs fine on my machine too. From the logs, I see:
>
> >> <stdin>:372:7: error: CHECK-NOT: string occurred!
> >>  %1 = call double @acos(double 3.000000e+00)
> >>       ^
> >>
> /home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/test/Transforms/ConstProp/calls.ll:421:14:
> note: CHECK-NOT: pattern specified here
> >> ; CHECK-NOT: call
>
>
> However, line 421 of calls.ll tests is:
>
>     "%0 = call float @tanhf(float 3.000000e+00)",
>
> and the output string FileCheck matches against is:
>
>     "%1 = call double @acos(double 3.000000e+00)" (from line 430).
>
> So I suspect that the code is fine but the test case is flaky. I will keep
> looking at this, but I thought I'd shoot this email back at you now in case
> it helps :).
>
> vedant
>
>
> > On Aug 27, 2015, at 11:14 AM, Erik Schnetter <schnetter at gmail.com>
> wrote:
> >
> > This commit led to test suite failures (see e.g. <
> http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30501>),
> so I reverted it.
> >
> > Locally, everything is fine if I run "make check". Do you have pointers
> for debugging this?
> >
> > -erik
> >
> > On Thu, Aug 27, 2015 at 12:41 PM, Erik Schnetter <schnetter at gmail.com>
> wrote:
> > Committed as 246158.
> >
> > -erik
> >
> > On Wed, Aug 26, 2015 at 1:51 PM, Vedant Kumar <vsk at apple.com> wrote:
> > LGTM, this is ready to land.
> >
> > It turns out that we _can_ combine these tests. I'll take care of it in
> a followup patch since existing tests need to be changed.
> >
> > > >> +define float @test_atan2f() nounwind uwtable ssp {
> > > >> +entry:
> > > >> +; CHECK-LABEL: @test_atan2f(
> > > >> +; CHECK-NOT: call
> > > >> +  %0 = call float @atan2f(float 3.000000e+00, float 4.000000e+00)
> > > >> +  ret float %0
> > > >> +}
> > > >>
> > > >> +; Shouldn't fold because of -fno-builtin
> > > >> +define float @atan2f_() nounwind uwtable ssp {
> > > >> +; FNOBUILTIN-LABEL: @atan2f_(
> > > >> +; FNOBUILTIN: %1 = call float @atan2f(float 3.000000e+00, float
> 4.000000e+00)
> > > >> +  %1 = call float @atan2f(float 3.000000e+00, float 4.000000e+00)
> > > >> +  ret float %1
> > > >> +}
> > >
> > > I've noticed many pairs of test functions like the one above. Can this
> pair be combined into one function? E.g:
> > >
> > > >> +define float @atan2f_() nounwind uwtable ssp {
> > > >> +; CHECK-LABEL: @_atan2f(
> > > >> +; FNOBUILTIN-LABEL: @atan2f_(
> > > >> +; CHECK-NOT: call
> > > >> +; FNOBUILTIN: %1 = call float @atan2f(float 3.000000e+00, float
> 4.000000e+00)
> > > >> +  %1 = call float @atan2f(float 3.000000e+00, float 4.000000e+00)
> > > >> +  ret float %1
> > > >> +}
> > >
> > > I don't know, I'm not too familiar with the test system. These are two
> different tests: in one, the call should be eliminated (constant-folded),
> in the other case, it should not. Do you have a pointer to documentation or
> other examples that cover this detail?
> >
> > Your ">> +; CHECK-NOT: call" lines check that there is "NOT" a "call",
> i.e the call is folded away. When "-fno-builtin" is passed to the compiler
> however, we want the call preserved. FileCheck lets you specify different
> check prefixes for different usage scenarios.
> >
> > Googling "llvm-lit" or "llvm FileCheck" should turn something up.
> >
> > thanks!
> > vedant
> >
> > >
> > > If so, it would be nice to reduce the test case size. Apart from that,
> please run clang-format -style=llvm on your changes. Everything else looks
> good.
> > >
> > > I attach the updated (re-formatted) patch.
> > >
> > > -erik
> > >
> > > vedant
> > >
> > > On Aug 25, 2015, at 1:14 PM, Erik Schnetter via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> > >
> > > > It seems that constant propagation for single precision math
> functions (such as tanf) is already working, but was not enabled. This
> patch enables these for many single-precision functions, and adds
> respective test cases.
> > > >
> > > > List of newly handled functions: acosf asinf atanf atan2f ceilf
> coshf expf exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf
> > > >
> > > > -erik
> > > >
> > > > --
> > > > Erik Schnetter <schnetter at gmail.com>
> http://www.perimeterinstitute.ca/personal/eschnetter/
> > > > <constprop.diff>_______________________________________________
> > > > llvm-commits mailing list
> > > > llvm-commits at lists.llvm.org
> > > >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=nRkKAYlatRp-Wgk-tAtmRg&m=zIeTq7C24I26_ny62rhiVNnPUKhiL-ttf5E5SdvSYfM&s=hnzB8DZ-EJj3yM7S-bYX5mwxBMka0n18KAACB3fEHcQ&e=
> > >
> > >
> > >
> > >
> > > --
> > > Erik Schnetter <schnetter at gmail.com>
> http://www.perimeterinstitute.ca/personal/eschnetter/
> > > <constprop.diff>_______________________________________________
> > > llvm-commits mailing list
> > > llvm-commits at lists.llvm.org
> > >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=nRkKAYlatRp-Wgk-tAtmRg&m=pdx8WaNzTKH4XL-GadzDAXtcW_0Dy5TSuEq-r6kr_Cw&s=p1rycXaVwpkLIJ6ivjsTu1JL_CRTjkncrT0wSb31Qy8&e=
> >
> >
> >
> >
> > --
> > Erik Schnetter <schnetter at gmail.com>
> http://www.perimeterinstitute.ca/personal/eschnetter/
> >
> >
> >
> > --
> > Erik Schnetter <schnetter at gmail.com>
> http://www.perimeterinstitute.ca/personal/eschnetter/
>
>


-- 
Erik Schnetter <schnetter at gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150827/05275125/attachment.html>


More information about the llvm-commits mailing list