[PATCH] Verify 'optnone' can run DAG combiner when appropriate

David Blaikie dblaikie at gmail.com
Wed Mar 25 13:22:46 PDT 2015


On Wed, Mar 25, 2015 at 1:17 PM, Paul Robinson <
Paul_Robinson at playstation.sony.com> wrote:

> Hi dblaikie,
>
> DAG combiner had been disabled for 'optnone' functions in r221168.
> It was re-enabled in r233153. Add a test to keep it from happening again.
>

Is this basically the same test from r221168 (that was removed in r233153)?
If not, what's the particular motivation for this test to be different? If
it is essentially the same - go for it!


>
> http://reviews.llvm.org/D8614
>
> Files:
>   test/CodeGen/X86/dag-optnone.ll
>
> Index: test/CodeGen/X86/dag-optnone.ll
> ===================================================================
> --- test/CodeGen/X86/dag-optnone.ll
> +++ test/CodeGen/X86/dag-optnone.ll
> @@ -0,0 +1,38 @@
> +; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s
> +; Verify that when an 'optnone' function bails out of fast-isel, it will
> run
> +; the DAG combiner. (This was disabled by r221168, re-enabled in r233153.)
> +; We set unsafe-fp-math which allows the DAG combiner to fold the fadd
> sequence
> +; into an fmul. We have a non-optnone function doing the same thing, to
> show
> +; that the combine is expected.
> +; Note, this will start failing if somebody decides that this combine
> should
> +; not occur at -O0 (because 'optnone' essentially sets -O0 for the
> function).
> +; FIXME: We use a Windows triple because the calling convention ends up
> causing
> +; fast-isel to bail out.  A more robust tactic for ensuring fast-isel will
> +; bail out would be better.
> +
> +define float @foo(float %x) #0 {
> +entry:
> +  %add = fadd fast float %x, %x
> +  %add1 = fadd fast float %add, %x
> +  ret float %add1
> +}
> +
> +; CHECK-LABEL: @foo
> +; CHECK-NOT:   add
> +; CHECK:       mul
> +; CHECK-NEXT:  ret
> +
> +define float @fooWithOptnone(float %x) #1 {
> +entry:
> +  %add = fadd fast float %x, %x
> +  %add1 = fadd fast float %add, %x
> +  ret float %add1
> +}
> +
> +; CHECK-LABEL: @fooWithOptnone
> +; CHECK-NOT:   add
> +; CHECK:       mul
> +; CHECK-NEXT:  ret
> +
> +attributes #0 = { "unsafe-fp-math"="true" }
> +attributes #1 = { noinline optnone "unsafe-fp-math"="true" }
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150325/f0d5b485/attachment.html>


More information about the llvm-commits mailing list